PDA

View Full Version : loading external image over flash lite 2.0


boomberacun
08-26-2009, 07:44 PM
somebody help me to share actionscript to load external image (from mobile device directory) over flash lite 2.0...
thanks

Thommas
08-27-2009, 07:43 AM
Here you are :

Create a movieClip named "mc".

Use this code :
var mcl : MovieClipLoader = new MovieClipLoader();
var mclListener : Object = new Object();

var file : String = path + filename;

function init() : Void
{
mclListener.onLoadError = imageLoadError;
mclListener.onLoadInit = setImageAnimation;
mcl.addListener(mclListener);
}

function setImageAnimation(mc : MovieClip) : Void
{
// you can set image according to mc._width and mc._height.
}

function imageLoadError(mc : MovieClip) : Void
{
debug.text = "\nError ON LOAD !\n";
}

function loadImage() : Void
{
mcl.loadClip("file://" + file, mc);
}

boomberacun
08-30-2009, 04:14 PM
Thanks, master...
I'll try it and post the result

boomberacun
08-30-2009, 09:09 PM
Im sorry, master...
For example i want to load image from:
Phone/picture/wallpaper

Image name:
Flower.jpeg

How to set it to
var file : string = path + filename;

And
mcl.loadClip("file://" + file, mc)

Thanks

Thommas
08-31-2009, 08:29 AM
On Windows Mobile phones :

var file : string = "file://" + "SD Card\My Documents\My Images\" + "Flower.jpeg";
mcl.loadClip(file, mc);

On Symbian phones :

var file : string = "C:\Images\" + "Flower.jpeg";
mcl.loadClip(file, mc);

You just have to check in your file browser to get the good absolute path.

Relative path works as well I think :

var file : string = "Flower.jpeg";
mcl.loadClip(file, mc);

With "Flower.jpeg" in the same folder as your .SWF