Archive

Archive for February, 2010

Introspection : getClassInfo OR hasOwnProperty ?

February 19, 2010 Leave a comment

This week i had to write some code to check if at least one of the items in a tree has a child.
It’s weird, but seems there is no such function in the Flex framework. So I jumped into FLEX introspection docs and wrote this code :

public function hasChildren():Boolean
{
for each (var obj:Object in myTree.dataProvider)
{
if (ObjectUtil.getClassInfo(obj)["metadata"]["children"] != null)
return true;
}
return false;
}

But in some cases it doesn’t work fine, according to the flex doc : “You can also use the mx.utils.ObjectUtil.toString() method to print all the dynamically added properties of an object“.

So here a solution that works if all cases :

public function hasChildren():Boolean
{
for each (var obj:Object in myTree.dataProvider)
{
if ( obj.hasOwnProperty("children") && obj["children"] != null)
return true;
}
return false;
}

So be careful if you want to use ObjectUtils class to inspect your object.

Categories: Uncategorized

Air / Release Build -> ERROR, creating AIR file: 102: ERROR, http:ns.adobe.com/air/application/1.5.3

February 9, 2010 Leave a comment

It’s been a while i had this error when trying to release an air application, and today after a bit of searching i found the solution on the web.

– Open the application’s descriptor file -app.xml and review the second line, which should contain an XML namespace declaration like http://ns.adobe.com/air/application/1.X.X

Change the postfix version number from 1.X.X to 1.5

and this is it !

source: http://www.justria.com/2008/11/19/if-flexbuilder-complains-about-error-creating-air-file-305-error-10-solution/

Categories: Uncategorized