as3里怎么改变MC里加载好的图片大小?
varmc:MovieClip=newMovieClip();loadImg.load(newURLRequest(img.@src));//加载图片mc.addChil...
var mc:MovieClip = new MovieClip();
loadImg.load(new URLRequest(img.@src));//加载图片
mc.addChild(loadImg);
var bp:Bitmap = (mc.content as Bitmap);
bp.height = 270;
bp.width =330;
我这样写死都不得 展开
loadImg.load(new URLRequest(img.@src));//加载图片
mc.addChild(loadImg);
var bp:Bitmap = (mc.content as Bitmap);
bp.height = 270;
bp.width =330;
我这样写死都不得 展开
展开全部
用下面的代码,如果有一定的AS基础应该可以看憧,不明白的地方给我百度Hi发信息;
注意:1.要加裁完成后才能设置;
2.Loader类才有content
var mc:MovieClip = new MovieClip();
var loadImg:Loader=new Loader();
loadImg.load(new URLRequest(img.@src));
addChild(mc)
mc.addChild(loadImg);
loadImg.contentLoaderInfo.addEventListener(Event.COMPLETE,comPleteHandler);
function comPleteHandler(e:Event) {
var bp:Bitmap = (loadImg.content as Bitmap);
bp.height = 270;
bp.width =330;
}
或者把mc去掉也可以,下面的
var loadImg:Loader=new Loader();
loadImg.load(new URLRequest("pic2.jpg"));
addChild(loadImg);
loadImg.contentLoaderInfo.addEventListener(Event.COMPLETE,comPleteHandler);
function comPleteHandler(e:Event) {
var bp:Bitmap = (loadImg.content as Bitmap);
bp.height = 270;
bp.width =330;
}
注意:1.要加裁完成后才能设置;
2.Loader类才有content
var mc:MovieClip = new MovieClip();
var loadImg:Loader=new Loader();
loadImg.load(new URLRequest(img.@src));
addChild(mc)
mc.addChild(loadImg);
loadImg.contentLoaderInfo.addEventListener(Event.COMPLETE,comPleteHandler);
function comPleteHandler(e:Event) {
var bp:Bitmap = (loadImg.content as Bitmap);
bp.height = 270;
bp.width =330;
}
或者把mc去掉也可以,下面的
var loadImg:Loader=new Loader();
loadImg.load(new URLRequest("pic2.jpg"));
addChild(loadImg);
loadImg.contentLoaderInfo.addEventListener(Event.COMPLETE,comPleteHandler);
function comPleteHandler(e:Event) {
var bp:Bitmap = (loadImg.content as Bitmap);
bp.height = 270;
bp.width =330;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询