Search code examples
iosactionscript-3flashapache-flexair

Adobe AIR 3.8 Flash Builder 4.6 for iOS - Secondary SWF with Actionscript works on fast packaging but fails on Releast Build


I have a simple Flex Mobile project that just allows user to swap between 2 different .swf games. I load the .swf with the following code:

private function loadFile(f:String):void{   
            var _urlRequest:URLRequest = new URLRequest(f);
            var _loader:Loader = new Loader();
            var _lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
            _loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onSWFLoaded);
            _loader.load(_urlRequest, _lc);
            txt.text="loading";
            // add loader to container
            grp.addChild(_loader);
        }
        private function onSWFLoaded(e:Event):void {
            // status text to show it loaded
            txt.text="loaded!";
        }

Then on user button click I just do:

 loadFile("file1.swf");

file1.swf is packaged into the build. I run this on debug under fast packaging on my iPod Touch and everything works like a charm, but when I do an export release build, my status text still says "loaded", but the swf loads very strangely - as if there's some code that is failing to run properly.

Since it works on fast packaging with no issue, what would be the difference between release build and fast build that can cause code in child swfs to fail?

Any ideas would be appreciated.

Thanks.


Solution

  • Solved the issues based on comments from here: http://forums.adobe.com/message/5398137

    Using var file:File = File.applicationDirectory.resolvePath("file1.swf"); and adding the Flex Compiler option "swf-version=19" fixed the issue for me. Not sure which one of the two changes fixed it but it all works now.