I am making a “find hidden object” game for children. I need to be able to say that if one object is found correctly and the other object is found correctly then the movie will advance to the next frame to find other objects. Will this be an “if” statement? If so, can you give me a suggestion on how to write it?
when they find an item
found +1
then
if (found ==2){
learn coding!
}
Why not just attach event listeners to the items?
ie: they are simply hidden navigation buttons(!)
Disable the hand-cursor for the items.
You can use an if statement or switch in the CLICK function.
Here’s a partial example (you’ll certainly have to add to this or modify it some extent):
//items are instance named "itm1" "itm2" etc... and are wrapped in the movieclip "itemGroup"
itemGroup.addEventListener(MouseEvent.CLICK, foundIt, false, 0, true);
itemGroup.mouseEnabled = false;
itemGroup.buttonMode = false;
var item:String = "";
function foundIt(event:MouseEvent):void {
item = event.target.name;
//do something that always occurs when any button is clicked
switch (item) {
case "itm1" :
//do something specific to "itm1" here; gotoAndPlay, tween, etc...
break;
case "itm2" :
//do something specific to "itm2" here; gotoAndPlay, tween, etc...
break;
case "itm3" :
//do something specific to "itm3" here; gotoAndPlay, tween, etc...
break;
case "itm4" :
//do something specific to "itm4" here; gotoAndPlay, tween, etc...
break;
}
}
Thanks for helping. I have been trying to learn actionscript for a few months and I understand it to read it but haven’t quite got the hang of writing it yet. I will play around with this and see what I can come up with.