views:

224

answers:

1

The ide i am using is flash cs3. the as2 swf contains a tween code using mx transitions. when i remove this tween code and hard code it on the enterframe there seems to be no problem. afaik avm2 should fully supports the as2 and as1 code. so i am unable to understand why this disparity when coding a simple tween in as2 swf. i had made a post in the actionscript forums hoping to gain some light on the issue. with a very simple attachment illustrating the issue http://www.actionscript.org/forums/showthread.php3?t=229901 p.s the 2 swf do not interact with each other. the code in as2 file

//~~~~~~~~~~~~~~~~~~~~~~~ with tween class
import mx.transitions.*;
import mx.transitions.easing.*;

function tweenMe(mc, target) {
myTween = new Tween(mc, "_x", Regular.easeOut, mc._x, target, 2, true);
}
tweenMe(mc, 700);

//~~~~~~~~~~~~~~~~~~~~~~~ Simple Hard coded control

/*this.onEnterFrame = function() {
    mc._x += (700-mc._x)/10;
};
*/
A: 

I don't think you can use _x while using AS3 Tween Class. Your Actionscript-2 swf will be treated as AVM1Movie object (descendants of DisplayObject). And in ActionScript-3, DisplayObject doesn't have property _x. So Try using:

function tweenMe(mc, target) {
myTween = new Tween(mc, "x", Regular.easeOut, mc.x, target, 2, true);
}
tweenMe(mc, 700);
ActionScript-3 Documentation says this: The AVM1Movie object can use methods and properties inherited from the DisplayObject class (such as x, y, width, and so on). However, no interoperability (such as calling methods or using parameters) between the AVM1Movie object and AVM2 objects is allowed.

bhups
the code i have posted is done in the as2 file. i do know how to use the tween class in as3 which is not relevant to my question here. if you look at the AS2 CODE i am using mx.transitions also this does not import into as3. the code works independent of the loader swf. it runs the first time around but doesnt do so the second time i load it.
AdityaGameProgrammer
i have the sample file attached in the link i provided. its the working file. of as3 and as2. when we change the code type in as2 file to tween. then it does not function.
AdityaGameProgrammer