How can I port a Flash application to the BlackBerry PlayBook - actionscript

I have a Flash application written in ActionScript 2 that I would like to port to the BlackBerry Playbook. The application is composed of an .swf file and a directory containing a large number of vector images. The path to these images (e.g. imagefolder/icons/icon1.swf) is hard-coded into an application and requires the image directory and the .swf file to be in the same directory.
I've installed the PlayBook SDK and have tried packaging the application with FlashBuilder 4, but I have no experience with this programme and have so far been unsuccessful. I tried placing the application in an SWFLoader component, but I then realised after reading this pdf document that MXML components are not supported. Since the app is written in AS2, I believe it cannot be compiled by Flash Builder. I don't need any any of the AIR features so I was wondering how could I embed the .swf and image directory in a Flash Builder ActionScript project so that it would run on the BlackBerry PlayBook.

The playbook uses AIR to play, so you need to be able to run it in AIR, which means that you need to have it working in as3. You could try "tricking it" by loading the AVM1 into AVM2.

Related

Same Application on Different Blackberry Handsets

I am a newbie in Blackberry Development and has got stuck on a very complex thing.
I have to make an application which should be support all O.S 6 and 0.S 7 based mobile phones.
Now I have different screen resolutions for different handsets in BB OS 6 and 7.
Now how can i manage my background images, and its button positions to be synced on all size of devices.
I have created an images for the screen size of 640x480 and according to it I have placed some button on x,y positions. now if i install the same app on a screen size of 480x360 how can i manage the x,y positions and manage the background size according to device width and height.
Can anybody help? I am complete newbie.
Use preprocessor, built-in to Eclipse JDE-plugin, or third-party preprocessor and BlackBerry Ant Tools
Compile separate applications for different RIM OS versions using the same source code files with preprocessor directives inside.
Technically an application compiled with RIM SDK 6.0 is compatible with device with RIM OS 7.0, but to provide the best user experience make separate applications for separate RIM OS versions.
On preprocessing include those image files which are suitable for building a particular application version. If you need to support many screen sizes, then add the biggest possible images to your project and then scale them down at the runtime. Scaling down almost does not affect image quality.
Upon ant build process employ Alx task to collect all information about separate application versions into one alx file.
As a result you will have one alx file (application descriptor file, it is an xml-file), and a set of folders with cod files inside.
When all cod files are signed, you can also do it upon ant build process distribute this alx file with all folders with cod files as one zip archive.
Customer unzips this archive, connects device via usb to the computer, launches BlackBerry Desktop Manager and selects this one alx file. Directives generated by alx task will guide BlackBerry Desktop Manager to install application suitable for the device RIM OS version.
If you want to distribute your application wirelessly, then employ jadtool task and make a php page that reads browser user agent and redirects browser to a relevant jad file.
Before using OTA (over the air) method for distributing your application, add the following MIME-type instructions to the .htaccess file of your web-server.
AddType text/vnd.sun.j2me.app-descriptor jad
AddType application/java-archive jar
AddType application/vnd.rim.cod cod
While the approach suggested does provide the best user experience, it is also the most complex to manage.
Personally I try very hard to make one executable and have it evaluate at run time what it needs to do based on the form factor of the device. This is actually easier than you might think, helped significantly by the fact that most screens about the same width. So you can do things like scale your assets to match a proportion of the screen width, based on the screen resolution, and they will look OK on most devices.
And while there are some nice things to be had by using stuff that is specific to say OS7, at this stage I think you should focus on the bread and butter stuff that you can do with OS 5. So, I would recommend you develop something for OS 5.0 - it will run on OS 6.0 and OS 7.0 devices. Create the UI generically to cope with various screen sizes. Later, if you need to get more sophisticated, you can use the tools that have been described.
You will find more on how I try to do things by looking at this.
http://supportforums.blackberry.com/t5/Java-Development/Tutorials-for-new-developers-Part-1/m-p/1621711#M194036
I would suggest you look at tutorial 10.
I also recommend a cruise around here:
http://developer.blackberry.com/java/
One final thing though, are you aware that Java phones are no longer being developed by BlackBerry? If you are just starting development, you might consider learning C++/Cascades and developing for the BB10 phones.

