flash variable help?
- Started
- Last post
- 9 Responses
- loopyd
Googled endlessly. No answer.
Haven't used Flash in a while, trying to import Variables from an external text file.
The variables contain numbers (i.e. 200)
I want to then use this number to change the width of a movie clip. But it aint working, seems like the datatype is wrong when I try to use the variable to set the width property of the clip.
I tried "Number(variable)"
but no dice, any suggestions. MX BTW.
Thanks in advance.
- pkmlta0
you might want to try changing it to a number. sometimes if not usually imported data comes in without a specific data type:
myNumber = number(myNumber);
if this doesn't work you might want to make sure the variables are actually being loaded.
hope this helps
- pkmlta0
sorry. should read:
myNumber = Number(myNumber);
- loopyd0
Thanks.
The variables are being loaded, and I tried the Number(); route... Nada.
- loopyd0
anyone have ideas?
- nospacebar0
parseInt.
var a = parseInt("5.9");
trace(a + 1);
//6.9
- loopyd0
Thanks, but not it, the number is contained within the variable. aaarrrggghhh
- perfunct0
seems like nospacebar answer takes care of your problem but...maybe this works for you:
var newNumber:Number = Number(yourImportedVariable);
yourMC_mc._width = newNumber;
- nospacebar0
Are you doing any parsing of the data that you're bringing into Flash?
- caseyc0
Maybe this will help...