Copy link to clipboard
Copied
Dear All,
I'm working on adobe air project for iPad app. I'm loading multiple external swf files which will download from the server in runtime. Downloaded files has actionscript and it doesn't work in the app. I have read some forums and it says that iOS doesn't Allowactionscript Byte Code (ABC) from the downloaded external swf. And that forums seems very old. Still the same status continues or Is there any solution found in latest for that? Please help me.
Thanks in advance,
Guru
Copy link to clipboard
Copied
As far as I know nothing has changed with regards to actionscript in loaded swf files when using portable devices. The code in them is rendered useless when loaded into another file. I believe you need to try to target the loaded file and control its inner workings thru the main file that did the loading.
Copy link to clipboard
Copied
Thank you for your reply and valuable idea Ned Murphy.
I will try in that way.
Copy link to clipboard
Copied
There was a solution added four years ago, in AIR 3.7 (we're on AIR 25 now). I think it should still work. The idea is that when you compile the iOS app you give it a set of swfs and a manifest file, to say where the swfs are going to be located.
It's complicated enough that I've never tried it out, but the technique is described in the AIR 3.7 release notes:
http://labsdownload.adobe.com/pub/labs/flashruntimes/shared/air3-7_flashplayer11-7_releasenotes.pdf
Copy link to clipboard
Copied
Excellent Colin Holgate . Thanks a lot. I will try this steps and let you know the result.
Copy link to clipboard
Copied
Hi Colin Holgate,
I read that notes and I can't understand what is stripped SWF. Also how to use command line ADT packaging?. Is there any video tutorial to explain more regarding this?
In my app, I download the external swf from the server and placed in "File.applicationStorageDirectory.resolvePath". Once its downloaded I run that file(s) from that path and its working fine but the script part seems ignored and it is keep on looping. Please help.
Thanks in advance
Guru
Copy link to clipboard
Copied
Read the section on external hosting of swf files. In there is tells you how to compile the app (an example adt line is given) along with a text file that lists the swfs. The compiler then creates the stripped swfs for you, and it's those ones that you upload to the server.
Copy link to clipboard
Copied
Hi Colin Holgate,
Thanks for your quick reply.
Sorry for the late reply from me. I was not in office. I have given as instructed in that notes but no result. Might be I misunderstand or missed something. I will try it again and let you know soon the status.
Thanks,
Guru
Copy link to clipboard
Copied
I think that it is difficult to follow too. When you succeed you will be able to tell the rest of us how you did it!
Copy link to clipboard
Copied
Sure Colin
Copy link to clipboard
Copied
Hi Colin,
I got the below error when I compile app. What does this mean? Any idea?
Thanks,
Guru
Copy link to clipboard
Copied
I thought the stripped swfs would be put into the externalStrippedSwfs folder. Why is it going deeply into sub folders?
Does the externalStrippedSwfs folder exist?
Copy link to clipboard
Copied
Hi Colin,
I'm still working on that. I hope soon will get good result.
Copy link to clipboard
Copied
Hi Colin,
Good news!!
I got positive result by use of the same code as mentioned in that notes and its working fine. Thanks a lot to you Colin.
Only its not working in my system and throw the same error as mentioned in the early post. But, its working in some other system. Sometime the same error appears in that system too. Mostly its working with no error. I don't know whats wrong in my system and java.
The below steps I did to make it works. Create and Place your files as mentioned below.
5. Copy your externalStrippedSwf folder into server and test it with the below code.
Code to load externalStrippedSwf is
package com.myclasses {
import flash.events.MouseEvent;
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.system.LoaderContext;
import flash.system.ApplicationDomain;
public class Main extends MovieClip{
private var externalLoader:Loader;
private var url:String= "http://...com/mySWFs/file1.swf";
private var urlRequest:URLRequest = new URLRequest(url);
private var ldrContext:LoaderContext;
public function Main() {
// constructor code
init();
}
private function init()
{
load_mc.buttonMode = true;
load_mc.mouseChildren = false
load_mc.addEventListener(MouseEvent.CLICK, loadFile);
trace("test 1")
}
private function loadFile(e:MouseEvent)
{
externalLoader = new Loader();
externalLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler);
ldrContext=new LoaderContext(false,ApplicationDomain.currentDomain,null);
externalLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,errorHandler);
try
{
externalLoader.load(urlRequest, ldrContext);
}
catch(e:Error)
{
trace("Error ID : "+e.errorID+"\nError Message : "+e.message);
}
}
private function completeHandler(e:Event):void
{
display_mc.addChild(externalLoader);
}
private function errorHandler(e:IOErrorEvent):void
{
trace("In IO ErrorEvent Handler");
}
}
}
Copy link to clipboard
Copied
Thanks for reporting back the steps.
Copy link to clipboard
Copied
You Welcome Colin. I was almost in the stage of give up this task. But today we achieved because of your hopeful comments. Thank you very much.
One more help. You know how to load external .mp4 and make it works? This is not working in iPad and I'm trying make it success. If you have any idea please share with me.
I have posted in the forum with the title "Air not loading external mp4 video in iPad".
Copy link to clipboard
Copied
You should use StageVideo for playing back MP4. It isn't too hard.
Copy link to clipboard
Copied
Hi RajaguruV,
It's not an answer, but it may help others too. I want to know if this method works on AIR 25 ( 22 / 23 ), and also if it works on every iOS devices.
I`m working on an Android / iOS application. I need a reliable solution for uploading .swf files with AS3 codes inside them that can interact with my main application. Currently, I`m using windows and I`m not familiar with how to package my app for iOS (basically for I don`t have a mac system yet!) . Is this method really working on iOS and are all AS3 codes inside loaded swf file working fine?
I need to load swf files on the device from my server and load them when needed. Mostly they are some galleries for showing some pictures. But the loaded swf needs to be able to interact with main app classes so that I can pass variables to it.
Thanks you so much
Your question and reports are so helpful.
Copy link to clipboard
Copied
Hi Raja,
I'm gettting below issue could you help me!
Unknown error.
unexpected failure: externalStrippedSwfs/multiswf/game1.swf (No such file or directory)
java.io.FileNotFoundException: externalStrippedSwfs/multiswf/game1.swf (No such file or directory)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
at com.adobe.ucf.Utils.copyTo(Utils.java:42)
at com.adobe.air.ipa.IPAOutputStream.copyExternalSwfToFolder(IPAOutputStream.java:1476)
at com.adobe.air.ipa.IPAOutputStream.finalizeSig(IPAOutputStream.java:1374)
at com.adobe.air.ApplicationPackager.createPackage(ApplicationPackager.java:103)
at com.adobe.air.ipa.IPAPackager.createPackage(IPAPackager.java:290)
at com.adobe.air.ADT.parseArgsAndGo(ADT.java:656)
at com.adobe.air.ADT.run(ADT.java:450)
at com.adobe.air.ADT.main(ADT.java:500)
Copy link to clipboard
Copied
Hi kumsh,
I'm also getting the similar issues in my system. But its working in some other system without any such issue. Please try it in any other system if you have. Sorry, I don't know exactly what is the issue in my proj too. I don't know java .
Copy link to clipboard
Copied
Thank you for your reply i will check it and update
Copy link to clipboard
Copied
Hi Sasan,
Good Morning. Have a Nice day!
Yes its working in all iOS devices. For Android device, no need to do the steps for strip swf. It will work as in the windows PC. Mac need only when you upload the file to App store. To check in your device, you need to develop your main application in Adobe Air, and need to apply setting in that. It will give you .ipa file. And you can connect your apple device into you PC and can install the package through iTune (If you don't have iTune in your PC, please install). Now you can see the result.
Hope it will help you.
Thanks,
Guru
Copy link to clipboard
Copied
Thank you so much RajaguruV , appreciate it
I didn`t know if I can try my AIR app via windows on iOS.
have a nice time
Copy link to clipboard
Copied
You welcome Sasan
Copy link to clipboard
Copied
Hi Rajaguru
Your question is helpful for me. But unfortunately I couldn't do it in Android. I need help. When I try to fetch swf from external URL, I'm getting this following error.
SecurityError: Error #3205: Only application-sandbox content can access this feature.
at Mainclass()
Do you know solution for this. Or I need example to do it for Android.
Thanks in Advance.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now