Hi!
what is the right action script to drag a particular button without draging others. If I put the action script that I wrote below, it will let me to drag everything, even my background.
Thanks a lot!!!
–action script–
on (press) {
this.startDrag()
}
on (release) {
this.stopDrag()
}
on (press) {
startDrag(this)
}
on (release) {
stopDrag()
}
PS: I am moving this thread to the Actionscript forum as this has nothing to do with HTML or Javascript and you posted it in the HTML/Javascript forum.
I think you may find that the background is being dragged because the button is sitting on the main timeline (in which case this.startDrag() and startDrag(this) will both reference _root).
I’d suggest you place the button inside an instance of a movie clip: select the instance of the button, press F8 and choose Movie Clip. Then either this.startDrag() and startDrag(this) will work.
Absolutely right jsk. When you define an on (something) event, and if you use this, you refer to the clip containing the button (the _root in this case).
In MX, there’s another way to solve this: declare a dynamic even handler in the timeline. For instance:
but.onPress=startDrag;
pom :asian:
Creating engaging and entertaining content for designers and developers since 1998.