Gordon,
That makes things crystal clear!
“Base Class” is Ted speak, nothing in the docs on that.
It would be very handy to see a hierarchy of how a Flex app is internally
organized. The development model and mxml generation shields us from knowing
what is occurring but it is handy to know these details. Even if it was ASCII
art it would be meaningful:
+ Player 8.5
+ SystemManager Instance >> Technically should be >> this.stage.root as this
is the root of the DisplayList
+ ManagerInstances…
+ Application.application Instance >>> MXML
Application Instance inserted here!
_____
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Gordon
Smith
Sent: Thursday, April 06, 2006 5:13 PM
To: [email protected]
Subject: RE: [flexcoders] Re: Question to Adobe about Flex Framework 1.5 Code
Quality
Ah, I see that you're using the phrase "base class" to mean "the class that a
SWF automatically instantiates as the root of the DisplayObject hierarchy". (Do
our docs call this the base class? They shouldn't.) I thought you meant base
class in the sense of some superclass like UIComponent or Container that a
component inherits from.
In the case of a Flex 2 app, this special class is the SystemManager. The
Application instance is created as a child of the SystemManager instance. Other
things like popups, cursors, and tooltips are also children of the
SystemManager rather than children of the Application. However, most Flex
developers should never need to think about the SystemManager.
- Gordon
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Ted
Patrick
Sent: Thursday, April 06, 2006 1:53 PM
To: [email protected]
Subject: RE: [flexcoders] Re: Question to Adobe about Flex Framework 1.5 Code
Quality
Gordon,
I had my ASC hat on and was thinking the MXML generated AS was similar...
With ActionScript projects, the base class is the root of the DisplayList.
package{
class MyApp{
public function MyApp(){
this.addChild( new Box() )
}
}
}
In Flex 2 is mx.core.Application.application the root of the DisplayList?
Ways to get to root in Flex2 app:
//from anywhere
mx.core.Application.application
//from any component
myComponent.parentApplication
//from any DisplayObject
this.stage.root
this.root //sometimes...
Cheers,
Cynergy Systems, Inc.
Theodore Patrick
Sr. Consultant
[EMAIL PROTECTED]
tel: 1.866.CYNERGY
HYPERLINK "http://www.cynergysystems.com"http://www.cynergysystems.com
________________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Gordon
Smith
Sent: Thursday, April 06, 2006 4:04 PM
To: [email protected]
Subject: RE: [flexcoders] Re: Question to Adobe about Flex Framework 1.5 Code
Quality
Thanks, Ted. You've done a great job of explaining the benefits of the new
event system!
I just want to correct one thing, though. You said "Events that utilize the DOM
walk from the root of the DisplayList (your base class) to their target...".
This seems to confuse the distinction between the visual hierarchy of
DisplayObjects and the inheritance hierarchy of component classes and their
superclasses.
The root of the DisplayList is an instance of our SystemManager class. This is
where the capture phase of event dispatching starts, and where the bubbling
phase ends. But SystemManager isn't the base class for any of our components.
- Gordon
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Ted
Patrick
Sent: Thursday, April 06, 2006 10:34 AM
To: [email protected]
Subject: RE: [flexcoders] Re: Question to Adobe about Flex Framework 1.5 Code
Quality
The event system in Flash Player 8.5 is designed to handle 2 concepts:
1. Broadcasting events from Classes.
2. Broadcasting events through the DisplayList Tree.
The design choice was made to build this event based logic into the player for
performance reasons. As events run within the player they are 100 times faster
than the interpreted events in Flex 1.5 and are in context with the
DisplayList. Events that utilize the DOM walk from the root of the DisplayList
(your base class) to their target and then bubble back to the root (assuming
event bubbling == true for the event). Think of the event model as a 2 lane
road to the target, you can listen for events arriving on one lane, listen at
the target, or listen on the return trip to the root. At any point the events
or optionally cancelable.
Use of strings is pretty bogus complaint. With a strongly typed JIT
compilation, string comparison is lightning fast. Obviously uint might be
faster but then all dependency code would need to use CONSTANTS and this would
impose CONSTANT use on all developers. As is, using CONSTANTS is a best
practice and not required. This is also very useful for code being ported over
from Flex 1.5. As strings are supported, it makes for a very flexible model for
extension too (more on that in a sec...or see attached).
Actually it is hard to imagine that events could get much better than the
current design. It is extensible, customizable, fast, easy to work with, and
essentially lean and mean.
There is an especially handy concept that everyone should learn, see attached.
You can make any class dispatch a customized event easily! If you want your
application dispatch a fooEvent through a VBox you can make that happen easily:
import flash.events.*
myVbox.dispatchEvent ( new Event( 'fooEvent' , true, true ) );
// another reason string are handy, no fooEvent constant exists,
// yet I can make one.
Any listener subscribed from root to myVbox and back (bubbles) can listen for a
'fooEvent'. In the attached example, the fooEvent is captured up and down the
DisplayList tree.
That is an incredibly powerful concept and allows for deep customization and
extension of any class/component simply through this base event plumbing in the
Flash Player 8.5.
For example I extended an ArrayCollection recently. Using the base Events in
that class, I was able to dispatch custom events to any view component using
the custom collection as a dataProvider simply through the event API. Basically
I added a bunch of data to a custom collection and dispatched one event to
update a linked DataGrid or any list based control. Looking back, this was far
simpler because everything uses common event plumbing in the player. Actually
my extended class did little add a method for "addItems( data:Array )" and
broadcast an event to update the view.
Personally, DOM events might be one of the more hidden jewels in the Flex
2/Flash Player 8.5 release.
My 2 Cents,
Cynergy Systems, Inc.
Theodore Patrick
Sr. Consultant
[EMAIL PROTECTED]
tel: 1.866.CYNERGY
HYPERLINK "http://www.cynergysystems.com"http://www.cynergysystems.com
________________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Maxym
Sent: Thursday, April 06, 2006 11:42 AM
To: [email protected]
Subject: RE: [flexcoders] Re: Question to Adobe about Flex Framework 1.5 Code
Quality
Yeah, I can.
DOM Specification: The first goal is the design of an event system which allows
registration of event listeners and describes event flow through a tree
structure.
TREE STRUCTURE. So can you explain me why Timer extends EventDispatcher. Can
you imagine TREE STRUCTURE of Timers???
For real there are many bad things in this event model:
1. It's based on string identifiers. Because of this
a. It's slow
b. You don't know for real types of events that object can dispatch.
c. You can't use code-inside in editor for access events.
2. EventDispatcher and IEventDispatcher have too much extra functionality that
will be used only for visual objects.
3. If you want to dispatch events and you can't extend EventDispatcher you have
to duplicate (do you know some AOP concepts) it's logic (at least one time) and
implement IEventDispatcher.
4. I can say more but I'm tired of typing...
________________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Darron
J. Schall
Sent: Thursday, April 06, 2006 5:46 PM
To: [email protected]
Subject: Re: [flexcoders] Re: Question to Adobe about Flex Framework 1.5 Code
Quality
maxym.hryniv wrote:
> Looking at Flex 2 framework event model, and Flex 2 Framework UML
> (Flex 2 api visual reference by Rocket Boots) I don't believe that
> Flex 2 is better.
Can you be more specific? The event model is fundamentally part of the
player is an based on the DOM Level 3 Events specification [1].
-d
[1] HYPERLINK
"http://www.w3.org/TR/DOM-Level-3-Events/"http://www.w3.org/TR/DOM-Level-3-Events/
--
Flexcoders Mailing List
FAQ: HYPERLINK
"http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt"http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: HYPERLINK
"http://www.mail-archive.com/flexcoders%40yahoogroups.com"http://www.mail-archive.com/flexcoders%40yahoogroups.com
________________________________________
YAHOO! GROUPS LINKS
* Visit your group "flexcoders" on the web.
* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
________________________________________
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.5/302 - Release Date: 4/5/2006
--
Flexcoders Mailing List
FAQ: HYPERLINK
"http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt"http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: HYPERLINK
"http://www.mail-archive.com/flexcoders%40yahoogroups.com"http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
--
Flexcoders Mailing List
FAQ: HYPERLINK
"http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt"http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: HYPERLINK
"http://www.mail-archive.com/flexcoders%40yahoogroups.com"http://www.mail-archive.com/flexcoders%40yahoogroups.com
________________________________________
YAHOO! GROUPS LINKS
* Visit your group "flexcoders" on the web.
* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
________________________________________
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.5/302 - Release Date: 4/5/2006
--
Flexcoders Mailing List
FAQ: HYPERLINK
"http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt"http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: HYPERLINK
"http://www.mail-archive.com/flexcoders%40yahoogroups.com"http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
--
Flexcoders Mailing List
FAQ: HYPERLINK
"http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt"http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: HYPERLINK
"http://www.mail-archive.com/flexcoders%40yahoogroups.com"http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
HYPERLINK
"http://groups.yahoo.com/gads?t=ms&k=Web+site+design+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=L-4QTvxB_quFDtMyhrQaHQ"Web
site design development
HYPERLINK
"http://groups.yahoo.com/gads?t=ms&k=Computer+software+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=lvQjSRfQDfWudJSe1lLjHw"Computer
software development
HYPERLINK
"http://groups.yahoo.com/gads?t=ms&k=Software+design+and+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=1pMBCdo3DsJbuU9AEmO1oQ"Software
design and development
HYPERLINK
"http://groups.yahoo.com/gads?t=ms&k=Macromedia+flex&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=OO6nPIrz7_EpZI36cYzBjw"Macromedia
flex
HYPERLINK
"http://groups.yahoo.com/gads?t=ms&k=Software+development+best+practice&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=f89quyyulIDsnABLD6IXIw"Software
development best practice
_____
YAHOO! GROUPS LINKS
* Visit your group "HYPERLINK
"http://groups.yahoo.com/group/flexcoders"flexcoders" on the web.
* To unsubscribe from this group, send an email to:
HYPERLINK "mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED]
* Your use of Yahoo! Groups is subject to the HYPERLINK
"http://docs.yahoo.com/info/terms/"Yahoo! Terms of Service.
_____
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.5/302 - Release Date: 4/5/2006
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.5/302 - Release Date: 4/5/2006
--
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
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/