AS question
- Started
- Last post
- 11 Responses
- Timson
hello, let me describe my problem.
i got on my stage about 10 dynamically placed movieclips. i named them accordingly mc0, mc1, mc2.
now when i click for instance mc2 i want all the other mc's to move to _x=0 except the one that i clicked (mc2).
i got that working now, but i'm using alot of code for it and i want it to be simplified. anyone could give me some insight on how to achieve that. thank you.
- dijitaq0
make an array of the mc names.
make a function, that the mc calls when it is clicked it loops through the array.
within that loop make an if else statement that all of the mc's name not equaling to the mc name being clicked move to the desired position.
something like that.
- Timson0
thanks, thought so of using an array wasn't it the fact that i'm short of time and never used arrays before.
what's the easiest way of filling an array with items that are on the stage ie. mc0, mc1, etc.
- dijitaq0
var mcArray:Array = new Array("mc0", "mc1"...)
- Timson0
okay, i see. but he mc's are placed dynamically according to the amount of nodes in an xml-file. i'll never be able to code the array by hand.
but i'm getting closer already :-)
- who0
http://www.gotoandlearn.com/ ... check the tutorial "Introduction to OOP"
- Timson0
thanks who, but i'm still using 1.0. anyone on how to push the dynamically placed mc's into an array?
- dijitaq0
you mean you cancan use xml but dont know how to populate an array?? dude.
- dijitaq0
build the array when parsing your xml file
- Timson0
i'll check into it when i've got more time. i'll be back to this thread than.
- davi-t0
// Create Array.
var mcArray:Array=[mc0, mc1, mc2...];
//Create function:
function doWhatchaWant(dontMoveThis_mc){
//Create Loop:
for(var i=0,i
- davi-t0
whoops..for some reason the entire code didnt go thru here...