3 Replies Latest reply on Nov 20, 2012 8:50 AM by dlldlldlldll

    SWFLoader @Embed isse


      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.
        • 1. Re: SWFLoader @Embed isse
          GoosePoop Level 1
          Does anyone have any idea on this?
          • 2. Re: SWFLoader @Embed isse
            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.
            • 3. Re: SWFLoader @Embed isse

                  <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(event.target).content as MovieClip;

                                                swfSoundBar.width = 32;

                                                swfSoundBar.height = 14;





                                      protected function swfSoundBarShowHide():void


                                                if (swfSoundBar){

                                                          if (mp3Player.isPlaying){



                                                          } else {