Sorry to contradict my advise for the IM, but to do what your trying, I'd do this differently.

As good general architecture advice, you dont want to tightly couple your components. Currently, your trying to address the labl of the main app from brandnewas, generally not a good idea. You can do this better like this:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="<http://www.macromedia.com/2003/mxml>http://www.macromedia.com/2003/mxml"; xmlns="*">
<brandnewas id="bna" fresh="{this}" />
<mx:HBox>
<mx:Button label="Change World" id="worldchanger" click="world.text=bna.changeworld()"/>
<mx:Label text= "Hello World" id="world"/>
</mx:HBox>
</mx:Application>


class brandnewas{
public var fresh:Object;
public var worldstate:String;
public function brandnewas(){}
public function changeworld():String{
return "Goodbye world";
}
}

At 11:56 AM 2/28/2005, [EMAIL PROTECTED] wrote:
I have figured out how to link a mxml page to an as page fine. However, when it comes to communication betweem the two pages such as the mxml page calling on a function on the .as page to change the label of a control on the mxml page I have had problems. What I am trying to do is basicly do a Hello World application where you click a button and the label on the mxml page changes to "Goodbye World!!". I want to somehow call a function on the .as page to do this and I have had a lot of problems. So here is the code for the mxml page I am trying to make:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="<http://www.macromedia.com/2003/mxml>http://www.macromedia.com/2003/mxml"; xmlns="*">
<brandnewas id="bna" fresh="{this}" />
<mx:HBox>
<mx:Button label="Change World" id="worldchanger" click="bna.changeworld()"/>
<mx:Label text= "Hello World" id="world"/>
</mx:HBox>
</mx:Application>





Now here is the code for the .as page I am hoping to link it to
// ActionScript Document

class brandnewas
{
public var fresh:Object;

public var worldstate:String;



public function brandnewas()
{}
public function changeworld():Void
{
world.text ="Goodbye world";
}
}


I hope somebody can clear up the confusion.

Yahoo! Groups Sponsor
ADVERTISEMENT
<http://us.ard.yahoo.com/SIG=129mht587/M=298184.6018725.7038619.3001176/D=groups/S=1705007207:HM/EXP=1109696225/A=2593423/R=0/SIG=11el9gslf/*http://www.netflix.com/Default?mqso=60190075>
click here



----------
Yahoo! Groups Links
* To visit your group on the web, go to:
* <http://groups.yahoo.com/group/flexcoders/>http://groups.yahoo.com/group/flexcoders/


*
* To unsubscribe from this group, send an email to:
* <mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]


*
* Your use of Yahoo! Groups is subject to the <http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.

<<inline: 3f13316.jpg>>

Reply via email to