We have a requirement with an AIR application that loads the generated generated swf, which inturn loads the generated swf flash using SWFLoader. This does not work as desired. This gives the following error: SecurityError: Error # 3226: Unable to import SWF file if LoaderContext.allowCodeImport is false.
This is our AIR application.
<?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp()"> <mx:Script> <![CDATA[ import mx.controls.SWFLoader; [Embed(source="FlexLoadingFlash.swf")] public var flexMovie:Class; private function initApp():void { // First convert the Swf into MovieClip var movieclip:MovieClip = new flexMovie(); // get the byteArray from movieClip var byteArray:ByteArray = movieclip.movieClipData; var swfLoader:SWFLoader = new SWFLoader(); // load bytearray into swfLoader swfLoader.source = byteArray; swfLoader.maintainAspectRatio = false; swfLoader.percentHeight = vbox.height; swfLoader.percentWidth = vbox.width; swfLoader.invalidateDisplayList(); swfLoader.invalidateSize(); // now add the swfloader into container vbox.addChild(swfLoader); } ]]> </mx:Script> <mx:VBox id="vbox" width="100%" height="100%" verticalCenter="0" horizontalCenter="0" cacheAsBitmap="true" > </mx:VBox> </mx:WindowedApplication>
Please let me know how we can fix this problem.
source share