How do I update an mxml property dynamically in Flex?

Note: edited to reflect feedback Since you're using Flex 4, you should probably do this with a skin and States within the skin. But if you want to do it through code, try something like this: protected var _allowClose:Boolean=true; protected var _allowCloseChanged::Boolean=true; protected var _closeButton:Sprite = new Sprite(); public function get allowClose():Boolean { return _allowClose; } public function set allowClose(value:Boolean):void { if (value! = _allowClose) { _allowClose=value; _allowCloseChanged=true; invalidateProperties(); } } override protected function commitProperties():void { if (_allowCloseChanged) { if (_allowClosed) { titlebar.

AddChild(_closeButton); drawCloseButton(true); } else { titleBar. RemoveChild(_closeButton); } //you need to set this back false...sorry I left that out _allowCloseChanged=false; } super. CommitProperties(); } Note: in this case, you no longer need to override createChildren.

I'm investigating your solution as we speak, it appears to be called correctly, but the rest of my code (that I didn't include in the snippet) that should happen inside near the "drawCloseButton" code, is currently failing, so i'm fixing that first.. – Tominator Sep 29 '11 at 13:39 Joy, it works! (I had to fiddle a bit with my own code. ) Two things however: commitProperties should be "protected override" instead of "public", and inside the "if (_allowCloseChanged) {" should be a "_allowCloseChanged = false;" Thanks!

– Tominator Sep 29 '11 at 14:06 Sorry, wrote this too early in the morning :). The reason you had to change it to (!_allowCloseChanged) is because I forgot to set it back false in the commitProperties. You want to run that code whenever _allowClose changes (hence the flag), not every time commitProperties runs (which is often).

– Amy Blankenship Sep 29 '11 at 16:59.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions


Thank You!
send