R – use timeline scripting on embedded SWF assets w/ the Flex SDK

actionscriptactionscript-3apache-flexflex3

I've embedded a SWF into a class using this syntax above my class definition:


[Embed (source='/../assets/MyMovieClips.swf', symbol='SpecialMovieClip')]
public class SpecialMovieClip extends MovieClip

The MovieClip asset seems linked with my class okay, and instantiates along with it, and is visible, but:

  • I can't access instances placed on stage within that clip.
  • The timeline scripting seems non-functional.

Is this the drawback of embedding SWF files at compile-time with the Flex SDK?
So, maybe I should just go back to compiling with the Flash IDE if I want timeline scripting or instances positioned on-stage?

Best Answer

  1. if you embed with the [Embed ] tag all scripts will be stripped from you symbol. But you can add script to frames with MovieClip.addFrameScript():

    public function SpecialMovieClip(){

    addFrameScript(4,myfunc)

    }

    private function myfunc(){

    stop()

    }

  2. i think you can only access the symbols inside a movieClip with movieClip.GetChildAt()

Related Topic