Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6673013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:34:38+00:00 2026-05-26T03:34:38+00:00

I have a Flex tree control that holds a tree full of various types

  • 0

I have a Flex tree control that holds a tree full of various types of objects. I’d like to change the label of the item based on this type (and other properties). I’d prefer to do this in a custom TreeItemRenderer rather than via label or labelfunction.

It seems that whatever I do, I cannot typecheck nor cast the objects and thus I get [Object object] in the nodes of my tree. Here is my renderer:

public class MyCustomTreeItemRenderer extends TreeItemRenderer {
    // Overriding to set the text for each tree node.      
    override protected function updateDisplayList(unscaledWidth:Number, 
                                                  unscaledHeight:Number):void {

        super.updateDisplayList(unscaledWidth, unscaledHeight);

        if (super.data) {
            trace("Rendering node:");

            if (super.data is MyClassA) { 
                trace("             MyClassA");
                super.label.text =  MyClassA(super.data).name
            }

            if (super.data is MyClassB) { 
                trace("             MyClassB");
                super.label.text = MyClassB(super.data).id;
            }
        }
    }

    public function NavigateTreeItemRenderer() {
        super();
    }

}

Examining the trace shows I am rendering the node, but I never end up inside either of the two if statements. When I run in the debugger, I can actually the properties on the “data” that correspond to MyClassA and MyClassB!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:34:38+00:00Added an answer on May 26, 2026 at 3:34 am

    Turns out I was bitten by a subtle issue whereby the ActionScript3 compiler automatically dropped my classes from my remote services SWC because it did not detect any direct reference to those classes. Because those objects are instantiated by RemoteObject result handlers and placed into an child ArrayCollection, there was no reference to them that the compiler could detect.

    When this happens, rather than throwing an exception, Flex’s RemoteObject implementation simply (and quietly) hydrates them into a generic Object, thus negating the value of their strongly typed interface.

    The workaround was to declare a variable within each derived service class for every type of value object that could ever appear within the their object graphs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having some trouble with the flex Tree control. I have a control
I have flex advancedDataGrid (could use dataGrid if that works better, though i like
i have a Flex tree control and im trying to select a tree node
I have a Flex tree with an ArrayCollection as data provider. The collection holds
So I have a flex tree component with a xmllistcollection as it's data provider.
I have a tree in flex built from an XML document into an XMLlist
I have a portlet. Inside of this portlet I have Flex application that displays
So, I have Flex project that loads a Module using the ModuleManager - not
I have a flex application that needs the ability to generate and execute JavaScript.
I have a Flex ComboBox that gets populated by a dataprovider all is well...

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.