flsg -> RE: Flash Q&A thread 2 ** checked everyday (5/20/2006 16:19:47)
|
what version of Flash did you begin with? Flash mx 2004? I used Flash MX this is called type checking. It generate a bug when the value is not correctly assigned e.g. var gold:Number="a lot"//Flash generate an error
var test1:String="hello"
test1=123//generate an error too if you want to use the old method in AS 2.0, you can, but I suggest you to do this: var gold:Object="a lot"
gold=1000 both of them don't generate errors, because you can use any value of a subclass where a superclass is needed, since the Object object is the base of every objects(lol, funny sentence), it can be consider as the superclass of every class be careful, Flash doesn't type check the null Object: var gold:Number=null//isn't an error and you can't type check global variables: _global.gold:Number=1000//doesn't work of cours, if you don't want to assign a value, just simply use this: var gold:Number you can use type checking on any Objects, e.g. String, Boolean, Number, Error(yes, that's a AS 2.0 class), Array, etc
|
|
|
|