开发者

load multiple models in one

had the task to load a single model that has a dozen small models - everything is fine - but it would be split into separate models for faster downloading, type m开发者_Python百科odel1, model2 ..., the question arose as can be written so that would not be repeated with the code

var mc1:URLLoader = new URLLoader();
mc1.dataFormat = URLLoaderDataFormat.BINARY;
mc1.load(new URLRequest("models/model1.3ds"));
mc1.addEventListener(Event.COMPLETE, on3dsLoad);

var mc2:URLLoader = new URLLoader();
mc2.dataFormat = URLLoaderDataFormat.BINARY;
mc2.load(new URLRequest("models/model2.3ds"));
mc2.addEventListener(Event.COMPLETE, on3dsLoad);
mc2.addEventListener(Event.COMPLETE, on3dsLoad);
...


can be so?

var mc:Array = [];
for(var i:int=0; i<2;i++){
   getMC("models/model"+(i+1)+".3ds",mc[i]); 
}
function getMC(url:String,ret:Object):void{
   var loader:URLLoader = new URLLoader();  
   loader.dataFormat = URLLoaderDataFormat.BINARY;  
   lodaer.load(new URLRequest());  
   loader.addEventListener(Event.COMPLETE, on3dsLoad);
   function on3dsLoad(e:Event):void{
      ret = e.target
   }
}

but how to choose the desired object and assign it a value x,y,?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