-
hi
i used this loop to declare every movieclip in an array as a button:
for(i=0; i<theArray.length; i++){
_root["myMovieClip" add i].onRelease = function () {
_root.theReleasefunction();
}
}
but the function only appears to work on the last moieclip (i=theArray.length)
what can i do????
please help
-
why is i = theArray.length when you set i = 0
you have a list of movieclip names in theArray? or do you just have movieclips named myMovieClip, myMovieClip1, myMovieClip2 etc...?
Code:
for(var i; i < theArray.length; i++){
_root["myMovieClip" + i].onRelease = function () {
_root.theReleasefunction();
}
}
-
sorry, a typing mistake:
i=0; i<theArray.length; i++
in this particular case, i have an array with some properties of the different movies.
the whole thing:
function createObstacles() {
for (i=0; i<obstacles.length; i++) {
//creates a empty movie as a reference
_root.master.attachMovie("leer", "obstacle" add i, i+1);
//loads the external movie into the reference
loadMovie("tiles/mo_" add _root.obstacles[i][0] add ".swf", _root.master["obstacle" add i]);
var actual = _root.master["obstacle" add i];
actual.obj = i;
actual._y = (obstacles[i][1]*25)+(obstacles[i][2]*25);
actual._x = (obstacles[i][1]*-50)+(obstacles[i][2]*50);
actual.obst = i;
for (row=0; row>(-1*obstacles[i][4]); row--) {
for (col=0; col<obstacles[i][3]; col++) {
var actualrow = Number(obstacles[i][1])+row;
var actualcol = Number(obstacles[i][2])+col;
_root.theMap[actualrow][actualcol] = "x";
}
}
_root.changeToButton(actual);
}
}
function changeToButton(obj) {
obj.onRollOver = function() {
trace("cool");
};
}
-
------------ please help me -----------
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|