How to Make Drag & Drop Flash Games

How to Make Drag & Drop Flash Games thumbnail
Create an interactive game using Flash drag and drop.

Adobe Flash makes it possible for you to produce multimedia projects including animation and games. Flash's drag and drop methods provide you with the basis for creating an interactive game in which your users can move objects around. Use the following example to understand these methods, and as a foundation which you can build upon to make your own drag and drop games.

Instructions

    • 1

      Open Adobe Flash and create a new file. Select "File" and then "New" from the menu at the top. In the resulting window, choose "Flash File (Actionscript 2.0)." Click "OK." The following example will output "CORRECT!" when the user places the ball within the box.

    • 2

      Create a movie clip of a blue box. Change the "Fill" color to blue, using the "Tools" panel. Draw a box using the "Rectangle" tool. Use the "Selection" tool (arrow) and double-click the box to select it. Press "F8" and then "OK." Set the "<Instance Name>" field of the "Properties" panel to "blueBox."

    • 3

      Create a movie clip of a red ball. Change the "Fill" color to red. Draw a ball using the "Oval" tool. Double-click the ball to select it. Press "F8" and then "OK." Set the "<Instance Name>" to "redBall."

    • 4

      Press "F9" to open the "Actions" window and type the following data:

      redBall.onPress = function() {

      this.startDrag();

      }

      redBall.onReleaseOutside = redBall.onRelease = function() {

      this.stopDrag();

      // if redBall is dragged onto blueBox

      if(this._droptarget == "/blueBox") {

      trace("CORRECT!");

      }

      }

    • 5

      Test the animation by pressing "Ctrl" and "Enter" simultaneously.

Related Searches:

References

  • Photo Credit 3d tic tac toe game board image by Brent Walker from Fotolia.com

Comments

You May Also Like

Related Ads

Featured