2 Replies Latest reply on Dec 3, 2009 8:39 AM by anaping wan

    Mxmlc, AS3 and fl.motion.* classes causing runtime problems..



      I am new to ActionScript, CS4 and Flex. I am running into a runtime problem that I hope someone could shed some light on. Appreciate any feedback.


      1) I coded an ActionScript in the Flash IDE (Flash CS4), as part of a .fla project. I used the fl.motion.* (specifically, the AnimatorFactory, MotionBase and Motion classes from this package). When I converted the .fla to .swf, things work fine and my animations show up fine


      2) I tried compiling the .as file using mxmlc.exe (from Flex 3.0 SDK) to convert it to .swf. I got errors about fl.motion.* not being available or something to this effect. I copied the fl source files (.as) into the source-path of mxmlc and recompiled. mxmlc created a .swf file without any errors this time.


      However, when I try to run the SWF the code relating to the Motion, MotionBase and AmimationFactory alone does not seem to work. i.e. the animation does not happen. The generated SWF behaves just fine otherwise (images are displayed, etc.). I am testing the SWF on a Flash Player (version 10.x).


      The is the part of the code that seems to not do anything...



      if(__motion_b_2 == null) {
            trace("Moving bat");                       // trace show up ...
            __motion_b_2 = new Motion();
            __motion_b_2.duration = 55;
            __motion_b_2.addPropertyArray("x",[....// deltaxValues, comma separated...]);
            __motion_b_2.addPropertyArray("y",[....// deltaYValues: comman separated...]);
            var __animFactory_b_2:AnimatorFactory = new AnimatorFactory(__motion_b_2);
            __animFactory_b_2.addTarget(b, 0);



      Question: My assumption is that the fl.* classes would be bundled into the .swf file by mxmlc. Is this correct? What do I have to do to make sure the SWF has the fl related code for it to work in Flash Player.


      Any thoughts/pointers would be greatly appreciated.