all groups > flash actionscript > july 2006 >
You're in the

flash actionscript

group:

Flash Movie Clip Variables


Flash Movie Clip Variables tecktalkcm0391
7/29/2006 7:53:20 PM
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;
}
Re: Flash Movie Clip Variables kglad
7/29/2006 8:06:28 PM
Re: Flash Movie Clip Variables butcho
7/30/2006 1:17:08 AM
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;
}
Re: Flash Movie Clip Variables tecktalkcm0391
7/30/2006 1:37:55 PM
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;
Re: Flash Movie Clip Variables tecktalkcm0391
7/30/2006 1:41:49 PM
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?
Re: Flash Movie Clip Variables kglad
7/30/2006 3:10:24 PM
Re: Flash Movie Clip Variables tecktalkcm0391
8/2/2006 2:14:36 PM
AddThis Social Bookmark Button