Loading external images into an AIR for Android app

I have been building an Android AIR app that needs to load an image from the phone storage. After various trial and errors, I have the following actionscript code that would let user select an image from the phone and trace its name and path. From there simply use a loader object and you can attach the image to a movieclip.

import flash.filesystem.File;

import flash.net.FileFilter;

import flash.events.Event;

import flashx.textLayout.events.SelectionEvent;

var fileType:FileFilter = new FileFilter(“Image (*.jpg, *.png)”,”*.jpg; *.png”);

var fileChooser:File = File.userDirectory;

fileChooser.addEventListener(Event.SELECT, doSelect);

fileChooser.browseForOpen(“Open”, [fileType]);

function doSelect(e:Event):void

{trace(e.target.url); }

Advertisements

~ by brianchau on August 22, 2012.

One Response to “Loading external images into an AIR for Android app”

  1. We absolutely love your blog and find most of your post’s to be precisely what I’m looking for.
    can you offer guest writers to write content in your case?
    I wouldn’t mind creating a post or elaborating on a lot of the subjects you write concerning here. Again, awesome web log!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: