You can use 

var objectClassName:String = getQualifiedClassName(object); 

If you are using all Flex components, you can use the className property of the 
flex component which returns just the name like "Button". The other method 
above works for any object class. 

Sincerely 
Mark R. Jonkman 



----- Original Message ----- 
From: "flexaustin" <[email protected]> 
To: [email protected] 
Sent: Wednesday, March 25, 2009 2:29:42 PM GMT -05:00 US/Canada Eastern 
Subject: [flexcoders] Can you get the class name of an object? 

I am using a framework that has a function that requires class name, see below 
(_ops.hasOwnProperty(name) ): 

The function expects an array of names (name of object types), such as Button 
or lineChart. 

Is there a way to get the class name? So if I am passed a Button object is 
there a way to get the object type as a string...so "Button". 


public function doUpdate(t:*=null, ...operators):Transitioner 
{ 
if (operators) { 
if (operators.length == 0) { 
operators = null; 
} else if (operators[0] is Array) { 
operators = operators[0].length > 0 ? operators[0] : null; 
} 
} 
var trans:Transitioner = Transitioner.instance(t); 
if (_axes != null) _axes.update(trans); 
if (operators) { 
for each (var name:String in operators) { 
if (_ops.hasOwnProperty(name)){ 
trace('ops[name] is ' + _ops[name] ); 
_ops[name].operate(trans); 
}else{ 
throw new Error("Unknown operator: " + name); 
} 
} 
} else { 



------------------------------------ 

-- 
Flexcoders Mailing List 
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt 
Alternative FAQ location: 
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! 
Groups Links 



Reply via email to