First, you have a typo in your switch(): you wrote switch(var) instead of
switch(v).
Second, to avoid any unpredictable result from a switch(), this statement
should look like (according to the MM docs) :
switch(condition){
case A:
break;
case B:
break;
default:
// not mendatory but should always be the last statement
break;
}
Moreover, another good practice is to type variables because the case:
statement uses the strict equality (===) to evaluate the result of the
condition.
So, returning to your problem :
var v:Number = 1;
switch(v){
case "1":
trace("case string 1");
break;
case 1:
trace("case number 1");
break;
default:
trace("default");
break;
}
Obviously outputs : "case number 1".
What result do you have?
2006/12/21, strk <[EMAIL PROTECTED]>:
Is this valid ActionScript ?
var v = 1;
switch (var)
{
default:
trace("default");
break;
case 1:
trace("1");
break;
}
What is expected to be traced ?
--strk;
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
--
Julien Vignali
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com