flash actionscript:
NOTE: This code is in a Movie Clip.. What I am trying to do is use FlashVars. I have HTML like this: <param name="flashvars" value="high=62&low=2"> I want highNumber to be = to the value high from above and if its not there highNumber to be =to 40, and the same thing for lowNumber. I attached what I have so far. I know the variable is going into flash because I made a textbox the regular animation, and the values came up.... so if(high == undefined){ var highNumber = 40; } else { var highNumber = high; } if(low == undefined){ var lowNumber = 1; } else { var lowNumber = low; }
Hi, sound like a path problem. Every variable passed to a swf is accesible via the _root and as you said your code is in a movieclip; so i suggest this: if(high == undefined){ var highNumber = 40; } else { var highNumber = _root.high; } if(low == undefined){ var lowNumber = 1; } else { var lowNumber = _root.low; }
Thanks. I am using the attached code now. And this is what happens.... If I don't set any variables in FLASHVARS then it does 0-9 and then if I set high=9&low=0 it outputs numbers 0-9 but with a zero on the end.... anybody know how to fix this? if(_root.high == undefined){ var highNumber = 9; } else { var highNumber = _root.high; } if(_root.low == undefined){ var lowNumber = 0; } else { var lowNumber = _root.low; } number.text = Math.round(Math.random() * (highNumber - lowNumber)) + lowNumber;
Its doing that weird thing to every number if I put in high = 40 and low =1 then i get numbers in the hundreds... is my line: number.text = Math.round(Math.random() * (highNumber - lowNumber)) + lowNumber; right when it comes to making a random number between high and low?
Don't see what you're looking for? Try a search.
|