Hi Folks,
I’m just learning to use Arrays, and I’m trying to make a simple demo that works. A solution to this will really help me learn.
Basically, I have 4 Mcs on the stage. The same Mc with 4 instance names. Each Mc is a hole, and on frame 2 a bee appears. The 2 states of the Mc are:
frame 1, label: ‘start’.
frame 2, label: ‘action’. (a bee appears).
Here’s my code so far. It works without errors so far, but I hope the arrays are setup right. What I’d like to happen is:
-
When the user has clicked on 4 holes in any order, the ‘welldone’ box appears. code to insert: addChild(welldone);
-
Since the order is random, I have a dynamic text box at the bottom of the stage. I’d like the words: one, two, three, four… appearing in the textfield in that order.
It could be very simple or quite complex - I haven’t a clue! Thanks
var welldone:MovieClip = new Welldone();
var clipArray:Array = [hex1, hex2, hex3, hex4];
for (var i:int = 0; i < clipArray.length; i++) {
clipArray*.buttonMode = true;
clipArray*.addEventListener(MouseEvent.CLICK, clickHandler);
}
function clickHandler(event:MouseEvent):void {
for (var i:int = 0; i < clipArray.length; i++) {
if (event.currentTarget == clipArray*) {
clipArray*.gotoAndStop(“action”)
}
}
}
To be inserted somewhere after the 4mcs have been clicked:
//addChild(welldone);
Thanks again!