alyskiss
04-27-2011, 06:31 PM
Hi,
I'm creating a game in Flash CS5 and it is a grid of blocks, different colors.
What I want to do is when the player clicks on the red blocks, I want them to be removed from the stage. But if the player clicks on any other color (green, blue, yellow), points will be deducted and nothing will happen (it will remain on the stage). I am calling upon a movie clip in the library which has four different colors on it on the timeline. I gave each of them a name in the label section.
My question is how do I call upon each separate color from the movie clip?
I'm going to need an IF ELSE statement. If the block is red > remove from stage. Else leave it there and deduct points....
this is what I have so far
var newBox101:Box = new Box();
newBox101.type = Math.ceil(Math.random()*4);
newBox101.gotoAndStop(newBox101.type);
newBox101.x=10;
newBox101.y=10;
addChild(newBox101);
newBox101.addEventListener(MouseEvent.CLICK,boxLea ve101);
function boxLeave101(event:MouseEvent){
trace("it works 101");
newBox101.x=-100;
}
The square in the library is named 'Box' if that helps..
Any one know how to do this?
Thanks so much!!
I'm creating a game in Flash CS5 and it is a grid of blocks, different colors.
What I want to do is when the player clicks on the red blocks, I want them to be removed from the stage. But if the player clicks on any other color (green, blue, yellow), points will be deducted and nothing will happen (it will remain on the stage). I am calling upon a movie clip in the library which has four different colors on it on the timeline. I gave each of them a name in the label section.
My question is how do I call upon each separate color from the movie clip?
I'm going to need an IF ELSE statement. If the block is red > remove from stage. Else leave it there and deduct points....
this is what I have so far
var newBox101:Box = new Box();
newBox101.type = Math.ceil(Math.random()*4);
newBox101.gotoAndStop(newBox101.type);
newBox101.x=10;
newBox101.y=10;
addChild(newBox101);
newBox101.addEventListener(MouseEvent.CLICK,boxLea ve101);
function boxLeave101(event:MouseEvent){
trace("it works 101");
newBox101.x=-100;
}
The square in the library is named 'Box' if that helps..
Any one know how to do this?
Thanks so much!!