加载照片

private var picLoder:Loader;
private var picLoderRequest:URLRequest;

 

private function pictureLoder():void
{
picLoder = new Loader();
picLoderRequest = new URLRequest("resource/pic/girl.jpg");//resouce文件夹和swf文件同级
picLoder.contentLoaderInfo.addEventListener(Event.COMPLETE,loderCompleteHandler);//架设监听
picLoder.load(picLoderRequest);//开始加载
}

 

private function loderCompleteHandler(evt:Event):void
{
var pic:DisplayObject = LoaderInfo(evt.target).content;
pic.width = picContainer.width;
pic.height = picContainer.height;
picContainer.addChild(pic);


}

posted on 2012-10-31 00:06  橙小风  阅读(164)  评论(0编辑  收藏  举报