2 Replies Latest reply on Dec 2, 2009 4:50 PM by danwize

    A swf loader bug?

    danwize Level 1

      It looks like I may have found a bug in the swf loader.  Before I submit this problem I want to make sure there is not something I'm missing in my code. I wrote this class to load a tutorial when the user first launches a sub application in a project I'm working on. This is a simplified version of the class that exemplifies the problem.  The same methods I use to launch the swf from within an mxml work just fine, but when I externalize the process in this class, I can hear the tutorial, but I get no visual.  Is this a bug or am I missing something?


      Here is the tutorial launcher class:

      package proj.fuego.utils
           import flash.events.Event;
           import mx.controls.SWFLoader;
           import mx.flash.UIMovieClip;
           public class TutPlayerSimple extends UIMovieClip
                private var gutLoader:SWFLoader; 
                public function TutPlayerSimple(fullTutorialPath:String)
                   gutLoader = new SWFLoader();
                   gutLoader.addEventListener(Event.COMPLETE, addToStage);
                   gutLoader.load(fullTutorialPath + ".swf");
                private function addToStage(evt:Event):void


      This is my mxml:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="1024" minHeight="768" applicationComplete="application1_applicationCompleteHandler(event)">
                   import mx.controls.SWFLoader;
                   import mx.events.FlexEvent;
                   import proj.fuego.utils.TutPlayerSimple;
                   private var fullTutorialPath:String = "ll_tut";
                   private var tutPlayer:TutPlayerSimple;
                   protected function application1_applicationCompleteHandler(event:FlexEvent):void
                        // TODO Auto-generated method stub
                        var context:LoaderContext = new LoaderContext();
                        tutPlayer = new TutPlayerSimple(fullTutorialPath);
                        //context.checkPolicyFile = true;
                        //gutLoader.loaderContext = context;
                        trace("Loading Tut:", fullTutorialPath + ".swf");


        • 1. Re: A swf loader bug?
          Flex harUI Adobe Employee

          That didn't look right.  You'll need to addChild SWFLoader.  Not sure what will happen if you just try to add its content.  There might also be issues putting Flex components inside a UIMovieCip.


          Alex Harui

          Flex SDK Developer

          Adobe Systems Inc.

          Blog: http://blogs.adobe.com/aharui

          1 person found this helpful
          • 2. Re: A swf loader bug?
            danwize Level 1

            I have successfully added a SWFLoader's content in the past.  The problem may have been putting Flex componenets inside a UIMovieClip.  I tried extending MovieClip, Sprite, and some other classes with similar results.  I realized it was silly to try to do it that way anyway.  Not sure what I was thinking.  I've now extended SWFLoader, to handle the database calls etc. that I needed.