简体   繁体   English

在SWF AS3中加载图像

[英]loading images in swf as3

Because I have 24 movie clips and i need to load in every one of them different picture. 因为我有24个影片剪辑,所以我需要在每个影片剪辑中加载不同的图片。 So my question is, is there a really simple way to do that with as3 ? 所以我的问题是,有没有一种非常简单的方法可以用as3做到这一点? I need to call the pictures from different source? 我需要从其他来源调用图片吗?

This is what I would use: 这就是我要使用的:

var imagesCollection:Array = new Array("image1.jpg","image2.jpg","image3.jpg");
for(var i:int=0; i<imagesCollection.length; i++){
    var request:URLRequest = new URLRequest(imagesCollection[i]);
    var loader:Loader = new Loader();
    loader.load(request);
    addChild(loader);
};

Make sure to import URLRequest and Loader at the top of the code. 确保在代码顶部导入URLRequest和Loader。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM