|
-
Why would this work in F6, AS1 but not F7, AS2?
I have the following code which "scoots" a MC to a location with elasticity:
Code:
slideY = function(mc, dest) {
mc.onEnterFrame = function() {
this._Y = slideMc(this, "_Y", dest, .4, .6);
if (Math.round(this._Y) == [dest]) {
trace("slideY done");
this.onEnterFrame = undefined;
}
};
}
slideMc = function(mc, property, destination, inertia, friction) {
yspeed = ((puppy._y-destination)*inertia)+(yspeed*friction);
mc[property] -= yspeed;
return (mc[property]);
}
However this will work fine if I export the swf as Flash 6, ActionScript 1.0, but it will not work as Flash 7, ActionScript 2.0.
Why is this?
-
free-webmaster-resource.com
This line :
Code:
yspeed = ((puppy._y-destination)*inertia)+(yspeed*friction);
yspeed traced NAN
You init the variable yspeed there but also use it instantly, that messes it up i guess.
-
You're exactly right. Initializing the yspeed vairaible beforehand solves the problem in v7, AS2.
Thanks so much.
-
free-webmaster-resource.com
no problem
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
|