/*
*.swf文件要加载的图片文件a.jpg放置在.swf
*文件的上一级目录中用"../a.jpg"得到地址,
*如果是上级的上级目录用"http://www.cnblogs.com/a.jpg"以此类推
*/
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;
var loader:Loader = new Loader ;
loader.load(new URLRequest("../a.jpg"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE ,loadComplete);
function loadComplete(e:Event):void
{
var b:Bitmap = e.target.loader.content as Bitmap;
trace(e.target.loader.content);
trace("得到加载图片的width====="+b.width);
loader.x = stage.stageWidth / 2 - b.width / 2;
loader.y = stage.stageHeight/2 - b.height/2;
addChild(loader);
}