AIR 3.6 iOS - Load external SWF with ABC

With AIR 3.6, is it finally possible to load an EXTERNAL swf file with AS3 code from the web and use it on the iOS device?
I see on their web page they say the new features include:
Packaging and Loading Multiple SWFs: This feature provides developers better memory management by allowing them to load the assets they need dynamically at ANY time from multiple SWFs and not have to load it up-front.
Just to make it clear, does this mean it only work for swfs packaged with the application, or also with externals swfs?
This was just announced in AIR 3.7 not 3.6.
AIR 3.6 includes the ability to package multiple swf's with your iOS app but does not allow you to download them from an external server.
AIR 3.7 looks to give you the ability to load external swf's from a website.
Application developers will be able to host their secondary SWFs on an External server and load them on demand as per their application
logic using this feature. The loading secondary SWFs which have any ABC code in AOT mode, which worked for just locally packaged
SWFs earlier, will now work for loading SWFs externally as well
It looks like the bytecode will be contained in your application binary
During IPA packaging, ADT extracts the Actioscript code from all child SWFs which are specified within the sample text file, adds it to the
final executable and moves the stripped SWFs into the "externalStrippedSwfs" folder created in the current working directory.
Check the release notes PDF for an example,
http://labsdownload.adobe.com/pub/labs/flashruntimes/shared/air3-7_flashplayer11-7_releasenotes.pdf
It seems there is a requirement that the external SWF file is compiled for Flash Player 11.6, with an internal version number >= 19.

Can i use XULRunner to create executable that acts like a phonegap app (WebView and fullscreen?) on the desktop (Windows/Linux/OSX)?

Story:
I have written a HTML Merge Compiler that can merge resource's/assets into one single HTML file (minify it to the max) and compiles Javascript with the google enclosure compiler. I have written this compiler to speed up loading and interpreting the code and to obfuscate the code to protect a little bit (script kiddie protection). Major reason was/is speed and to make it compact.
This is working OK with reliable results and i use this in PhoneGap applications/games. I have also written a javascript library that encapsulate all platforms that works with standard HTML/CSS without the need to change the code, it works also in the browser, with a touchscreen or without or on any device or operating system. Write once, publish many ;-). The idea around it is that is working always, always operate the same but can use device specific things when available but does never fail (when something is not there, for example a vibrate functionality).
Anyway, most frameworks (like PhoneGap) concentrate on Mobile Platforms but i want to port it also to desktop platforms like Windows, OSX and maybe Linux. For Windows I have wrote an Delphi Application that loads the HTML in a TEmbeddedWB object (is Internet Explorer actually) but the 'problem' is that it is only suitable to Windows and IE is not the fastest browser around, especially when it is embedded (do not why it is slower than the browser itself). For example, when i load the compiled code in Firefox and/or Google Chrome it is blazing fast (you do not notice it is javascript ;-)).
EDIT:
Pre release of IE10 for Windows 7 is just launched, installed it and lag is gone!
You can download it from here:
http://www.microsoft.com/en-us/download/details.aspx?id=35709
Introduction to my question:
I have tried XULRunner of Mozilla a long time ago but the first time was not a pleasure to me and also i tried it today again but can't get it to work. Get a parse error in the main xul file of the project, window is an undefined entity. ??? I create a sample project like: http://mdn.beonex.com/en/Getting_started_with_XULRunner.html
I do not know what to do about this error. Also i think documentation is not up-to-date? Most documentation is from around 2006.
The question, what i want to know:
Before i am going to waste my time (see also introduction), is it
possible to create frameless (full-screen) desktop executables with
use of XULRunner like with PhoneGap?
Is it possible to create cross-platform applications with XULRunner, i mean, does it really work seamless. Where can i find a ready-to-publish example of a XULRunner project and is it possible to load local HTML file(s) like in PhoneGap?
It is possible and allowed to access external resources?
Long story, but maybe there is somebody that have tried this before and can lead me to choose the right direction.
is it possible to create frameless (full-screen) desktop executables with use of XULRunner like with PhoneGap?
Yes. You use disablechrome attribute to remove the window frame and sizemode="maximized" to have it open full-screen. Alternatively you can use the full-screen API if you want your application to run in a normal window and only switch to full-screen mode on request.
Is it possible to create cross-platform applications with XULRunner
Yes. There are things like menus that work very differently on OS X but most of the time you don't need to care what operating system your application runs on (Windows, Linux and Mac OS X supported).
Where can i find a ready-to-publish example of a XULRunner project
See documentation for a XULRunner application example. For "ready-to-publish" you would need an installer which doesn't come with the platform.
is it possible to load local HTML file(s) like in PhoneGap?
Yes. The top-level window has to be XUL but you can use some very minimal code here - essentially a single <iframe flex="1"/> tag. You can load HTML pages into that frame then.
It is possible and allowed to access external resources?
Yes, XULRunner applications have full privileges and can access files on disk as well as web resources without any restrictions.

