Just joined... and by reading today's posts, it looks like I am in the right
place to get help on this.
I am dynamically creating movie clips and loading each with a .jpg and a
layer with a mask. It is the addMask step that doesn't work. I have written
this a dozen different ways and have only confused myself. Stepping through
the code I learned that it creates all the movie clips first and then goes
to the onLoadInit and sets all the properties. It skips my attempt at an
addMask function. The linkage id of the mask in the library is "themask". I
tested this line separately in a different file. It sort of works although I
couldn't tell if it was loading the mask into the movie clip or the main
timeline. Yes, I am a beginner. And yes, I am going to go out and get the
Flash 8 Essentials book based on the posts I read today. Any suggestions
greatly appreciated!!!
Thanks,
T
...
max = 12;
//array of positions for x and y
var pos_x:Array = new Array(0, 200, 400, 600, 0, 200, 400, 600, 0, 200, 400,
600, 0);
var pos_y:Array = new Array(0, 0, 0, 0, 200, 200, 200, 200, 400, 400, 400,
400, 600);
k = 0;
var mcl_obj:Object = new Object();
mcl_obj.onLoadInit = function(target_mc:MovieClip):Void {
target_mc._x = pos_x[k];
target_mc._y = pos_y[k];
if (target_mc._width>200) {
ratio = target_mc._width/200;
target_mc._width = target_mc._width/ratio;
target_mc._height = target_mc._height/ratio;
}
//-----------broken part starts here--------------
target_mc.addMask = function() {
target_mc.attachMovie("themask", "idono"+i, this.getNextHighestDepth
());
target_mc.blendMode = "layer";
trace(i);
};
//----------end of broken part ------------------
//trace ("x "+pos_x[k]);
//trace ("y "+pos_y[k]);
target_mc.onPress = function() {
trace("drag goes here");
};
k = k+1;
};
for (var i = 0; i<=max; i++) {
//trace(i);
j = 10+i;
var instofimg = new Object();
instofimg = "img_mc"+i;
this.createEmptyMovieClip(instofimg, j);
var img_mcl:MovieClipLoader = new MovieClipLoader();
img_mcl.addListener(mcl_obj);
//load image into movieclip
img_mcl.loadClip("image"+i+".jpg", instofimg);
}
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com