[Xerte-dev] Re: Event horizon

Julian Tenney Julian.Tenney at nottingham.ac.uk
Tue Jun 18 15:56:41 BST 2013


It';s one of the limitations in AS2 that events can only have one listener:

myObject.onRollOver = function(){
  //do stuff
}

You cannot add further listeners to the onRollOver event. So if you later assign myObject.onRollOver = anotherFunction() you over write the orginal one yes.

rootIcon.onKeyPress is an attempt to work around that because it can persist and you can use flags etc to work out what to do. The actual events are onKeyDown and onKeyUp which you can listen for on individual icons, rather than rootIcon.

Either way around, without addEventListener which came later, it's limited.

From: xerte-dev-bounces at lists.nottingham.ac.uk [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett
Sent: 18 June 2013 15:50
To: xerte-dev at lists.nottingham.ac.uk
Subject: [Xerte-dev] Event horizon


I have a text entry that uses an onKeyPress/rootIcon event setup to evaluate each key as it is pressed.

Now, there is a help screen that the user can invoke, and to dismiss it they can "Press any Key".
That also traps for the onKeyPress/rootIcon event

Of course, my text entry now stops functioning.
Once an event is re-used is the original gone?
Can a keypress event iconid be more local?
(I've never got it to work with anything but rootIcon as the broadcaster).

Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte-dev/attachments/20130618/45be057f/attachment.html>


More information about the Xerte-dev mailing list