Hi,

We have requirement with the AIR application which loads the flex generated
swf which loads the flash generated swf using SWFLoader. This is not working
as desired. This gives the following error:
SecurityError: Error #3226: Cannot import a SWF file when
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 can we fix this issue.

 --
Thanks,
Ganga

"Start by doing what is necessary, then what is possible, and suddenly
you are doing the impossible."

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to