Skip to main content
kbertan
Known Participant
June 5, 2008
Question

return event.currentTarget. name

  • June 5, 2008
  • 2 replies
  • 568 views
hi, i'm trying to get the target name of a mouse event and trace it in another function. when i try to trace the name within the frameForward function, it succeeds, but it fails to do the same in the checkSwatches function. any ideas? thank you.


This topic has been closed for replies.

2 replies

kbertan
kbertanAuthor
Known Participant
June 5, 2008
thanks a lot. i added the event listener to checkSwatches and just traced the currentTarget from there. didn't need to bother with frameForward.
Inspiring
June 5, 2008
checkSwathces does the right thing. First of all you, in order for it to "trace" target it has to be a listener of the mouse event like the frameForward function is AND you have to pass the event into it. In your case since there is no event - there is no target.

Secondly, even if you made checkSwatches a listener and passed an event - it would still trace "function frameForward () {}" In plain language your syntax asks "What is frameForwad?" not "Execute frameForward" - naturally it gives the correct answer "It is a function." In order to trace what the function returns you have to use a syntax: trace(frameForward(e:MouseEvent)) because frameForward function expects the event.

Hope it is clear.