Re: [flexcoders] Setting properties to children technique

2006-10-02 Thread Sergey Kovalyov



Gordon, thank you for this answer. Are there any alternatives? I have one component inside another with the same properties. Actually, the second one is the pop up and the first one is a kind of "decorator". Together they work the way similar to ComboBox (ComboBox itself and List respectively also have similar properties). According to the example provided, I need to make two variables (flag and cache) for each property in both classes. It seems a bit overweighted for me.

On 9/29/06, Gordon Smith <[EMAIL PROTECTED]> wrote:



Yes, you should be using invalidation. The typical pattern for doing this is as follows:
 
    private var _buttonLabel:String = "";
 
    private var buttonLabelChanged:Boolean = false;

__._,_.___





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








   






  
  
SPONSORED LINKS
  
  
  

Software development tool
  
  
Software development
  
  
Software development services
  
  


Home design software
  
  
Software development company
  

   
  






  
  Your email settings: Individual Email|Traditional 
  Change settings via the Web (Yahoo! ID required) 
  Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured 
   
Visit Your Group 
   |
  
Yahoo! Groups Terms of Use
   |
  
   Unsubscribe 
   
 

  




__,_._,___



RE: [flexcoders] Setting properties to children technique

2006-09-29 Thread Gordon Smith












Yes, you should be using invalidation. The
typical pattern for doing this is as follows:

 

    private var
_buttonLabel:String = "";

 

    private var buttonLabelChanged:Boolean
= false;

 

    public function get
buttonLabel():String

    {

    return
_buttonLabel;

    }

 

    public function set
buttonLabel(value:String):void

    {

   
_buttonLabel = value;

   
buttonLabelChanged = true;

 

   
invalidateProperties();

    }

 

    override protected
function commitProperties():void

    {

   
super.commitPropertie();

 

   
if (buttonLabelChanged)

   
{

   
myButton.label = _buttonLabel;

   
buttonLabelChanged = false;

   
}

    }

 

You can find many examples of thsi pattern
in the framework source code.

 

- Gordon

 

 

 









From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Sergey Kovalyov
Sent: Friday, September 29, 2006
9:18 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Setting
properties to children technique



 







Hi All!

Imagine, I have a component based on VBox and Button child myButton
inside it. I have a property (getter/setter) in component buttonLabel:

public function get buttonLabel() : String {
return myButton.label;
}

public function set buttonLabel(buttonLabel : String) : void {
myButton.label = buttonLabel;
}

Sure, I get null pointer exception, while instantiating component and
setting its buttonLabel property, because myButton is not created yet:

"My Label" />

Probably, some invalidation must be used. invalidateProperties() >
commitProperties(), true? Are there any other ideas?

Sergey.






__._,_.___





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








   






  
  
SPONSORED LINKS
  
  
  

Software development tool
  
  
Software development
  
  
Software development services
  
  


Home design software
  
  
Software development company
  

   
  






  
  Your email settings: Individual Email|Traditional 
  Change settings via the Web (Yahoo! ID required) 
  Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured 
   
Visit Your Group 
   |
  
Yahoo! Groups Terms of Use
   |
  
   Unsubscribe 
   
 

  




__,_._,___