The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 7 of 7

Thread: copy motion as moviescript into a class

  1. #1
    Registered 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:
    import flash.display.*;
    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.

  2. #2
    Registered User

  3. #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...)

  4. #4
    Registered User
    Sorry about that... here it is:

    package com.fred.stuff
    import flash.display.*;
    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 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">
    <SimpleEase ease="0"/>

    <Keyframe index="19">
    <Color alphaMultiplier="0"/>

    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:

    import com.fred.stuff.TestExperiment;
    var testExperiment:MovieClip;

    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... =(

  5. #5
    Registered User
    help anyone? i'm not really one who likes to bother others.. but i really need help on this one >_< thanks in advace

  6. #6
    animator = new Animator(animatorXML,this.getChildAt(0));

  7. #7
    Registered 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

    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 ^_^

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012