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

  • SEARCH
  • Home
  • 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 8474965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:46:05+00:00 2026-06-10T17:46:05+00:00

I’ve subclassed the LabelItemRenderer class to create an expandable renderer for a spark list

  • 0

I’ve subclassed the LabelItemRenderer class to create an expandable renderer for a spark list in my mobile app.

When the user selects an item, the renderer’s size increases, additional data is shown. The renderer basically looks like this (I’ve removed the parts that don’t matter here, so this is basically pseudo code).

public class PositionsGridRenderer extends LabelItemRenderer
{
    public function PositionsGridRenderer() {
        super();
        addEventListener(MouseEvent.CLICK, expandHandler);
    }

    protected override function createChildren():void {
        super.createChildren();

        _dg = new DataGroup();
        _dg.visible = false;
        addChild(_dg);
    }

    private function expandHandler(event:Event):void {
        if(_gridVisible) {
            if(!_detailClicked) {
                _dg.visible = false;
                _gridVisible = false;
            }
            _detailClicked = false;
        } else {
            _dg.visible = true;
            _gridVisible = true;
        }
    }

    public override function set data(value:Object):void {
        if(!value) return;

        super.data = value;

        var pos:Position = data as Position;

        label = pos.positionName;
        _dg.dataProvider = pos.positionSymbols;
    }

    protected override function measure():void {
        !_gridVisible ? measuredHeight = 30 : measuredHeight = 30 + getElementPreferredHeight(_dg);
        this.height = measuredHeight;
    }

    protected override function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void {
        setElementSize(labelDisplay, unscaledWidth, 30);
        setElementPosition(labelDisplay, 10,10);
        if(_gridVisible) {
            setElementSize(_dg, unscaledWidth, getElementPreferredHeight(_dg));
            setElementPosition(_dg, 0, 30);

        } else {
            setElementSize(_dg, unscaledWidth, 0);
        }

        invalidateSize();
    }
}

}

Works as expected, I’m just wondering if there’s a way to reduce the amount of validation calls this renderer does when I expand it.
If it is clicked to be expanded the layoutContents and measure functions are both called three times in the following order: layoutcontents -> measure, layoutcontens -> measure, layoutcontents -> measure.

I’d understand them being called once because I invalidate the size, but three times seems odd.
Does anyone know why this is happening, or maybe even how to prevent this from happening?

  • 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-06-10T17:46:06+00:00Added an answer on June 10, 2026 at 5:46 pm

    The real question was why is the component going through three full renderer cycles? After some disussion, this is what we came across:

    1. The first time the invalidate cycle is triggered is when a mouse down, or possibly a touch begin event occurs. This puts the component into the hover state; which causes a visual change in the component.
    2. The second time the invalidate cycle is triggered is when the item is selected. This puts the renderer in the down state; causing a different visual indicator to be drawn.
    3. The third invalidate cycle is caused by the component’s own code; when layoutContents() calls invalidatesize()
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I am writing an app with both english and french support. The app requests
I have a reasonable size flat file database of text documents mostly saved in
I'm trying to create an if statement in PHP that prevents a single post
I am using Paperclip to handle profile photo uploads in my app. They upload

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.