Question

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?

Was it helpful?

Solution

  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()

OTHER TIPS

From the docs: (scroll down to "Embedding SWF Symbols")

If the SWF file contains any ActionScript code, Flex prints a warning during compilation and then strips out the ActionScript from the embed symbol. This means that you can only embed the symbol itself.

Depending on what you want to do, I think you'd be better off embedding the entire SWF, or loading things in at runtime.

Incidentally, regarding not being able to access stuff within the embedded symbol, did you make sure that the target SWF is AS3? If you're embedding (or loading) AS2 content, then interoperability is only allowed through LocalConnection. This is also covered on the doc page I linked.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top