Don't think of things as "inclusion" and "pulling in", think of it as cooperating components.
 
You can use Application.application, but I think this leads to awful code.
 
One slightly better mechanism is to pass the child component a direct handle to the things it might need to manipulate.
 
I.e. in a creationComplete handler, do:
 
child.setOutputWidget( this.sometextfield );
 
But my favorite (which requires a bit more work) is to make your application implement an interface that you define:
 
public interface IWhatever
{
  public function doSomething( .. );
}
 
and then pass "this" to your child components, which expect an IWhatever:
 
child.setWhatever( this )
 
(and in the child...)
 
public function setWhatever( whatever:IWhatever ) {..}
 
Cheers,
-rg
 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jonathan Miranda
Sent: Monday, February 13, 2006 9:10 AM
To: [email protected]
Subject: [flexcoders] Spltting up code (best practice)

Alright, I have a main.mxml application file and an actionscript file that gets included. In the application let’s say I have a Form, that I want to pull out into another file. What’s the best practice for how this is accomplished if the Form needs to reference id’s in the main app, functions in the actionscript file, and the app/as to the form.

I’ve already got some bad habits with coldfusion, rather get into the habit of doing this “the right way” – if there is one.

_________________________________________

Jonathan Miranda

Flexible Master of the Web

"In the game of chess, it's important to never let your opponent see your pieces."



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




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to