Copy link to clipboard
Copied
Hi Nimisha1,
Can you please confirm if I can Load SWF from remote server with ActionScript in AIR based iOS ipa?
Any help with regards to this is appreciated.
Thanks,
Amandeep Singh
Hi Amandeep,
You can't load a swf from a remote server which contains ActionScript.
Thanks,
Nimisha
Copy link to clipboard
Copied
It's been a while, but I believe you can only load "dumb" assets from
remote servers - that is SWFs with no bytecode. Just having bytecode is
enough to invalidate them. To be honest, I'm not even sure a clean SWF
(with no ABC or actionscript bytecode in it) will pass Apple's
guidelines - it's ultimately up to them.
For certain I can tell you, the iOS AIR bundle doesn't have the
necessary plumbing (a jit) to run any bytecode from any SWF, even if you
were allowed to load it (or figured out how to get the SWF under Apple's
radar, which I wouldn't recommend even trying). You'll need to compile
all AS3 into the main application.
Kevin N.
Copy link to clipboard
Copied
Hi Amandeep,
You can't load a swf from a remote server which contains ActionScript.
Thanks,
Nimisha
Copy link to clipboard
Copied
Hi,
A new feature "External hosting of secondary swf files (iOS)" has been introduced with AIR 3.7 , please get more info @http://labsdownload.adobe.com/pub/labs/flashruntimes/shared/air3-7_flashplayer11-7_releasenotes.pdf
To use this feature please download AIR 3.7 build from http://labs.adobe.com/downloads/air.html.
Please share the feedback with us.
-Nimisha
Copy link to clipboard
Copied
I’m very excited about this feature since it addresses specifically the needs of my app.
However, I couldn’t make it work. The stripped assets file downloads fine, but when I try to access its content (ie. instantiate a symbol by its library name) the debugger states that the symbol doesn’t exist in the library, as well as that the custom class it’s linked to (via Base Class) doesn’t exist:
[SWF] SWFDownloadTest.swf - 944 bytes after decompression
ReferenceError: Error #1065: Variable CustomClass1 is not defined.
[SWF] /test/SWFDownloadTest/assets/assets.swf - 5,481 bytes after decompression
Symbol meepit doesn’t exist in the library or error loading the library
The last line it's a custom trace statement that pops up when:
ApplicationDomain.currentDomain.hasDefinition("meepit")
returns false.
I followed the example in the AIR 3.7 Release Notes regarding the LoaderContext, so that shouldn’t be the problem.
Anybody has had any luck in making this work?
Copy link to clipboard
Copied
If I'm reading correclty, this new feature only lets you downloaded swf files with no bytecode from an external source instead of including them in the original package. So "export for actionscript" might not work to get your art into the final swf that you publish (and later load). As a result you'll either have to create the swf in FlashBuilder (the best way) or you need to put your asset on the stage.
Look into your published swf and see if the art is even in there. Check the link report. Most likely it never got into the stripped swf file to begin with, so when you load that swf, the asset is not there.
Copy link to clipboard
Copied
I think/hope, that you're misunderstanding the new feature. The "export for action script" code will already be embedded in the app file. The new feature is all about hooking up the code-less swf with its original class files.
If there ends up being an issue where the host FLA's classes can't directly get at the library symbols of the loading code-less swf, perhaps the loading swf could have a public utility function that the host could call, that would hand back one of the library symbols from the swf being loaded.
Copy link to clipboard
Copied
Hei Nimisha,
any word on this? Is there a specific API to access the library symbols of the loaded library like Colin suggested?
How is the stripped code 'reconnected' to the library item?
Copy link to clipboard
Copied
To get at a symbol in a dynamically loaded swf you use getDefinitionByName("mysymbol").
As far as me misunderstanding it, I'm pretty sure I'm not. There is no way to run swfs in iOS that contain code. The code in a swf is ABC (actionscript byte code) which cannot be interpreted on iOS. Instead the iOS publisher translates as3 to objective-c and natively compiles for iOS. So a published swf will not run, regardless of this feature. Additionally if the suggestion is that you can publish a swf file natively for iOS with native code in it, and load that dynamically... well, first of all it doesn't work that way, and second of all, Apple would never allow that.
This feature is designed to allow you to put art inside a swf, load it dynamically, and display that art on iOS. All code must be compiled into your main game as native iOS code.
PS: if you are using getDefinitionByName and the file still appeasr to be missing, make sure you set a linkage identifer so it is included in the published swf. The special compiler flag used to strip the bytecode out will still do so, but presumably it will leave the symbol in the linkage list so it appears in the final output swf. If not, I would suggest there is a bug in this feature because the only other way to get it to exist in the output swf is to put it on the stage.
Copy link to clipboard
Copied
What code do you talk of? If it's the code that was in the swf, that the compiler strips out and stores in the main app file, why did it do that if the code can not be used when the swf is reloaded?
Copy link to clipboard
Copied
This new feature of AIR 3.7 ADT compiler is supposedly able to 'strip' the code from the to-be-loaded swf at compile time and add it to the main app file. This operation is done with the command-line ADT compiler. Once the to-be-loaded swf has been stripped of its code, it is uploaded on the server. Supposely this swf dosen't contain code anymore, so it can be downloaded by the app.
What is not clear is how the code gets 'reconnected' to the swf (metadata?) and if the usual
getDefinitionByName("mysymbol").
will work with this 'special' stripped swfs as well.
Please refer to the AIR 3.7 documentation for more info: http://labsdownload.adobe.com/pub/labs/flashruntimes/shared/air3-7_flashplayer11-7_releasenotes.pdf
Copy link to clipboard
Copied
Hi Everyone,
Our team is working on a blog which will give you more info about this feature and I hope it will resolve all your queries
Please have patience.We'll keep you posted.
Thanks,
Nimisha
Copy link to clipboard
Copied
HI Nimisha1
ReferenceError: Error #1065: Variable CustomClass1 is not defined.
This error is what causes it?We understand that it was wrong what?If not, how they deal with?
Copy link to clipboard
Copied
I have seen a similar situation when trying to load swcs by their class name, and setting that class name in XML. The problem was solved by mentioning the class name in my code, which ends up making the feature less useful, but it's not too bad a solution, and certainly would be no big deal if the new feature worked that way.
So, for example, if this gives you errors:
var myclass:MyClass = new MyClass();
try doing this:
var myclass:MyClass = new MyClass();
Just the mention of MyClass in the code is enough to let the compiler know what you're talking about.
Copy link to clipboard
Copied
Did that
I always do mention the library classes when I load them in from an external swf, otherwise hasDefinition() returns false.
However, in this case it didn't work.
I want to mention that CustomClass1 is the base class of my meepit symbol in the library, and it is 'mentioned' in the document class.
FYI you don't need to actually instantite it, it's enough to create a variable typed to it.
Copy link to clipboard
Copied
thanx Nimisha!
Copy link to clipboard
Copied
vikkiana wrote:
I’m very excited about this feature since it addresses specifically the needs of my app.
However, I couldn’t make it work. The stripped assets file downloads fine, but when I try to access its content (ie. instantiate a symbol by its library name) the debugger states that the symbol doesn’t exist in the library, as well as that the custom class it’s linked to (via Base Class) doesn’t exist:
[SWF] SWFDownloadTest.swf - 944 bytes after decompression
ReferenceError: Error #1065: Variable CustomClass1 is not defined.
[SWF] /test/SWFDownloadTest/assets/assets.swf - 5,481 bytes after decompression
Symbol meepit doesn’t exist in the library or error loading the library
The last line it's a custom trace statement that pops up when:
ApplicationDomain.currentDomain.hasDefinition("meepit")
returnsfalse.
I followed the example in the AIR 3.7 Release Notes regarding the LoaderContext, so that shouldn’t be the problem.
Anybody has had any luck in making this work?
HI brothers, we encountered the same problem, experiment numerous times! Finally, no way! ! !
Is this a BUG, or what? Your last been solved?
Copy link to clipboard
Copied
Hi MasterDaijunjie
Could you please share the sources of your sample application so that I could look into the issue.
Regards
Abhinav
Copy link to clipboard
Copied
awsome!
I'll got through the blog, and try to make it work with the new info.
The process i was using was some what intricated , requiring me to
1. compile the assets swf with Flash Pro and Flash Player 11.7 (swf-version=20) tot eh assets folder in the src folder of my FB project
3. compile the main swf in Flash Builder 4.7
4. move the swf fromt he bin-debug to the src folder and run the ADT command from there using the assets compiled in Flash
5. manually install the resulting ipa on the device, upload the resulting swfs in externalStrippedSWFs to the server
6. run the debug command in FB again, but when the debugger starts, launch the manually installed app from the USB cvonnected device instead of launching the one installed by FB
7. Debug is working, but then I would get that Library problem
I'm sure this process is not foolproof, and actually last time I try I could get the debugging part to work, while the time it gave me the Library error I ddin;t compile the assets swf with 11.7 but with 11.6 so that might have been the problem.
I'll share my project so you cna have a look at it
thanx!
Copy link to clipboard
Copied
HI Abhinav Dhandh
I pass up the test examples, please help me see, thank you!
The inside has rem.txt file, there are some instructions!
Copy link to clipboard
Copied
Hi MasterDaijunjie
I had a look at your sample project and below are some of my observations :
1. The text file for specifing the external SWF has not been added in the project.
2. The text file has not been mentioned within the <externalSwfs> tag within iPhone tag in the app-xml.
3. The loader is trying to load a SWF from the IP 127.0.0.1 which is the general IP of every machine. You will not be able to load a SWF using that generalized IP. Please host the SWF generated in the externalStrippedSWF to a server & pass that URL to the loader.
4. You will not be able to access the Stage object or any of the stage properties within the external SWF as the stage object retruns as null for the SWF loaded using Loader.
I would suggest you to make the above changes as well as have a look at this blog : http://blogs.adobe.com/airodynamics/2013/03/08/external-hosting-of-sec ondary-swfs-for-air-apps-on-i... and try to run the application again.
Please revert back if you are still facing any issues.
Regards
Abhinav
Copy link to clipboard
Copied
Hi Abhinav
can you please look at this simple test project and let me know if you have any clue on what is going on?
please look at the README.txt file for additional info
https://www.yousendit.com/download/UVJoSlIwdVUzMWsxWjhUQw
Thanx!!!
Viviana
Copy link to clipboard
Copied
any progress on this? I believe the file i attached will expire in 2 days, so I'm wondering if i need to resend it
thanx!
Viviana
Copy link to clipboard
Copied
Hi Viviana
I tried to look into this issue but the file is unavailable at the location. Could you please re-upload the file and mention the new link ?
Regards
Abhinav
Copy link to clipboard
Copied
yes the file expires after a week on YouSendit
here's the file again, thanx fro looking at it