Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-14-2009, 04:23 PM   #1
EndlessLine
Intelligent Ape
 
EndlessLine's Avatar
 
Join Date: Aug 2007
Location: Denver, CO
Posts: 134
Send a message via AIM to EndlessLine
Default Extending MXML Best Practices

I was wondering what the 'best' way is to extend an MXML component from a style point of view. For example, if I want to extend TitleWindow to do some shtuff, I feel like things get a bit cluttered when I add the mx:Script tags and fill it with the logic that runs the TitleWindows actions. Should I extend the MXML component with an AS class for the code? Is placing the code within the script tag the best way? Any alternate ideas? Just wondering, wanna keep my room clean. Thanks!
__________________
"Try the morphine, it's excellent today."
EndlessLine is offline   Reply With Quote
Old 05-14-2009, 06:16 PM   #2
wvxvw
Holosuit User
 
wvxvw's Avatar
 
Join Date: Oct 2006
Location: Tel Aviv
Posts: 4,301
Send a message via ICQ to wvxvw
Default

IMO: only extend AS classes with MXML, but not MXML with AS or other MXML. This is because the actual MXML code is a bad AS code, it has lots of redundant stuff.
If you don't like putting the code in MXML, then extend the AS component, that that MXML component extends and modify it in AS, but, even though extending MXMLs is possible, you'll be very much limited in what you can do, you'll loose metadata (think styles, [DefaultProperty], [DefferedInstance], etc will not be inherited, no constructor arguments, or only default arguments etc...
__________________
The .NET open source editor for Flash and web developers
*This would be my contribution to the project*
couchsurfing if you need it
wvxvw is offline   Reply With Quote
Old 05-14-2009, 07:12 PM   #3
EndlessLine
Intelligent Ape
 
EndlessLine's Avatar
 
Join Date: Aug 2007
Location: Denver, CO
Posts: 134
Send a message via AIM to EndlessLine
Default

Cool, I do see where MXML extends MXML is kinda screwy. I'm trying to combine a few controls in a collection, creating its own component. I'll try marking it up as mxml and extending some controls and see how it goes. Thanks for your advice!
__________________
"Try the morphine, it's excellent today."
EndlessLine is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
passing data from one mxml to another saiphani723 Flex 2, 3 & 4 1 03-25-2009 12:38 PM
extending custom mxml component with AS3 Class vivoices Flex 2, 3 & 4 13 03-01-2009 10:04 PM
passing values from one mxml to another mxml vijayakumar Flex 2, 3 & 4 1 06-30-2008 04:22 PM
mxml extending custom .as class that extends UIComponent Rob@ASF Flex 2, 3 & 4 3 03-31-2008 03:23 AM
Accessing variable in main mxml from component blu3 Flex 2, 3 & 4 2 09-22-2007 12:43 PM


All times are GMT. The time now is 01:21 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.