Results 1 to 7 of 7
-
September 2nd, 2008, 12:37 PM #137Registered User
postscopy 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:
import flash.display.*;
import flash.events.*;
import fl.motion.Animator;
import fl.motion.*;
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
postsanyone?
-
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...)
* [ Flash portfolio ] http://www.erikhallander.com/
* [ Flash blog ] http://www.erikhallander.com/blog/
* [ Work @ ] http://www.visualjazz.com.au
-
September 3rd, 2008, 08:00 AM #437Registered User
postsSorry about that... here it is:
package com.fred.stuff
{
import flash.display.*;
import flash.events.*;
import fl.motion.Animator;
import fl.motion.*;
public class TestExperiment extends MovieClip
{
public function TestExperiment():void
{
this.addEventListener(Event.ADDED, swirl);
}
function swirl(event:Event):void
{
trace("TestExperiment, Swirl");
import fl.motion.Animator;
var this_xml:XML = <Motion duration="20" xmlns="fl.motion.*" xmlns:geom="flash.geom.*" xmlns:filters="flash.filters.*">
<source>
<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">
<dimensions>
<geom:Rectangle left="0" top="0" width="38" height="32"/>
</dimensions>
<transformationPoint>
<geom
oint x="0.5" y="0.5"/>
</transformationPoint>
</Source>
</source>
<Keyframe index="0" rotateDirection="cw" rotateTimes="1" tweenSnap="true" tweenSync="true">
<tweens>
<SimpleEase ease="0"/>
</tweens>
</Keyframe>
<Keyframe index="19">
<color>
<Color alphaMultiplier="0"/>
</color>
</Keyframe>
</Motion>;
var this_animator:Animator = new Animator(this_xml, this);
this_animator.play();
}
}
}
the whole bunch of stuff inside swirl function was the pasted code using "copy motion as action script"
in my main class, i have:
import com.fred.stuff.TestExperiment;
var testExperiment:MovieClip;
testExperiment = new TestExperiment();
addchild(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
postshelp 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
try:
Code:animator = new Animator(animatorXML,this.getChildAt(0));
-
September 4th, 2008, 11:52 AM #737Registered User
poststhanks for the reply Felixz! I figured it out though... apparently i had to declare the animator instance outside of the function so i put
var this_animator:Animator;
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 ^_^

Reply With Quote

Bookmarks