magquatre
08-03-2007, 01:37 AM
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="blahblah" creationComplete="before_click()">
<mx:Script>
<![CDATA[
[Bindable]
public var my_string:String = new String();
public function before_click():void
{
my_string = "This is before the button was clicked"
my_panel.title = my_string;
}
public function after_click():void
{
my_string = "This is after the button was clicked"
my_button.label = "i just got clicked!";
}
]]>
</mx:Script>
<mx:Panel width="557" height="501" title="" id="my_panel">
<mx:Button label="Button" id="my_button" click="after_click()"/>
</mx:Panel>
</mx:Application>
The purpose of this code is to assign a string variable to my_panel.title
So when i click on the button, it updates the my_string variable, which should then (somehow) update the my_panel.title variable. Of course, this is not what happens. Is there anyway i could store a reference of my_string into my_panel.title so that the correct behavior occurs? I know that an easy solution is to do this:
<mx:Panel width="557" height="501" title="{my_string}" id="my_panel">
But that is not what i want. Because i may want to create my panel object dynamically through actionscript. Is it possible to do some sort of referencing/pointer voodoo in actionscript to get this to work? Or will i have to resort to manually updating each flex component's properties that i want to have changed?
Thanks
<mx:Application xmlns:mx="blahblah" creationComplete="before_click()">
<mx:Script>
<![CDATA[
[Bindable]
public var my_string:String = new String();
public function before_click():void
{
my_string = "This is before the button was clicked"
my_panel.title = my_string;
}
public function after_click():void
{
my_string = "This is after the button was clicked"
my_button.label = "i just got clicked!";
}
]]>
</mx:Script>
<mx:Panel width="557" height="501" title="" id="my_panel">
<mx:Button label="Button" id="my_button" click="after_click()"/>
</mx:Panel>
</mx:Application>
The purpose of this code is to assign a string variable to my_panel.title
So when i click on the button, it updates the my_string variable, which should then (somehow) update the my_panel.title variable. Of course, this is not what happens. Is there anyway i could store a reference of my_string into my_panel.title so that the correct behavior occurs? I know that an easy solution is to do this:
<mx:Panel width="557" height="501" title="{my_string}" id="my_panel">
But that is not what i want. Because i may want to create my panel object dynamically through actionscript. Is it possible to do some sort of referencing/pointer voodoo in actionscript to get this to work? Or will i have to resort to manually updating each flex component's properties that i want to have changed?
Thanks