How to test reading of files in Blackberry Ripple Emulator

I am attempting to build an app that needs to read .epub files on a Blackberry using WebWorks. However, using the Ripple Emulator I'm able to access the directory structure in blackberry.io.dir but I wanted to make a file available to be read so I can test the loading of a file.
I assume the folders like file:///SDCard are not physical folders but is there anyway I can copy a file from my local machine to this folder so I can begin testing.
I tried using local:/// but this is not returning anything.
It depends on what OS you're on but this answer talks about Mac OS: Where does PERSISTENT file system storage store with chrome?

How to use an .xnb file in MonoGame on Windows 8?

I've got an .xnb file from a Windows Phone project made on Windows 7. I'd like to use the same asset in a Windows 8 Metro app. I've got MSVS 2012 RC on Windows 8 with a project from the MonoGameWindowsMetroApplication template. I put the .xnb file in the project Assets folder and tried to load it, but I get an exception telling me that the asset can't be loaded. What properties or configuration do I need to be able to use the .xnb file?
While MonoGame is working on the Content Pipeline piece of the framework, you can simply use the same Content Pipeline engine that you used for the Windows Phone 7 game to create a Content Pipeline and use the associated .xnb files in your Windows 8 XNA MonoGame project.
I have a blog tutorial series on building XNA games with MonoGame for Windows 8, and if you look at Part 3, I provide a step-by-stepy walkthrough of accomplishing this. My hands-on lab and information on my blog was reviewed and approved by the MonoGame team.
See info here: http://blogs.msdn.com/b/tarawalker/archive/2013/01/04/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-3-updating-graphics-using-content-pipeline-with-monogame.aspx
The runtime Xna framework has many type reader objects that read the various xnb files. Some of the type readers are for xnb files that were processed from fbx models, others are xnb files processed from 2d image files, etc.
When you call content.Load<T>(xnb file name), The content manager uses the appropriate reader to read the byte information of the xnb file into the appropriate Xna class. The byte information in an xnb file is designed to be used in a specific Xna class, no other. There are no Xna classes in metro.
All this to say there are no type readers in the metro environment that read these xnb files. You would have to write your own. It's not that hard though, that's similar to what I did. I now process an fbx file into xnb by building an Xna project, then my xna project writes the runtime model's data to my own binary file, which I read from my metro app. But I could've simply read the xnb also. I just would have had to study the contentManager's & Model class' type readers to see how the byte info was distributed.
After all is said and done, it just means I don't have to learn the FBXSDK which would be the standard way (and arguably preferred way) of bringing in model info.
EDIT - sorry, didn't clue into the use of the mono framework. I don't know anything about that... Maybe they do have a way of importing xnb files.
Are you on the develop3D branch? I think you need to add a dummy Content project and add it to that project, not your assets, build that project first, then you need to reference that project in your MonoGame project.
I didn't succeed on that yesterday as I'm using the current stable but one of the MonoGame guys told me to do just that yesterday. Here are some instructions:
https://github.com/mono/MonoGame/wiki/MonoGame-Content-Processing
In MonoGame content pipeline is not present, at least as off now.
Its very easy.
1)Create a xna project in VS2010
2)add all your assets over there.
3)Rebuild your project. Go to bin/x86/debug/content and copy all contents from there
Now go to your VS2012 Mono Project bin/x86/debug look for content folder, if its there copy all content there else create a content folder and copy all content there.
Now without changing even single line of code just run your project and you will find everything working great!!!
Let me know if you find any difficulty doing that.

Resources