Micky Hulse wrote:
Pedro Taranto wrote:
if you want to return diferent types in one function you dont specify any return data type

Ah, sounds good to me. I was not sure if it was bad practice to not specify a type.

Well, if you want to write strictly, and if you're interested in exactly what data type your method returns, you can specify a return type of Object (the parent of every other AS class):

function getData():Object   { // do calculations, return the result }

var returnValue:Object = getData();

if (returnValue instanceof DataType)
{
   do stuff;
}
else if (returnValue instanceof OtherDataType
{
   do other stuff;
}

_______________________________________________
[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

Reply via email to