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 3965876
In Process

The Archive Base Latest Questions

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

this is a 2nd question related to my first question at: Flex 4: mx|tree

  • 0

this is a 2nd question related to my first question at:

Flex 4: mx|tree – how can i disable items selection?

I want to disable the hover and selection colors so when a user selects an item it’s background won’t change color. how is that possible?

update

i do not want to choose the selection and hover colors. the background contains an image so it won’t be useful. i need to completely disable the colors.

another update

i tried to override the Tree class but with no luck.

this is the class that overrides the tree Class:

package components.popups.WelcomeBack {
import mx.controls.listClasses.IListItemRenderer;
import mx.controls.Tree;

/**
 * @author ufk
 */
public class TreeNoSelection extends Tree {
    
     protected override function drawItem(item:IListItemRenderer,
                            selected:Boolean = false,
                            highlighted:Boolean = false,
                            caret:Boolean = false,
                            transition:Boolean = false):void
    {
        super.drawItem(item, false, false, false, transition);  
    }

}
    

}

and this is my actual tree component:

<?xml version="1.0" encoding="utf-8"?>
<WelcomeBack:TreeNoSelection xmlns:fx="http://ns.adobe.com/mxml/2009" 
     xmlns:s="library://ns.adobe.com/flex/spark" 
     xmlns:mx="library://ns.adobe.com/flex/mx"
     xmlns:WelcomeBack="components.popups.WelcomeBack.*" folderClosedIcon="{null}" defaultLeafIcon="{null}"
     folderOpenIcon="{null}" 
     showRoot="false"  
            allowMultipleSelection="false" allowDragSelection="false" labelField="@label">
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>

<fx:Script>
    <![CDATA[
        import ItemRenderer.WelcomeBackTreeItemRenderer;
        private var _themeLibrary:Object;
        
        public function get themeLibrary():Object {
            return this._themeLibrary;
        }
        
        public function set themeLibrary(tl:Object):void {
            this._themeLibrary=tl;
            var cf:ClassFactory = new ClassFactory();
            cf.generator = ItemRenderer.WelcomeBackTreeItemRenderer;
            cf.properties = {
                _themeLibrary:this._themeLibrary
            };
            this.itemRenderer=cf;
        }
        
    ]]>
</fx:Script>

</WelcomeBack:TreeNoSelection>

thanks

  • 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-20T03:31:27+00:00Added an answer on May 20, 2026 at 3:31 am

    I’ve got good news and bad news. The good news is that it’s really easy. The bad news is that you need to subclass the Tree.

    package custom
    {
        import mx.controls.Tree;
        import mx.controls.listClasses.IListItemRenderer;
    
        public class CustomTree extends Tree
        {
             protected override function drawItem(item:IListItemRenderer,
                                    selected:Boolean = false,
                                    highlighted:Boolean = false,
                                    caret:Boolean = false,
                                    transition:Boolean = false):void
            {
                super.drawItem(item, false, false, false, transition);  
            }
    
        }
    }
    

    So what happens here is that we intercept the drawItem method and call the method on the superclass fooling it into thinking there’s nothing selected, highlighted or “careted”. The caret is for when you change selection by keyboard. Not sure what the transition parameter is for, you can send it as always false if there’re still some effects bothering you.

    Edit

    After taking a look at the related question, I found out that the root of the problem is the item renderer using the new spark architecture, which means the renderers are responsible with reacting to special states (selected, highlighted, show caret). So when using the spark item renderer there are other 3 functions that also need overriding:

    public class CustomTree extends Tree
    {
        public override function isItemShowingCaret(data:Object):Boolean
        {
            return false;
        }
    
        public override function isItemHighlighted(data:Object):Boolean
        {
            return false;
        }
    
        public override function isItemSelected(data:Object):Boolean
        {
            return false;
        }
    
        protected override function drawItem(item:IListItemRenderer,
                                             selected:Boolean = false,
                                             highlighted:Boolean = false,
                                             caret:Boolean = false,
                                             transition:Boolean = false):void
        {
            super.drawItem(item, false, false, false, transition);  
        }
    }
    

    Bonus – override isItemSelectable to prevent selection when clicking on an item (you can still select them via keyboard, although there will be no visual hint of that):

    public override function isItemSelectable(data:Object):Boolean
    {
         return false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a two part question, but I want to make sure the first
I was asked about this question. I can only think of a O(nm) algorithm
This question is related to: CS5 FLASH + AS3 Hello, I am simply trying
My question is regarding this shadowBlur feature used on the 2nd (outer) rectangle below.
This is a follow-up from this question : Effective Java 2nd Edition, Item 17:
So this question is two parts. The first is seeing whether there is a
i have this question: creating 2 pages in php the first(index.php) contain a form
This is a bit of a long shot, but if anyone can figure it
This might seem like a stupid question I admit. But I'm in a small
This is a difficult and open-ended question I know, but I thought I'd throw

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.