• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Click and Hold

The file “08_click_and_hold.fla” should let the user either click once or click and hold to move the box left and right. It used to work fine when there was just a forward and backward button (which reacted to single clicks). After I added the click-and-hold feature and moved some code around, however, the single-click feature stopped working. Although there are a number of ways to fix the single-click buttons, try to do so without making a new function. That is, I don’t want another version of the moveBox() function.

Hint

Again, the fix in this file is related to the keyword this. That is, notice that moveBox() is triggered both as a regular function and as an onEnterFrame callback. Try placing the script trace(this); somewhere inside the moveBox() function for a clue.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint