开发者

How to Fetch the images from a given URL in Flash builder

How to Fetch the images from given URL in Fla开发者_开发问答sh builder


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


Alternatively you can use the image tag.

<mx:image id="img" source="http://foo.com/bar.png"/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