views:

270

answers:

1

Hi all, I don't know the exact problem. I am using flex mx:tree component in flex 4 and I'm customizing the icons using iconFunction.

here is my code

private function iconFunctionHandler(item:Object):Class
{
   var st:SWFLoader = GlobalVariable.getInstance().imageInstance;
   var iconClass:Class = Object(st.content).getInstance([email protected]());
   return iconClass;
}

I am loading icons from a preloaded swf file. The problem is this function is not working as expected. I am getting the following error

'TypeError: Error #1034: Type Coercion failed: cannot convert templateGroup@1e83fba1 to mx.core.IFlexDisplayObject.'

Dhana

A: 

You're casting iconClass as a Class, but then you are assigning to it the results of an Object constructor. Those are not the same thing.

Robusto
can you tell me how to do this properly?
Dhana