I think you're right that you can't find out at runtime that 'bar' was typed as 
IBitmapDrawable. But using IBitmapDrawable as a type annotation does ensure 
that it gets compiled in unless you deliberately exclude it.

Gordon Smith
Adobe Flex SDK Team

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of Oleg Sivokon
Sent: Wednesday, June 16, 2010 4:38 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: how to access action script variable data type in 
mxml


Nope, sorry Amy, it's not possible to get the type of a local variable, you can 
only get the type of a value it references. Example:

function foo():void {

var bar:IBitmapDrawable = new BitmapData();

}

you can only know what the type of the value is ( BitmapData ) the type of the 
"bar" variable (IBitmapDrawable) may not even exist in the compiled code - 
there's no need for it to exist anyway.

Reply via email to