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 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.