• 0

Flash Mx Photo Album...AS help please.


Question

Hi...I'm trying to make a photo album that is dynamically created by taking pictures from an array and placing them in their own movie clip on the stage when the movie is started....for some reason when I use this code:

pictures = new Array("Pic0","Pic1","Pic2");


for(i=0; i<3; i++) {
	_root.createEmptyMovieClip("holder"+i,1+i);
	setProperty("holder"+i, _x, 30 + 170*i);
	setProperty("holder"+i, _y, 400);
	setProperty("holder"+i, _xscale, 50);
	setProperty("holder"+i, _yscale, 50);
	with("holder"+i) {
  attachMovie(pictures[i],"Pict"+i,6+i);
	}
}

I get "Pic2" on top of the 2 other pictures....and the properties of the movies clips are not set either (the _x, _y, _xscale, _yscale).....

however when I use this code:

pictures = new Array("Pic0","Pic1","Pic2");


for(i=0; i<3; i++) {
	_root.createEmptyMovieClip("holder"+i,1+i);
	setProperty("holder"+i, _x, 30 + 170*i);
	setProperty("holder"+i, _y, 400);
	setProperty("holder"+i, _xscale, 50);
	setProperty("holder"+i, _yscale, 50);
}

_root.holder0.attachMovie(pictures[0],"Pict"+i,6);
_root.holder1.attachMovie(pictures[1],"Pict"+i,7);
_root.holder2.attachMovie(pictures[2],"Pict"+i,8);

I get the 3 seperate movie clips spaced and sized how I want them and they are located at the proper x's and y's.....my question is this...

Why doesn't the "with" statement in my first code segment do the same as the 3 separate "attachMovie" I am using in the 2nd code segment......also, how do I make the first code segment work using the "with" statement...as I want to minimize my code....more so for learning purposes...than for speed purposes. Thank you

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.