Can I use timeline scripts for embedded SWF assets using the Flex SDK?

I have included SWF in the class using this syntax above my class definition:

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


The MovieClip object seems to be linked to my class in order and create with it and display, but:

  • I cannot access the instances placed on the stage inside this clip.
  • Timeline scripts seem to be non-functional.

Is this a disadvantage of nesting SWF files at compile time using the Flex SDK? So maybe I should go back to compiling with the Flash IDE if I want time scripts or instances to be placed in a stage?

+2


source to share


2 answers


  • if you embed with the [Embed] tag, all scripts will be removed from your symbol. But you can add a script to frames with MovieClip.addFrameScript ():

    public function SpecialMovieClip () {

    addFrameScript (4, MyFunc)

    }

    private function myfunc () {

    stop()

    }

  • I think you can only access the characters inside movieClip using movieClip.GetChildAt ()



+2


source


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

If the SWF file contains any ActionScript, Flex prints a warning at compile time and then removes the ActionScript from the inline symbol. This means that you can only insert the symbol itself.



Depending on what you want to do I think you are better off nesting the whole SWF or loading things at runtime.

By the way, regarding not being able to access stuff inside an inline symbol, are you sure the target SWF is AS3? If you are embedding (or downloading) AS2 content, then compatibility is only allowed through LocalConnection. This is also covered in the doc page I linked to.

+1


source







All Articles