I'm getting a runtime error when I attempt to expand a treeview node

TypeError: Error #1006: Call attempted on an object that is not a function.
        at flex_treeview3a/::geticon()

I suspect it's the way I'm using item.hasOwnProperty() but I'm out of ideas.

the "geticon()" function is for the tree's iconFunction. In this I'm trying to

if the node is a leaf ("activity")
   get the activity type, set leaf icon to activity Type icon
else if is root
  set top branch node to root icon
else (must be branch)
   set branch icon

can anyone see what I've got wrong?
thanx


    <mx:XMLList id="treeData">
        <node label="root node">
            <node label="node A">
                <node label="Activity 1" actType="act_1" />
                <node label="Activity 2" actType="act_2" />
                <node label="Activity 3" actType="act_3" />
            </node>
            <node label="node B">
                <node label="node B one">
                        <node label="Activity 4" actType="act_1" />
                        <node label="Activity 5" actType="act_2" />
                    </node>
                <node label="node B two">
                            <node label="Activity 6" actType="act_6" />
                    <node label="Activity 7" actType="act_7"/>
                </node>
            </node>
            <node label="Activity 8" actType="act_6" />
            <node label="Activity 9" actType="act_7" />
        </node>
    </mx:XMLList>


                          private function geticon(item:Object):Class{  
                                   var i:int = 0;
                                   var type: String = "";
                                   var isActivity:Boolean = 
item.hasOwnProperty("@actType");
                                
                                   if (isActivity){
                                        type = item.getProperty("actType");
                                   }

                                   if (type != ""){
                                                switch(type){
                                                        case "act_1": return 
iconAct1; break;
                                                        case "act_2": return 
iconAct2; break;
                                                        case "act_3": return 
iconAct3; break;
                                                        case "act_4": return 
iconAct4; break;
                                                        case "act_5": return 
iconAct5; break;
                                                        default:                
return null; break;     
                                                }       
                                   } else {
                                           while (item.parent()!=null) {
                                            item = item.parent();
                                               i++;
                                           }
                                           switch (i){
                                             case 0:
                                                     return iconEvent;
                                             break;
                                             default:
                                                     return iconConnect;
                                             break;
                                           }
                                   }
                                   return null;
                        
                          }


------------------------ Yahoo! Groups Sponsor --------------------~--> 
See what's inside the new Yahoo! Groups email.
http://us.click.yahoo.com/2pRQfA/bOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to