|
-
var declaration shortcuts
i take it that i can not do this:
PHP Code:
var tgx,tgy,dx,dy,vx,vy,ease:Number;
but i have to do this:
PHP Code:
var tgx:Number,tgy:Number,dx:Number,dy:Number,vx:Number,vy:Number,ease:Number;
? || is the error i get in Flex, meaningless?
At the risk of developing bad habits, i would be curious if there is a resource out there with useful shortcuts when coding.
-
Senior Member
Well, you can do this:
var var1, var2:Number;
Which declares 2 variables, var is untyped, var2 is Number.
var var1, var2:Number;
trace(var1 is Number); //false
trace(var2 is Number);//true
However, once you assign value to the variable, untyped variable will be converted into Number anyway:
var var1, var2:Number;
var1=0;
var2=0;
trace(var1 is Number); //true
trace(var2 is Number); //true
So, basically, you can simply declare bunch of untyped variable in short:
var var1, var2;
and later, when they get Number value assigned, they will be converted into Numbers.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|