How can i make a button, on being clicked gotoand stop at any frame 1 - 7 inclusive. plz help.
[AS]gotoAndStop(Math.floor(Math.random()*7+1));[/AS]
http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary456.html
http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary466.html
You would use the random() function.
Method 1: [AS]gotoAndStop(random(7)+1)[/AS]
Method 2: [AS]gotoAndStop(Math.floor(Math.random()*7+1))[/AS]
random() is deprecated syntax and was replaced by Math.random(), but it works faster and is easier to type, so it is still used (for now at least). Math.random() is the new method and if you don’t understand how it works you can read up on it here…
http://www.kirupa.com/developer/actionscript/tricks/random.htm
edit: kode beat me :evil:
thnx.:+)
Welcome. :beam: