-
? about functions
Someone gave me this code to make my movie "pop" move to a predefined location. It works great. My problem is that on the "pop" movie it is draggable so after I activate this function, when I drag "pop" movie. It bounces back to -64.5 How do I tell the function to stop working.
targXpos = -64.5;
pop.onEnterFrame = function() {
pop._x -= (pop._x-targxpos)/10;
};
Thanks for the help
-
Senior Member
code:
delete pop.onEnterFrame;
is all you need I believe
-
Thank You
Thank you for the help, that worked perfectly.
Thanks
-
Another Question
Once my tartXpos is reached how do I trigger another set of code to start.
Say I reach my targXpos = -64.5;
I want to tell another movie smt.gotoAndPlay(5);
targXpos = -64.5;
pop.onEnterFrame = function() {
pop._x -= (pop._x-targxpos)/10;
};
-
Senior Member
code:
if(pop._x <= -64.5) {
smt.gotoAndPlay(5);
}
?
or is it more complicated than that?
-
Stupid Question
That would probably work, I just dont know where to put the code, I tried many places, but I just cant seem to find the right place. Were Do I put the code?
Thank you very much for all your help
ActionScript:--------------------------------------------------------------------------------if(pop._x <= -64.5) {
smt.gotoAndPlay(5);
}
--------------------------------------------------------------------------------
-
Senior Member
i'm guessing you're looking for this, ease it in, then play smt
code:
targXpos = -64.5;
pop.onEnterFrame = function() {
this._x -= (this._x-targXpos)/10;
if(this._x <= (targXpos + 2)) {
delete this.onEnterFrame;
smt.gotoAndPlay(5);
}
}
the problem with your original easing and check is it will never actually reach -64.5. will come to -64.9999999, so to make this work practically i've added (targXpos + 2), which can be tweaked to your needs.
Last edited by chi-styler; 03-29-2004 at 04:19 PM.
-
Thank You Very Much
Thank you very much the addition of the +2 and the delete this.onEnterFrame; works great. I greatly appriciate all the help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|