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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:34:21+00:00 2026-05-22T16:34:21+00:00

I am trying to override a Button class, i have a few properties which

  • 0

I am trying to override a Button class, i have a few properties which i wish directly initialise with the mxml description of the component, like :

<sl:TMyButton id="btnX" x="168" y="223" width="290" label="Button" myproperty1="10" myproperty2="101" myproperty3="4"/>

which function is triggered ( in order to override it ) when all properties with mxml description is fully initialised with their values ?

  • 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-22T16:34:22+00:00Added an answer on May 22, 2026 at 4:34 pm

    Flex components have 4 methods in protected namespace which should be overridden to solve different tasks:

    • createChildren() — calls one time to create and add subcomponents.
    • measure() called in process of lay outing to calculate components size.
    • updateDisplayList() has real component unscaled width and height as parameter. It is obvious this method is convenient for positioning of children.
    • commitProperties() is the method I suggest you to override in order to apply properties values which don’t need component size to apply.

    So in your case it can be updateDisplayList() or commitProperties(). I recommend you the following code snippets:

    private var myproperty1Dirty:Boolean;
    private var _myproperty1:String;
    public function set myproperty1(value:String):void
    {
        if (_myproperty1 == value)
            return;
        _myproperty1 = value;
        myproperty1Dirty = true;
        // Postponed cumulative call of updateDisplayList() to place elements
        invalidateDisplayList();
    }
    
    private var myproperty2Dirty:Boolean;
    private var _myproperty2:String;
    public function set myproperty2(value:String):void
    {
        if (_myproperty2 == value)
            return;
        _myproperty2 = value;
        myproperty2Dirty = true;
        // Postponed cumulative call of commitProperties() to apply property value
        invalidatePropertues();
    }
    
    override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
    {
        super.updateDisplayList(unscaledWidth, unscaledHeight);
        if (myproperty1Dirty)
        {
            // Perform children placing which depends on myproperty1 changes
            myproperty1Dirty = false;
        }
    }
    
    override protected function commitProperties():void
    {
        super.commitProperties();
        if (myproperty2Dirty)
        {
            // Apply changes of myproperty2
            myproperty2Dirty = false;
        }
    }
    

    Hope this helps!

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

Sidebar

Related Questions

I am trying to override the DataGridViewTextBoxCell's paint method in a derived class so
What i'm trying to do is just simply have the button load an image
Hello all i have a button i am trying to let users share a
I am a beginner android developer and I am trying to have a button
For a few days, I have been trying to get the username to save
I have a jQuery UI Button that I am trying to style using CSS.
Trying my hand at java and android and have run into a problem which
I'm trying to create an always-op-top button/clickable-image which stays on top of all the
I'm trying to understand the RPC functionality which GWT uses, and have followed this
I am using tablesorter 2.0 and I have been trying to override the css

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.