I'm looking to load external .swfs that have graphical assets in them which are all 'exported for actionscript', and instantiate those assets in a .swf packaged for iOS.
I'm using the adt command line packager to create the .ipa file. I'm including the .swf files while packaging. The .swf files seem to load correctly, and give me no errors, but when the Loader for each .swf's bytesLoaded equals bytesTotal the content property remains null.
The program works perfectly when I package the .ipa using the -target ipa-test-interpreter flag, but not when I use the -target ipa-test.
I'm assuming the problem is that iOS doesn't allow Flex developers to load external .swf files that contain actionscript, and the 'export for actionscript' in the external .swf files counts as actionscript for the purposes of Apple's security policies. I'm looking for confirmation as to whether or not this is the problem.
When using adt to package .ipa files, does iOS block external .swf files that have library assets that have been 'exported for actionscript'?
Similar discussion:
http://forums.adobe.com/message/3728665
Thanks!
J
This IS possible.
However there are some limitations.
You cannot use AS3 in the swf's if they are not loaded from the app
source.
And you have to run all the code in the same ApplicationDomain, which
can cause weird errors with duplicate class names and such.
This is a official article from Adobe about how to do it:
http://blogs.adobe.com/airodynamics/2012/11/09/packaging-and-loading-multiple-swfs-in-air-apps-on-ios/
I highly recommend using swc's as suggested by others tho, since it simplifies the process in many cases.
You are not allowed to load external swf files on apple devices when you are creating a app.
the solution for you would be: put all your graphics and everything else into swc file and then compile the one ipa file.
Related
My application needs to load external swfs with ABC. I checked that this feature is available in AIR 3.7 and later. I managed to get the new SDK - 3.8 with the latest version of FD (4.4.3).
Now I am following this link: http://blogs.adobe.com/airodynamics/2013/03/08/external-hosting-of-secondary-swfs-for-air-apps-on-ios/
According to this post, "During IPA packaging, ADT extracts the ABC code from all child SWFs, adds it to the final executable and generates stripped SWFs in the “externalStrippedSwfs” folder created in the current working directory. The directory structure within the “externalStrippedSwfs” folder remains the same as specified within the text file. The generated stripped SWF’s should then be externally hosted on a web server of developer’s choice."
However, firstly, I could not find any such folder called "externalStrippedSwfs".
Secondly, even if this works, this means that everytime I have a new external swf to load, I will have to get it stripped off the code, put it in the main swf, and then upload the stripped swf (with assets). So everytime I do this, I need to "reupload" my app to Apple.
Are these assumptions right? My app architecture will need to be modified accordingly.
Yes, your assumptions are correct: You can't load an external .swf containing AS3 and have the app execute the byte code.
If we ignore the fact that it would most likely not be approved by Apple it can't technically work. The reason is because the Adobe AIR app doesn't contain a virtual machine capable of interpreting the byte code in the .swf:
When you build your application for iOS, there is no interpreted code
and no runtime in your final binary. Your application is truly a
native iOS app.
Source: http://www.adobe.com/devnet/logged_in/abansod_iphone.html.
You can do it! :) You just need to upgrade to AIR SDK3.8+ and follow the painful process.
The only limitation is that each external swif that you will be loading at run time, must be stripped by your ADT.
But you are right: you will need to update your app everytime your external content needs to be updated.
"externalStrippedSwfs" is arbitrary (name it as you wish I believe), you have to create that folder in your bin and run the command line from there.
Looks like Apple is not ready to lose the leash yet...
I am looking to integrate opening/viewing CBZ/CBR file in iOS6 (A simple viewer like UIWebView that reads PDF file will be fine as well).
Are are there any libraries (Commercial or free) that are available for opening these file types?
Thanks in Advance
CBR files are renamed .rar files and CBZ files are renamed .zip files, so you can look for a solution from there. I've never come across a library file specifically targeted for them, but that might not exclude the possibility of one existing, but as they're just standard compression files renamed to make them more portable between CBR/CBZ readers you should be okay with standard decompression libraries.
The library will spit out a number of image files when the decompression has finished, if you extract one with a standard decompression tool you'll see how they'll be presented.
My iOS app uses data that is packaged by theme into theme bundles. For example theme_math.bundle, theme_history.bundle, etc. A theme bundle contains a .sqlite file and images. The idea would be that those bundles can be downloaded when necessary by the app (theme_x.bundle.zip).
There are hundreds of themes that are stored in a database, and I'd like to automate the process of creating a bundle for every theme with the appropriate name.
Is this approach fine to deliver application content to an iOS app?
If using bundles is fine, how can I automate that process?
This would appear to be a fine idea. You can automate this by creating a shell program file, or use some other scripting language (python, ruby, etc).
A bundle is really just a folder that gets special treatment. It can have an icon when viewed in the Finder, etc. So your high level program will create a bundle (mkdir Name.bundle), then copy whatever resources you want into that directory - Name.bundle. When you're done zip the bundle up, and put it where it can be downloaded.
Bundles often have a plist inside with special flags set (as an executable on OSX does), but don't think you need this.
Its possible that you may need to set some special bits on the bundle for iOS to recognize it - I really don't know for sure. If so see this thread.
One of my customers has many SWF and he would like to port them to iPad. However, he only has the SWFs, not the FLAs.
I 'd like to know if it is a way to run the SWFs inside an Air for iOS app. I´ve read you can import then with a Loader, but they will only run as an animation ignoring all the code inside them.
Thanks, any help is welcome!
[UPDATE] I´ve read something about using SWC, but still not sure if they will run the code.
Update, Oct 2012:
In Adobe AIR 3.5, adl is introducing a feature called "multiple SWF support" that allows the use of Loaders to load SWFs delivered in the .ipa (local files, not from servers) to have code in them. The adl compiler AOT compiles SWFs that are included in the .ipa, allowing them to be loaded and work under iOS.
AIR 3.5 is currently in beta at the time of this writing, available on the adobe labs site:
AIR 3.5 on Adobe labs website
AIR 3.5 release notes
Note that this feature requires -swf-version=18 or greater of the root SWF (not necessarily the assets being loaded) and AIR namespace ending in 3.5 in the application xml file.
Older answer:
The reason external SWFs with code in the doesn't work is that Air's ADT compiler cross-compiles your root SWF (and only your root swf) into objective-c code consumable by an iOS device. Both [embedded] SWFs and those included in the .ipa (prior to AIR 3.5) are not cross-compiled.
I created a workaround for this problem for embedded assets:
[Embed(source="gameLevel.swf")]
private var gameLevel:Class;
...
addChild(new gameLevel());
In this scenario, if gameLevel.swf has code in it, it typically wouldn't work in iOS, because new gameLevel() would create a Loader and interpret SWF bytecode. But, if you first run the above SWF through my tool called SWFMerge, it will take your embedded SWF and merge it into your root SWF. The result is that ADT will compile your embedded code into objective-C, it will work on iOS, and note: new gameLevel() now results in an instance of your asset - NOT a Loader.
The SWFMerge tool is here:
http://www.onetacoshort.com/temp/SWFMerge_alpha.swf
LMK if this workaround works for you or if you have trouble. Cheers!
-Jeff
Yes you can,
Apple does not allow your application to download SWF's using Loader from the internet but you ARE allowed to embed and include them inside of your .ipa
To do this you would use the embed tag
[Embed("myswf.swf", mimeType="application/octet-stream")] private var mySwf:Class;
You can then use
swf = new mySwf();
swf.addEventListener(Event.COMPLETE, completeHandler);
And interact with the swf inside that complete handler
I wanted to add to this that it is possible to compile a SWF that is not able to be loaded
For the record, I am an iOS developer, and have absolutely no background on how flash programs work/run/developed...etc.
I have a Flash program that is mostly a collection of SWF files. It does, however, contain some Actionscript, Javascript and other integrated languages here and there..
I would like to convert this project/program to an iPad application. Is it possible?
What I got from searching the net:
Converting Actionscript to LUA script
Using Corona SDK to port the program to iOS
Starting a new iOS project in flash and moving the code somehow..
Other tedious ways which are not feasible at all....
The above mostly handles the actionscript part .. what about the SWF files?
As a last resort, one could at least guide me to a developer/company who can handle this task, or provide training to accomplish this.
Additional details
The flash program app file is already generated, and the program works on desktops perfectly. The program is somehow an interactive e-book, and it has some linked XML files to index the table of contents and other sections...
I've not done a lot of iOS development yet, but here are my experiences so far; maybe they help you form a better idea.
Only the main SWF can contain actionscript code.
I'm not sure how far assets (Sounds, Fonts, MovieClips) in other SWFs which are exported for actionscript are accessible to the main SWF.
It is possible to include additional XML files (and other types) which can be loaded via the normal loader classes.
Recently I came acrosshe tool which allows you to convert and play swf to some cross-platform frameworks. Now they support only Cocos2d-x, Unity 3d and Starling. But I saw the logo of Corona on their homepage. You can go there and ask them. I don't remember the right name of the site, but tool is called GAF converter