Posted by Unknown 0 komentar
Download free Flash Tutorial Creating Listeners Dynamically pdf. This program draws a randomized grid of squares that the user can click on. Each square is a movie clip that needs to have a listener to handle the user clicking on it. The tricky part is that the listener needs to change not only the color of the square that was clicked on, but also the colors of the adjacent squares. In effect, the listener needs more than just a link to the object that was clicked on. It needs to know which squares are adjacent to that object as well.

However, the general structure of these listeners should all be the same. That is, once the program knows which square was clicked on, it will handle this click in pretty much the same way for each square. So we really don’t want to manually write essentially the same listener a bunch of times. Instead, we’ll have our Flash program define the listeners on the fly.

Before we get started, the only things initially on the stage are btnNewGame (a button) and tbDoneText (a dynamic text box that is initially blank). The first thing we need to do is create setup procedures to create an initial game for the user, and erase the current game and create a new game when the user clicks the “New Game” button.


0 komentar:

Post a Comment