views:

11

answers:

2

How to Fetch the images from given URL in Flash builder

A: 

The following snippet creates a 100x100 masking item and then a loader that uses that item for it's mask. After the loader is created, a URL is called to populate the loader, then the loader is added to the stage.

import flash.display.*;
import flash.net.URLRequest;

var rect:Shape = new Shape();
rect.graphics.beginFill(0xFFFFFF);
rect.graphics.drawRect(0, 0, 100, 100);
rect.graphics.endFill();
addChild(rect);
var ldr:Loader = new Loader();
ldr.mask = rect;

var url:String = "http://www.unknown.example.com/content.jpg";
var urlReq:URLRequest = new URLRequest(url);
ldr.load(urlReq);
addChild(ldr);

This example came straight from the Adobe docs. http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html

Chad Udell
A: 

Alternatively you can use the image tag.

<mx:image id="img" source="http://foo.com/bar.png"/&gt;
jase21