AS3 Packager for iPhone: Can the app download content? - iphone

I am in the stages of designing a magazine concept for a client, taking the printed version and adding animated and interactive content, it seems Flash would be the obvious choice, and something which I am reasonably skilled with.
If I build the Magazine app with Flash, will the app be able to download additional issues? if so please point to any resources on the subject if possible.

You can use the Packager for iPhone to get Flash content on an iOS device. However, you can't download compiled Flash files (.swf) to the iOS device and execute them after the app has been installed.
From the developer documentation:
Loader
In an iPhone application, you cannot
use the Loader.load() method. However,
you cannot run any ActionScript code
in SWF content loaded with the
Loader.load() method. However, you can
use assets in the SWF file (such as
movie clips, images, fonts, and sounds
in the library). You can also use the
Loader.load() method to load image
files
If you would like to use InDesign and some of the other tools that Adobe Makes, you can consider the so called Digital Publishing Suite which is a toolset that was used to make some of the iPad magazines such as Wired or Martha Stewart Living.

Related

How to embed flash files in iOS app

I have some flash files and i need to integrate those files in iPad app. i searched lot but everyone's answer is
- iOS will not support flash.
- even if you integrate flash files app store will not accept.
But my app is not for app store this is an enterprise app. Instead of integrating flash files we can do all the animation in our objective-c itself. But client is demanding to integrate flash files in iPad app. Is there any alternate solution. Please guide me.
Sure you can run Flash apps on iOS, you just have to build them using AIR:
Adobe AIR is a cross-platform runtime that enables you to use your
existing Flash/ActionScript or HTML/JavaScript development skills and
tools to build and deploy applications, games, and videos outside the
browser and on mobile devices.
Here is the specific resources page on how to build Flash ActionScript 3 apps targeting any iOS device.
The beauty of AIR is that if the code of your app is well organized, you can reuse most of it for any build being it for Android, iOS, Blackberry, or even a desktop app (windows and macosx) or the web.
Hybrid way:
Flash to html5 conversion then open HTML document using webview
Google swiffy:
Swf to HTML 5
Note:
maximum of 1 mb only be converted at present
Link:
click here
Adobe wallaby:
Fla to HTML 5
Note:
At present cs5 only supported.the lower versions have to be resaved in cs5 to convert.
Link:
click here
Native way:
Adobe air:
One could run actioscript flash content directly in ios devices.
Note:
At present you could make stand alone ios apps only you can't integrate with existing app.
Link:
click here
It is a detour only, but you could install the Photon browser and call it from your app.

From SWF to AIR to iOS application

I have existing Flash application, which compiles to SWF and runs on web. I'm looking at converting that application to work on mobile devices such as iPhone/iPad.
I see that there is now a way to publish Adobe Air applications on mobile devices. My thought is why not convert SWF to AIR application and then use that AIR application to publish on mobile devices. Does it make sense? Is this even possible or doable?
What are people doing to convert their existing Flash SWF applications to work on mobile devices?
This question was just answered here, but to recap any Flash content can be packaged to iOS or other mobile device with AIR.
AIR can be overlaid to Flash Professional or Flash Builder, or your SWF can be packaged using the ADT command line packager:
Download AIR 3.0 SDK.
Assure JRE, or use the one from Flash Builder.
Execute adt to package your SWF to an IPA:
adt -package -target [ipa-test | ipa-debug | ipa-app-store | ipa-ad-hoc]
-keystore iosPrivateKey.p12 -storetype pkcs12 -storepass qwerty12
-provisioning-profile ios.mobileprovision
HelloWorld.ipa
HelloWorld-app.xml
HelloWorld.swf icons Default.png
It's important to note that all executable code must reside in a single SWF to run on the iOS platform. SWFLoading or any dynamically loaded SWF that executes code is not supported. So, link all your Flash to a single SWF.
There are other considerations, such as optimizing performance and handling multiple screen resolutions and aspect ratios.
References:
http://www.adobe.com/devnet/air/articles/packaging-air-apps-ios.html
http://www.adobe.com/devnet/air/articles/packaging-air-apps-android.html
http://www.adobe.com/devnet/air/articles/packaging-air-apps-blackberry.html
There are a few ways to achieve this:
You can download Adobe AIR SDK, and follow their help or this tutorial. This method would be a bit tedious if you are not comfortable with command line, but it is perhaps the most powerful option because you get to tweak and control a lot of options.
If you have the FLA file, the latest version of Flash CS6 should provide you the means to create IOS IPA file more effortlessly. If you are a Windows user, you would need to get the p12 file as well as mobile provision file. Adobe has documentations on how to do that without a Mac. Eventually when your IPA is ripe for AppStore, you would need a Mac.
Keep in mind that the user experience of an SWF would not right away translate well for iOS. For example, the size of buttons, the affordance of interactive user controls, and most importantly, mouseover events could sometimes adversely impact the experience of a mobile app.
But those problems have nothing to do with SWF, as I have seen similar issues with other HTML-based web apps too.
Good luck, I would say writing Flash and it runs everywhere including iPhone/iPad is truly an amazing thing that most people don't know.
I have been doing this exact thing for a year or so.
You do have to set up your certificates using the keychain on the Mac, and you have to upload the app from a Mac. However, I do not have a Mac . . . instead, I rent time on a remote Mac using (macincloud or others), and use DropBox to send the files back and forth.
Depending on how the SWF was created, you do not necessarily need to buy Adobe products. I use FlashDevelop, which sets up the latest Air and Flex SDKs automatically. As long as you have a developer's license, you can create the Air application from that, and you can also create the IPA file for loading into iTunes (or Google Play, or others).
Make sure you have read #JasonSturges response as well. Good tips and links.

