Skip navigation
Currently Being Moderated

SWFLoader @Embed isse

Apr 9, 2008 10:46 AM


I have some code that uses an extended SWFLoader to load flash swf content.

I have some methods that are called on init and complete to make assignments.

I can then call methods in the loaded content via MovieClip(this.content).myMehtod(); etc..

However.. when I move to embed the source, I can no longer get init or complete events to get called and when I access the content it says the methods are not accessable.

Does the @Embed add an additional layer in there or something?

Works with this:
<ns1:IMAPSSWFLoader x="35" y="454" width="112" height="31" id="test" source="mc/test.swf" scaleContent="false"/>
Breaks when I embed:
<ns1:IMAPSSWFLoader x="35" y="454" width="112" height="31" id="test" source="@Embed('mc/test.swf')" scaleContent="false"/>
* loadedMC contains an instance of the loaded MovieClip
* @param value:MovieClip
* @return MovieClip;
* */
public function get loadedMC():MovieClip
{ if (_loadedMC == null)
_loadedMC = MovieClip(this.content);
return _loadedMC;
I have searched and found nothing on google on this.

Any pointers in the right direction would be helpful.
  • Currently Being Moderated
    Apr 10, 2008 7:52 AM   in reply to GoosePoop
    I've had similar issue with embedded swf. When I dynamically loaded the swf with swfloader, it worked fine, i could access the movieclip content, however, when the swf was embedded, i cannot access the methods or properties of the swf. This is infact stated in the help document.

    As a solution, I resorted to making the swf into a SWC as a custom component using the Flex Component Kit for Flash CS3. Everything works fine now.

    Hope it helps.
    Mark as:
  • Currently Being Moderated
    Nov 20, 2012 8:50 AM   in reply to GoosePoop

        <mx:SWFLoader id="swfObj"

                  width="100%" height="100%"







                            private static var swfClass:Class;


                            private var swfSoundBar : MovieClip;


                            [Bindable] private var mp3Player:MP3Player = MP3Player.getInstance();


                            protected function init(event:FlexEvent):void


                                      swfSoundBar = new swfClass();


                                      var byteArray:ByteArray = swfSoundBar.movieClipData;


                                      var loaderContext: LoaderContext = new LoaderContext();

                                      loaderContext.allowLoadBytesCodeExecution = true;

                                      swfObj.loaderContext = loaderContext;


                                      swfObj.source = byteArray;



                            protected function swfObj_completeHandler(event:Event):void


                                      swfSoundBar = SWFLoader( as MovieClip;

                                      swfSoundBar.width = 32;

                                      swfSoundBar.height = 14;





                            protected function swfSoundBarShowHide():void


                                      if (swfSoundBar){

                                                if (mp3Player.isPlaying){



                                                } else {








    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points