开发者

Flash AS2 - MovieClipLoader Class not working as expected

开发者 https://www.devze.com 2023-02-08 15:03 出处:网络
I have a problem with loading an image path reference into a movieClip. On my movie loading I attachMovie according to i (no. of instances)

I have a problem with loading an image path reference into a movieClip.

On my movie loading I attachMovie according to i (no. of instances)

Then I generate a copy of the instances (these are prepared ready for print - I have this working)

However, the initial creation of these instances is handled when the Flash movie loads and uses part of the code below to generate thumbnails:

myScroll.content.attachMovie("fav_content", "Stadium"+i, i);  开发者_如何学编程  
var imgPath = mySharedObject.data["img"+i];    
myScroll.content["Stadium" + i].imageLocation = imgPath;

The movieClip instance Stadium+i has a property/variable imageLocation set to imgPath, the below code then handles loading the path to the image which resides in the movieClip Stadium+i on the first frame:

var myLoader:MovieClipLoader = new MovieClipLoader(); 
myLoader.loadClip(imageLocation, imagePlace);
//imagePlace is the name of the empty movieClip

This all works as expected, however, on a trigger event I want to generate a copy of these instances, which populate as required apart from the image(s), the code I am using is very similar but for some reason does not show the thumbnail:

printContainer.attachMovie("fav_content", "Stadium"+i, i);
var imgPath = mySharedObject.data["img"+i];
printContainer["Stadium" + i].imageLocation = imgPath;
var myLoader:MovieClipLoader = new MovieClipLoader(); 
myLoader.loadClip(imageLocation, imagePlace);

The class is called multiple times once then when triggered in a duplicate movieclip but fails somehow - maybe the clue is duplicate tho tried that (duplicateMovieClip..)

I have traced the image path and returns the path correctly..?:S


If the image paths are the same for both iteration loops, collect the paths the first time in an array, and then pull from that array for later needs.

outside the loop:

var imgPathArray:Array = new Array();

then:

myScroll.content.attachMovie("fav_content", "Stadium"+i, i);    
var imgPath = mySharedObject.data["img"+i];
imgPathArray.push(imgPath);   
myScroll.content["Stadium" + i].imageLocation = imgPath;
var myLoader:MovieClipLoader = new MovieClipLoader(); 
myLoader.loadClip(imageLocation, imagePlace);

then:

printContainer.attachMovie("fav_content", "Stadium"+i, i);
var duplicateImgPath = imgPathArray[i];
printContainer["Stadium" + i].imageLocation = duplicateImgPath;
var myLoader:MovieClipLoader = new MovieClipLoader(); 
myLoader.loadClip(imageLocation, imagePlace);
0

精彩评论

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

关注公众号