Is it possible to embed or load SWFs when making iphone apps (Is it allowed by Apple)

I am a little confused on whether to embed swfs or load them when making apps for the iphone. Does anyone know what are the advantages of each (which is preferable to use)? I know that embedding swfs should be a little faster than loading them but is that all?
Also and this is kind of important, I read that Apple will reject any app with external swfs?? Is that indeed correct? If so, will embedding or loading said swfs solve this problem?
Thanks in advance
EDIT: after some searching around, turns that Apple does have problems with loading external swfs, u can still do it, but your swfs need not have any actionscript attached, here is a link http://whizzkid74.blogspot.com/2010/12/air-for-iphone-loading-external-swf.html It doesnt say anything about embedding swfs however, so my question is this: can u embed swfs when writing apps on the iphone??
EDIT To clarify, when i say external SWFs. I mean SWFs that are found on your system locally but you need to add them to your program since they contain MovieClips or Sprites etc... that u need. I didn't mean SWFs that you need to download from a website or an online source. (hope that clarifies things)
EDIT Changed the question's title...Problem solved, thanks for all the help guys and happy new year =D
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:
I wanted to update this answer because I've learned a lot about this issue since I first looked into it.
The root of the issue is that, when making iOS apps with AIR, Apple TOS disallows runtime interpretation of code - and this includes SWF bytecode. So loading SWFs with code in them (even simple animation commands like stop(), gotoAndPlay(), etc) is disallowed and will not work via a Loader (prior to AIR 3.5).
Note that it's perfectly fine to load SWFs for their vector graphics content. The graphics will display, but the code will not execute.
However, there are a few workarounds for this. Both workarounds avoid a Loader by compiling assets with code in them into the main SWF, because once they're part of the main SWF, the AIR compiler (adt) will cross-compile the code into objective-c, and everything will work fine on iOS devices.
Using SWC libraries
This is the best option for iOS development. If you compile your graphical assets (.fla file) into SWCs (or export SWCs from symbols in your library), then compile your main swf against these SWCs, this goes through the compiler and actionscript code will execute on iOS devices.
Using SWFMerge for [embed]ed SWFs
Embedding assets into SWFs is very easy, and looks like this:
[Embed(source="GameLevel.swf")]
private var GameLevel:Class;
public function main():void
{
var my_level:* = new GameLevel();
addChild(my_level);
}
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. Then ADT will compile your main swf (including embedded code) into objective-C, it will work on iOS, and note: new gameLevel() now results directly in an instance of your asset - NOT a Loader.
The SWFMerge tool is here:
http://www.onetacoshort.com/temp/SWFMerge_alpha.swf
Let me know in the comments if this workaround works for you or if you have trouble.
Using Loaders
Prior to AIR 3.5, if you use a Loader to load a SWF file (whether this swf is included in your IPA or served from a webserver), the target SWF graphics will load just fine, but no code inside the SWF will execute, again because this is disallowed by Apple's TOS.
As of AIR 3.5, packaging SWF files in the .ipa as assets, using a Loader will work even if they contain code as this code is now AOT-compiled by adt. This requires -swf-version=18 or greater of the root SWF (not necessarily the assets) and AIR namespace ending in 3.5 in the application xml file.
However, it is technically possible to interpret SWF bytecode, it's simply an App Store legal restriction not to. If you only want to test on an iOS device and won't be distributing your app via the App Store, you can compile your SWF using adt's -target ipa-test-interpreter option, and Loading SWFs with code in them will work.
I'm not familiar with the rules around Apple and iPhone apps, but generally when I make apps/games, I embed everything. The advantages:
Your game/app is in one swf, making it easy to share
Your game/app loads quicker as all the assets are there at load-time
You're not dependant on internet access to get your assets (if you're loading them from a site) - good for an app
Your game/app will "just work" - no security issues, no problems with urls changing/asset site going down (if they're external)
If you use a swc instead of an swf (an swc can also be loaded btw), then you can also benefit from strict-typing
The disadvantages:
If you need to update one of your assets, you need to republish the game/app
The answer is yes, you can embed SWFs, but that is not the only way. You can also use normal Loader methods, with everything relative to the main SWF:
var myLoader:Loader = new Loader();
// iOS apps act as if the main SWF is in a folder
// and the other SWFs are in the same (or sub) folders.
var url:URLRequest = new URLRequest("loadedSWF.swf");
myLoader.load(url);
addChild(myLoader);
myLoader.x = 50;
myLoader.y = 30;
With one caveat: during compile time (in the "Air for iOS Settings", in the "Included files" list), you have to list the SWFs that you want to be loaded, and they will get compiled into the IPA.
So, no you cannot call to external SWFs, but you certainly can access other SWFs using the embed tag, or using (what might be called) IPA embedding.
Edit:
Since the question and title have changed a bit since I first answered this, here is a more generic summary. Apple does not allow loading local SWFs in the same way that you would be able to if using Flash Player on a website. There is no way to load an SWF (or anything else) using "relative" or "local" references in an i-device unless that content is compiled into the app. This does not apply to some types of "remote" SWF loading, and also does not apply to Actionscript "Native" coding, but that is not what the (original) question was about.

Play SWF files one the iPhone

I am new to the iPhone development, I need to develop application in which I can load SWF files (shock wave file). I have done lots of research but I couldn't get it to work. How do I load it on the iPhone ? if it's not possible, what alternatives do I have ?
There is no Flash player on iOS and no other solution to play Flash in your app. However, you might want to look into Adobe AIR for iOS which is able to produce iOS apps.
The iPhone doesn't support flash.
iOS Doesn't support Flash so you won't be able to launch a swf. If you have the source for the SWF you could consider building an ios app through Flash CS5+. Also, you could try porting it to haxe, which is very similar to actionscript and should allow you to build for both Android and iOS at once.
As I know there is no such application (expect Frash, which is only available on jailbroken iPhones) which can load SWF Files on an iPhone.
The only way you can go is to convert that file in an iPhone readable format, which I can't recommend as the results are normally horrible.
Otherwise I suggest to recode the behaviour of that SWF File in Objective C or something similar to that.
There is no Flash player in iOS. Even more – it is forbidden by Apple iOS Developer Agreement to deploy them (and other technologies where you may use an app to execute another executable code of any kind (SWF, Java, AIR, etc.) on iOS devices.
You can also make your own flash player.

Can we Integrate flash in iPhone application?

I want to integrate flash in my iPhone application so is it possible to integrate?
You can write apps in Flash that will run on the iPhone by using the Packager for iPhone. It only works with Flash and not Flash Builder. Adobe just released a revision after Apple changed its SDK license again so that it can run. Note that to run on the iPhone your app has to be compiled by Flash to a native iPhone app. You can't run just any SWF.
Also yesterday Adobe announced AIR 2.5 which claims to let you program for one runtime (AIR) and target multiple platforms including iPhone and iPad. The release notes explain that they will be updating their Packager to work with AIR 2.5 for feature parity with AIR 2.5 for Android.
There is an application called Packager for iPhone from Adobe, which can be used to make iPhone app from Flash. I never used it though, but I think you should give it a try.
No.
Adobe Packager appears to only be able to create entire apps, not library code that will integrate inside a larger app. There also is no complete Flash interpreter in a form that you might be able to bundle with your app (although there appear to be a few open source projects that claim to run a limited subset of Flash). Thus there is no way to integrate Flash into a larger iPhone application that will run offline.
Online, you might be able to run a Flash application remotely on a server, and serve the graphic results to an iPhone app using something like the VNC protocol.
A new parser called hiramkei will soon be available for adding Flash animation SWF files into Xcode projects for iPhone. Here is the site http://www.flash-on-iphone.com/demo