View Full Version : for..in loop and Flex warning
darth
11-11-2008, 12:55 PM
So in Flex I have actionscript project and this line
for(var i in LoaderInfo(this.root.loaderInfo).parameters){
gives me
1008: variable 'i' has no type declaration.
warning.
How do I get rid of it?
If you know what type are the .parametes (eg:Object but you can see it by using the
flex debugger) you just have to write:
for (var i:Object in...
else if you don't know or not sure about the type, just write
for (var i:* in...
that is a "variant" declaration (the type is undefined until the var get the value of the
object)
In flex every variable must by typed :)
darth
11-11-2008, 01:36 PM
Thanks!
However String type should be enough for flashvars.
Sure, I was not saying that about flashvars but as a general approach ;)
darth
11-11-2008, 01:50 PM
Oh yes that's what I really wanted to know :p how to use it in general ;)
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.