5 Replies Latest reply on Aug 26, 2009 6:37 PM by Flex harUI

    trouble using loader with flex compiled swfs


      I've been recently running into an on going problem with loading swfs files with the loader class. The loader class seems to be able to load static images (jpegs, pngs, gifs, etc.) and swfs. But for some reason, the loader will not load swf files that have been compiled from flex (I've also discovered that the same problem exists when compiling document class AS3 files in flash). I've tried to look into the problem using traces, but they come back with nothing, not even a value of null. I have been reading that flex compiled swf have two frame, first one for the preloader, and the second for the content. But any more info beyond that I can't seem to find.


      I'm really not sure how to go any further to solve this problem.


      To replicate the problem, create a actionscript project within flex, add content to it and compile it with release-build.

      Next create another actionscript project (named loaderTest) within flex and add the following code, which is normally used to load swf and images externally, and copy the compiled swf from flex into the src folder of this actionscript project, and replace the name "Fountain.swf" with the name of the swf. Also, just for extra messures of testing, replace "Fountain.swf" with a swf compiled from flash (without using a document class script).


      package {
          import flash.display.Loader;

          import flash.events.Event;
          import flash.net.URLRequest;


          public class loaderTest extends Sprite
              private var loader:Loader;


              public function loaderTest()
              private function init():void

                  loader = new Loader();

                  loader.load(new URLRequest("Fountain.swf"));
                  loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loader_complete);
              private function loader_complete(e:Event):void





      Thank you in advance.