Just to tie up the loose ends... if a variable has a type annotation then undefined is an illegal value. Only untyped variables, or variables typed as *, may be assigned with undefined. If they are uninitialized then they are null, 0 or false, depending on the actual type. Your code probably works because the value is actually null, and the == operator does not differentiate between null and undefined (the === operator does however make this distinction).
see: http://livedocs.adobe.com/flex/201/langref/specialTypes.html#* http://livedocs.adobe.com/flex/201/langref/package.html#undefined Peter On 10/25/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Nice - much more elegant - thanks alot > > > > if(foo) will give you the same result. basically if the instance is > there > > it'll work else it won't > > > > On 10/25/07, [EMAIL PROTECTED] <tim%40e-smartz.com> <[EMAIL > > PROTECTED]<tim%40e-smartz.com>> > wrote: > >> > >> Hi, > >> > >> I used to do conditionals based on undefined all the time in AS 2. For > >> example I would do a data look up and then cast the results to a class > >> called foo. Then I could do a conditional if (foo == undefined) // go > >> and > >> do whatever as the data ovbiously doesn't exist or has not been > >> recieved. > >> Now in AS3 this method still works but I get a warning that the class > >> cannot be undefined and undefined will be type coerced into a foo > class. > >> As I said it still wors so I'm not too fussed, but it's never good to > >> see > >> warnings! > >> > >> Tim > >> > >> > >> > > > > > > > > -- > > j:pn > > \\no comment > > > > >

