Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Actionscript help with slot machine style interface

Status
Not open for further replies.
Hi, I had a look at your .fla and here's a (partial) solution to your problem.

On each of the keyframes in your animations where the pictures change add a variable called "state" and set it to

"1" for the road worker
"2" for the golfer
"3" for the office worker

to see if there's a match you just have to compare the variables from each of the clips - if they're equal you have a picture match. You'll have to add instance names to each of the clips for this to work. I just used "top", "middle" and "bottom" like the movieclip names when I checked this. You reach the varible by going to the "root" level, then to the movieclip name and then to the variable: _root.movieClip.variable.

I attached the script to your "Try Again" button to test the script - I know this isn't exactly what you're after but it should be easy enough to move it to where you want it.

on (press) {
//check to see if all three sections are the same
if (_root.top.state == _root.middle.state && _root.top.state == _root.bottom.state) {
//if so go to "correct" frame
gotoAndStop ("match");
} else {
//otherwise try again
gotoAndPlay("start");
}
}

 
Cheers -
I will try your solution later today.
If you kept the .fla file you tried the code on , could u email it to me @ cadeus@start.com.au ??
Much appreciated.
 
Sorry, threw the code out. Must learn to stop doing that :)

If you have problems making it work get back to me and I'll re-do it and send it to you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top