Adobe Flex Air Android App

Publishing Print2Flash Documents embedding them in Flex applications
Post Reply
dmerck
Posts:5
Joined:Mon Jul 19, 2010 4:31 pm
Adobe Flex Air Android App

Post by dmerck » Thu Nov 25, 2010 12:10 am

I am running an Adobe Flex Air Android App and am trying to load an Print2Flash swf from a web server. I am getting a sandbox security error. Should I be downloading the file to a local location first or is their a way to give this action permission. I was able to do this with flash without issue by adding a trusted location. Any ideas would be appreciated.

Thanks,
-D

dmerck
Posts:5
Joined:Mon Jul 19, 2010 4:31 pm

Re: Adobe Flex Air Android App

Post by dmerck » Fri Nov 26, 2010 10:26 am

I have explored a few things. I have the example in the SDK working in a Flex 4.1 App using Flash Develop. I have the example in the SDK working in a Flex 4.1 AIR App using Flash Develop. I have not been able to get the Flex Sample to load/display the document using Flash Builder Burrito using Flex 4.5.

dmerck
Posts:5
Joined:Mon Jul 19, 2010 4:31 pm

Re: Adobe Flex Air Android App

Post by dmerck » Fri Nov 26, 2010 10:32 am

I compared APILC.domain in Print2Flash/Print2FlashDoc.mxml

In FlashDevelop using Flex 4.1 AIR
APILC.domain=app#Print2FlashFlexAirTest

In FlashBuilder Burrito using Flex 4.5 Mobile AIR
APILC.domain=null

I suspect this may be the result of it not connecting/loading/displaying the document in a View.

Anyone have any thoughts?

-D

dmerck
Posts:5
Joined:Mon Jul 19, 2010 4:31 pm

Re: Adobe Flex Air Android App

Post by dmerck » Fri Nov 26, 2010 11:30 am

From
http://help.adobe.com/en_US/FlashPlatfo ... lter_air=2

AIR profile support: This feature is supported on all desktop operating systems and on all AIR for TV devices, but is not supported on mobile devices. You can test for support at run time using the LocalConnection.isSupported property. See AIR Profile Support for more information regarding API support across multiple profiles.

<s:MobileApplication>

Is there a solution for this?

mdabernat
Posts:3
Joined:Tue Apr 30, 2013 2:56 am

Re: Adobe Flex Air Android App

Post by mdabernat » Tue Apr 30, 2013 7:43 am

Hello,

I'm working on an application cross-platform (Web-desktop-tablet).
This application load a print2flash file. This work perfectly on web but i have an error on android.

I modified the class Print2FlashDoc3 to resolve secutiy problem

Code: Select all

package utils {
	import flash.display.*;
	import flash.events.*;
	import flash.net.*;
	import flash.utils.*;
	import flash.system.*;

	public class Print2FlashDoc3 extends Loader {
		private var contentwidth:Number, contentheight:Number;
		private var loadTimer:Timer;
		private var urlLoader:URLLoader;
		public static const ONLOADEVENT:String="onLoaded";
		public static const IO_ERROR:String="ioError";

		public function Print2FlashDoc3(url:String,x:Number,y:Number,width:Number,height:Number,parent:DisplayObjectContainer)
		{
			loadTimer=new Timer(10);
			loadTimer.addEventListener("timer", checkLoaded);
			this.x=x;
			this.y=y;
			contentwidth=width;
			contentheight=height;
			
			contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
			
			loadDoc(url);
			parent.addChild(this);
		}

		private function ioErrorHandler(e:IOErrorEvent):void
		{
			loadTimer.stop();
			dispatchEvent(new Event(IO_ERROR));
		}
		
		public function loadDoc(url:String):void {
			visible=false;
			/*try {
				Security.allowDomain("*");
				load(new URLRequest(url));
				loadTimer.start();
			} catch (error:SecurityError) {*/
				urlLoader = new URLLoader();
				urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
				urlLoader.addEventListener(Event.COMPLETE, completeHandler);
				urlLoader.load(new URLRequest(url));
				 
			//};
		}
		
		private function completeHandler(event:Event):void
		{
			try {
				var data:* = event.target.data;
				if (data is ByteArray) {
					var context:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
					context.allowCodeImport = true;
					loadBytes(data as ByteArray,context);
					loadTimer.start();
				}
				
				urlLoader = null;
					
			} catch (error:Error) {
				trace(event.toString());
				trace(error.toString());
			}
		}
		
	    public function checkLoaded(event:TimerEvent):void {
			var doc:MovieClip=getDoc();
			if (doc && doc.DocArea) {
				trace('doc',doc,'doc.DocArea',doc.DocArea);
				doc.init(contentwidth,contentheight);
				trace('here');
				// lors de la suppression du document, il faut supprimer l'écouteur d'evenement
				// sur 'FullScreenEvent.FULL_SCREEN' sur le stage  ajouté par print2flash
				// sinon on à une erreur lorsqu'on essaye de passer en plein écran a partir du moment
				// où on a ouvert plus d'un document....
				stage.removeEventListener(FullScreenEvent.FULL_SCREEN, doc.OnFullScreen);
				loadTimer.stop();
				visible=true;
				dispatchEvent(new Event(ONLOADEVENT));
			}
        }
		
		public function getDoc():MovieClip {
			return content as MovieClip;
		}
	
	}
}
but now, i have an error #1009 at the end of loading the file :

Code: Select all

Exception fault: TypeError: Error #1009: Cannot access a property or method of a null object reference.
	at print2flash_fla::MainTimeline/frame2()
and :

Code: Select all

Exception fault: TypeError: Error #1009: Cannot access a property or method of a null object reference.
	at print2flash_fla::MainTimeline/SetAccessiblePages()
	at print2flash_fla::MainTimeline/SetCurrentPage()
	at print2flash_fla::MainTimeline/ZoomTo()
	at print2flash_fla::MainTimeline/SetBaseParameters()
	at print2flash_fla::MainTimeline/setSize()
	at print2flash_fla::MainTimeline/init()
	at utils::Print2FlashDoc3/checkLoaded()[C:\Users\dabernatm\workspace\LMS_NAVIGATEUR_LIB_V3\src\utils\Print2FlashDoc3.as:76]
	at flash.utils::Timer/_timerDispatch()
	at flash.utils::Timer/tick()
I think the first error is the origin of the problem.

If someone have an idea.

Mickaël

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

Re: Adobe Flex Air Android App

Post by staff » Tue Apr 30, 2013 10:45 am

Can you open this document on Android directly in the browser without your application?

mdabernat
Posts:3
Joined:Tue Apr 30, 2013 2:56 am

Re: Adobe Flex Air Android App

Post by mdabernat » Thu May 02, 2013 3:33 am

I tested on 3 different version of android: 3.2/4.0.4/4.2.2:

in a web browser the file is displayed on version 3.2.
in my app, all the versions return the same error

Code: Select all

Exception fault: TypeError: Error #1009: Cannot access a property or method of a null object reference.
	at print2flash_fla::MainTimeline/frame2()

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

Re: Adobe Flex Air Android App

Post by staff » Mon May 20, 2013 9:26 am

Is it an AIR application you are developing? If so, could you send us an application sample which demonstrates this problem to our support e-mail?

mdabernat
Posts:3
Joined:Tue Apr 30, 2013 2:56 am

Re: Adobe Flex Air Android App

Post by mdabernat » Tue Oct 22, 2013 8:10 am

Hello,

I worked on other project since last post.
I 'm followed the procedure explain on post 'viewtopic.php?f=11&t=4761#p5943' to recompile my pdf files and now it's work fine

thank you for your involvement

Mickael

Post Reply