actionscript help
- Started
- Last post
- 6 Responses
- ahalvarsson
Hello!
Need a little quick help with some as2.
I have this menu with active states.
Now I want to pass a variable to the flash file saying that button1 should be active.
So I have a flashvar saying that button=btn1.
now I want to somehow pick that up in the flash file and say something like
if (button == btn1) {
//code for active state
}any pointers. Been looking for too long now and cant get it to work.
- acescence0
when you pass something in via flashvars, it's available at root with the name you assigned, so _root.button should give you access to your flashvar
- ahalvarsson0
so this should work?
if (_root.button == btn1) {
//code
}
- ahalvarsson0
Or I know it doesn't when I tried it. But should it work?
- acescence0
step one would be a sanity test: trace your variable to see if it's being set correctly
- acescence0
also, if (_root.button == btn1) is testing whether the variable _root.button is equal to a variable called btn1, not the literal "btn1"
- ahalvarsson0
Ok, the var is set correctly.
So now it's just to get the if statement correct.
What I want is to see if the var = btn1 the active statement will be triggered. So the If (var == something) is wrong?- almost there.
I forgot the "" around btn1ahalvarsson - Done :) Thanks for your help!ahalvarsson
- almost there.