获取每个加载的图像
图片只加载到最后一个MC,如何让它加载到每个MC?
private function imageHandler():void {
imageBox=new MovieClip();
imageBox.graphics.lineStyle(5, 0xFFFFFF);
imageBox.graphics.beginFill(0xFF0000);
imageBox.graphics.drawRect(0,0,150,225);
imageBox.graphics.endFill();
allImage.addChild(imageBox);
}
private function getPhoto():void {
for (i=0; i<myXMLList.length(); i++) {
placePhoto();
imageHandler();
imagesArray.push(imageBox);
imagesArray[i].x=20+(200*i);
}
addChild(allImage);
allImage.x=-(allImage.width+20);
allImage.y=-(allImage.height+50);
}
private function placePhoto():void {
loadedPic=myXMLList[i].@PIC;
galleryLoader = new Loader();
galleryLoader.load(new URLRequest(loadedPic));
galleryLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,picLoaded);
}
private function picLoaded(event:Event):void {
var bmpD=event.target.content.bitmapData
for (j; j<myXMLList.length(); j++) {
bmp=new Bitmap(bmpD);
bmp.smoothing=true;
bmp.name="bmp"+j;
imagesArray[j].addChild(bmp);
}
}
The images only loads into the last MC, how to make it load into each MC?
private function imageHandler():void {
imageBox=new MovieClip();
imageBox.graphics.lineStyle(5, 0xFFFFFF);
imageBox.graphics.beginFill(0xFF0000);
imageBox.graphics.drawRect(0,0,150,225);
imageBox.graphics.endFill();
allImage.addChild(imageBox);
}
private function getPhoto():void {
for (i=0; i<myXMLList.length(); i++) {
placePhoto();
imageHandler();
imagesArray.push(imageBox);
imagesArray[i].x=20+(200*i);
}
addChild(allImage);
allImage.x=-(allImage.width+20);
allImage.y=-(allImage.height+50);
}
private function placePhoto():void {
loadedPic=myXMLList[i].@PIC;
galleryLoader = new Loader();
galleryLoader.load(new URLRequest(loadedPic));
galleryLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,picLoaded);
}
private function picLoaded(event:Event):void {
var bmpD=event.target.content.bitmapData
for (j; j<myXMLList.length(); j++) {
bmp=new Bitmap(bmpD);
bmp.smoothing=true;
bmp.name="bmp"+j;
imagesArray[j].addChild(bmp);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它现在可以工作,但它显示
在 imagesArray[j].addChild(bmpArray[j]);
有什么问题吗?
It works now, but it shows
at imagesArray[j].addChild(bmpArray[j]);
what's wrong with it?