Results 1 to 7 of 7
September 2nd, 2008, 12:37 PM #137Registered User
copy motion as actionscript into a new mc class
Good day, kind sir's. I have a quick question..
Why doesn't this work:
i have a class that extends movieclip, then in it i put a "move" function that runs when an instance of the class is added (event.ADDED).
Then, i created that class in the main time line, created a keyframe, made a motion tween and stuff, then copied those frames as action script.
In the "move" function, i pasted the above motion code.
However... when i run it, it doesn't move =(
i placed trace functions before and after the pasted coded and both of them were working properly... what step am i missing?
i already imported:
into the class btw..
thanks for your time
Last edited by zoink; September 3rd, 2008 at 01:35 PM.
September 3rd, 2008, 02:23 AM #237Registered User
September 3rd, 2008, 02:50 AM #3
We're not psychic. You need to paste your class, not just the import statements (that are wrong btw, never use .* unless you're actually USING every single class in the package...)
September 3rd, 2008, 08:00 AM #437Registered User
Sorry about that... here it is:
public class TestExperiment extends MovieClip
public function TestExperiment():void
var this_xml:XML = <Motion duration="20" xmlns="fl.motion.*" xmlns:geom="flash.geom.*" xmlns:filters="flash.filters.*">
<Source frameRate="12" x="162.35" y="134.35" scaleX="1" scaleY="1" rotation="0" elementType="movie clip" symbolName="testMotion" class="com.fred.stuff.testMotion">
<geom:Rectangle left="0" top="0" width="38" height="32"/>
<geomoint x="0.5" y="0.5"/>
<Keyframe index="0" rotateDirection="cw" rotateTimes="1" tweenSnap="true" tweenSync="true">
var this_animator:Animator = new Animator(this_xml, this);
the whole bunch of stuff inside swirl function was the pasted code using "copy motion as action script"
in my main class, i have:
testExperiment = new TestExperiment();
When i run it... the trace in swirl works... but the copy pasted code doesn't work... The testExperiment just sits in the stage... =(
September 3rd, 2008, 01:37 PM #537Registered User
help anyone? i'm not really one who likes to bother others.. but i really need help on this one >_< thanks in advace
September 4th, 2008, 05:27 AM #6
animator = new Animator(animatorXML,this.getChildAt(0));
September 4th, 2008, 11:52 AM #737Registered User
thanks for the reply Felixz! I figured it out though... apparently i had to declare the animator instance outside of the function so i put
outside all the functions of my TestExperiment class.
I still don't know why i have to do that though X_X but thanks for your help ^_^