Hi Matt and all,

Thanks for the clarification. I know you guys are busy;)

The DOM thing, "target" and "currentTarget" make sense. If a button or
its parent container registers interest in a mouse click event, either
the button or its container becomes "currentTarget" while the button
is the "target" at bubbling propagation.

In Flex/Flash, things like SystemManager (which is instantiated by
Application and which inherits from flash.display.MovieClip) can also
register its interest in any UIComponent(not stylized skins that are
drawn by the drawing API), which as Matt says will "broadcast" the
event(i.e., call the event handlers). In this case, "currentTarget" is
the systemManager and "target" can be the visual stuff or the loader
of the visual content "under" the stage who is the source of the event.

Geng
--- In flexcoders@yahoogroups.com, Matt Chotin <[EMAIL PROTECTED]> wrote:
>
> For one thing, target comes a little bit from the W3C DOM event
model. It was standard naming for that I believe.
> 
> Target represents the object on which can be thought of as having
originally broadcast the event.  Whomever mentioned the UI part of it
is right on.  When you think of the MouseEvent CLICK, the target is
the actual display object that was clicked on.  CurrentTarget is
useful when you're dealing with event propagation, it reflects the
object that is currently broadcasting the event.  For example, if a
button was clicked on but that button lives within a container, the
container may dispatch the CLICK event via bubbling.  Basically
indicating that something within it was clicked. In that case,
currentTarget is the container, target is the original button that was
clicked.
> 
> I agree source might be a better name, but I think the UI aspect of
it kind of held.
> 
> Matt
> 
> 
> On 9/24/08 3:04 PM, "gwangdesign" <[EMAIL PROTECTED]> wrote:
> 
> 
> 
> 
> I just read the documentation for Flex, "The Event Flow":
> 
> "Flash Player or AIR dispatches event objects whenever an event
> occurs. If the event target is not on the display list, Flash Player
> or AIR dispatches the event object directly to the event target. For
> example, Flash Player dispatches the progress event object directly to
> a URLStream object. If the event target is on the display list,
> however, Flash Player dispatches the event object into the display
> list, and the event object travels through the display list to the
> event target."
> 
>
http://livedocs.adobe.com/flex/3/html/help.html?content=16_Event_handling_4.html
> 
> It looks to me like, in the case in which they mention above, "Flash
> Player" or "AIR" becomes the source who dispatches the event object
> and the event target is actually the one that "listens" to the event.
> Does this "target" term then sound something that makes more sense to
> lower level programming (such as Flash Player engineers?)? From an API
> user's point of view, an event source is only "source" anyways...
> 
> Thanks.
> 
> --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> , Samuel Colak <sam.colak@> wrote:
> >
> > Umm....
> >
> > You have "currentTarget" and "target" - most of the time, these return
> > very different
> > values depending on what happened ...
> >
> > On Sep 24, 2008, at 11:14 PM, Chuck Preston Jr. wrote:
> >
> > > For the same reason tree structures are upside down, with their
> > > roots at the top. ActionScript
> > > is from the Bizzaro world.
> > >
> > > --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> , "gwangdesign" <gwangdesign@>
> > > wrote:
> > > >
> > > > Hi,
> > > >
> > > > I am just wondering why, in ActionScript, the subject of an
event is
> > > > called a "target"? Is it kind of counter intuitive? In Java, it is
> > > > called "source", which sounds much more understandable to me.
> > > >
> > > > Thanks.
> > > >
> > >
> > >
> > >
> >
>


Reply via email to