views:

17

answers:

1

Ok, this is what I have so far - but it gives me an error saying that I am missing a semicolon somewhere, but I cant figure out where. Basically what I want it to do is when the button is clicked a random number is generated, then one pic is hidden, one is shown - then after a pause, that pic is hidden and a different one is shown.

<mx:Button x="220" y="10" label="Shuffle the Cards" fontFamily="Times New Roman" fontSize="18" fontStyle="italic" fontWeight="normal"
click="
var shuffleDeck:Function = function shuffle():void {
var randNum:Number = Math.floor(Math.random()*(4))+1;
pic.visible = false;
shuffle.visible = true;
}
setTimeout(shuffle,100);
shuffle.visible = false;
select.visible = true;
"/>
+1  A: 

short answer

    shuffle.visible = true;
}    <--- Semicolon here
setTimeout(shuffle,100);

long answer

The following is really just a single statement (that happens to contain a block):

var shuffleDeck:Function = function shuffle():void {
    var randNum:Number = Math.floor(Math.random()*(4))+1;
    pic.visible = false;
    shuffle.visible = true;
};

...and like any other statement, it must end with a semicolon.

Blocks don't normally end with a semicolon, so it's deceptive looking, but the block in this case is just the last part of the statement.

Scott Smith