Call parentDocument.tna.press() from the second component.

 

- Gordon

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Tuesday, September 20, 2005 8:27 AM
To: [email protected]
Subject: [flexcoders] Communication betwen two .as files

 

How do you have an mxml file that has two .as files and one .as file has a function in it that calls the method in the other .as file. Let me show you what I want to do, here is the mxml file What I want to do is to have someone press the testouttwo button then have it call the acivatetwo() method in testouttwo which in turn calls the press method in testout one. Is this possible to do? I know an mxml file with two .as files is not neccessary I am just wanting to learn to handle it because I ran in to the 32k error.:

<?xml version="1.0" encoding="utf-8"?>

 

<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*" width="550">
<testoutone id="tna"  tview="{this}"/>
<testouttwo id="tnaa" tview="{this}"/>
 <mx:HBox id="help" visible="true">
<mx:Button label="testoutone" id="turnon" click ="tna.activate()"/>
<mx:Button label="testouttwo" enabled = "true" id="turnontwo" click ="tnaa.activatetwo()"/> 

 

</mx:HBox>
<mx:HBox>
<mx:Button label="connect" enabled = "true" id="connect" />
</mx:HBox>
</mx:Application>

 Here is the first .as file

class testoutone {
 public var tview:Object;
  

 

    function testoutone() {
     
    }

 

    public function activate(){
tview.turnon.label="YES"

 


}
 public function press(){
tview.connect.label="YES"

 


}
}

Now here is the second .as file

class testouttwo {

 

    public var tview:Object;
public var tnaa:Object;
    function testouttwo() {
     
    }
 public function activatetwo(){
tview.turnontwo.label="YES"
tview.press()

 

}
   

 

}




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




YAHOO! GROUPS LINKS




Reply via email to