|
I ran your code and it worked fine, except
for one thing: The reference to the “press”
method was not quite right. I changed it from this: tview.press(); //this
would require a press method at the application level To this: tview.tna.press(); //this
runs the method on the sub-component You could also do as you began, but
passing in a reference to one subcomponent into the other: <testouttwo id="tnaa"
tview="{this}" tna="{tna}"/> public var tna:Object; //this
would work, but you did not pass the reference in yet, like this: One more recommendation, Where you are
passing a reference to a subcomponent, be sure to data “type” it
specifically. So public var tna:Object; should be public
var tna:testoutone and public var tview:Object; should be public
var tview:MyMainMxmlFileName; This will ensure that you can bind
properties in the subcomponent to values at the application level. So, did something not work for you? From: Breaking up code into components like that
is good practice. It will be easier to maintain and it will help avoid
the 32k issue. At first look the code seems ok.
I’ll try to run it and see if I see anything. From: 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"> </mx:HBox> Here is the first .as file class testoutone { function testoutone() { public function activate(){
Now here is the second .as file class testouttwo { public var tview:Object; } }
|
- RE: [flexcoders] Communication betwen two .as files Gordon Smith
- RE: [flexcoders] Communication betwen two .as files Tracy Spratt
- Re: [flexcoders] Communication betwen two .as files nostra72

