O'Reilly logo

HTML5 for Flash Developers by Matt Fisher

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

JavaScript events

As with most languages, events are what really brings an application to life. Without the use of events, programs would usually just run from start to finish without the need for human interaction. JavaScript events are built around the asynchronous event model. Rather than checking continually to see if a condition is met, events can use call-back structures, like in ActionScript, to execute code once an event has been fired. A great example of this, which you may have already seen in many other examples thus far:

window.addEventListener("load", init, false);

We use this Event Listener on the window object to allow our code to determine when the window object will finish loading, so that we can call our initial method to begin ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required