What are the advantages to connecting an mxml page to an as page

2005-02-25 Thread nostra72

I am curious because I am still trying to figure out how to connect an mxml page to an as page and I was wondering what is the advantage to doing that as opposed to simply putting all the script on the mxml page itself?


Re: [flexcoders] What are the advantages to connecting an mxml page to an as page

2005-02-25 Thread Jeff Tapper
Remember, each MXML file is effectively a class. Following OO best 
practices, each class should do 1 thing, and do it well.

There are effectively 3 ways to add ActionScript to a flex app.
1) mx:Script block inline of mxml page.
2) mx:Script source= pointing to .as file,
3) AS Class instantiated in mxml
Both one and two compile the script as part of the class created by the 
mxml file. This is the proper approach for code which belongs as part of 
the same class as the MXML for that page.

Their are times when a separate class is called for. Among the many 
reasons for this: Encapsulation, Reusabilty, etc. AS classes and MXML 
files are two approaches for creating custom components. The end result 
from either is a compiled class. An experience AS2 developer will probably 
find they have a lot more control over an AS2 class vs. the same class 
created with MXML.


At 09:44 AM 2/25/2005, you wrote:
I am curious because I am still trying to figure out how to connect an 
mxml page to an as page and I was wondering what is the advantage to 
doing that as opposed to simply putting all the script on the mxml page 
itself?
Yahoo! Groups Sponsor
ADVERTISEMENT
http://us.ard.yahoo.com/SIG=1295cf54k/M=298184.6018725.7038619.3001176/D=groups/S=1705007207:HM/EXP=1109429114/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: 140734d4.jpg

RE: [flexcoders] What are the advantages to connecting an mxml page to an as page

2005-02-25 Thread Tracy Spratt
Additionally, the first two can quickly get you up to the 32k limit,
where the class approach will not.

Tracy

-Original Message-
From: Jeff Tapper [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 25, 2005 10:03 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] What are the advantages to connecting an mxml
page to an as page

Remember, each MXML file is effectively a class. Following OO best 
practices, each class should do 1 thing, and do it well.

There are effectively 3 ways to add ActionScript to a flex app.
1) mx:Script block inline of mxml page.
2) mx:Script source= pointing to .as file,
3) AS Class instantiated in mxml

Both one and two compile the script as part of the class created by the 
mxml file. This is the proper approach for code which belongs as part
of 
the same class as the MXML for that page.

Their are times when a separate class is called for. Among the many 
reasons for this: Encapsulation, Reusabilty, etc. AS classes and MXML 
files are two approaches for creating custom components. The end result

from either is a compiled class. An experience AS2 developer will
probably 
find they have a lot more control over an AS2 class vs. the same class 
created with MXML.



At 09:44 AM 2/25/2005, you wrote:
I am curious because I am still trying to figure out how to connect an 
mxml page to an as page and I was wondering what is the advantage to 
doing that as opposed to simply putting all the script on the mxml page

itself?
Yahoo! Groups Sponsor
ADVERTISEMENT
http://us.ard.yahoo.com/SIG=1295cf54k/M=298184.6018725.7038619.3001176
/D=groups/S=1705007207:HM/EXP=1109429114/A=2593423/R=0/SIG=11el9gslf/*ht
tp://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]flexc
[EMAIL PROTECTED] 

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


 
Yahoo! Groups Links