Publishing Print2Flash Documents embedding them in Flex applications
Post Reply
Posts: 4
Joined: Wed Jan 08, 2014 5:39 am


Post by loicremy » Fri Jan 10, 2014 12:01 pm

I again,

I'm working on an application for MAC/WINDOWS/ANDROID platform.

The goal of the app is to display many documents (PDF converted in P2F) in a frame inside application screen.

User can choice in differents documents to see. The documents files are downloaded in cryped(AES) mode.

At user demand, the crypted file is decrypted on the fly and written in the AIR application directory . After that , I use the 'source' property of P2F member and the document is visible.

On MAC or WINDOWS application , everything runs well.

My problem appear with ANDROID AIR's security management.

1) I don't know how to load a swf file elsewhere from application directory to P2F (sandbox violation error).
2) I don't know how to write/copy a file in the application directory (readonly directory).

With theses 2 points, I'm stuck !!

Thank you in advance for ideas or advices !


PS : For now, I have decided to not include IOS in this development, due to swf loading limitation...

Posts: 267
Joined: Sat Dec 15, 2007 4:48 pm

Re: FLEX Mobile ANDROID AIR Sandbox

Post by staff » Mon Jan 13, 2014 5:24 am

1. Try to load a document not from a file in your application directory but from a ByteArray object. This way you will circumvent sandbox restrictions:

Code: Select all

			private function loadSwfApplication():void {
				var loader:URLLoader=new URLLoader();				
				loader.addEventListener(Event.COMPLETE, onSWFLoaded);
				loader.load(new URLRequest("http://mysite.com/sample.swf"));
			private function onSWFLoaded(e:Event):void {
				var loader:URLLoader=URLLoader(e.target);
				loader.removeEventListener(Event.COMPLETE, onSWFLoaded);
				var context:LoaderContext=new LoaderContext();
				doc.loaderContext = context;
Here doc refers to a Print2FlashDoc3 Flex component instance. This way you also won't need to save documents to files.

2. The application directory is read-only by design (see this help topic: http://help.adobe.com/en_US/FlashPlatfo ... nDirectory). You should use another directory, e.g. application's private storage directory which reference you can get with applicationStorageDirectory property of File class.

Post Reply