Animation

  1. Home
  2. Computing & Technology
  3. Animation

Custom Christmas Tree Ornaments that Move with Drag & Drop or Arrow Keypresses

By Adrien-Luc Sanders, About.com

1 of 9

This lesson is similar to the series of lessons on creating a snowman with drag-and-drop parts that you could add and remove at will (and in fact, that’s where I snitched the trees from, while the falling snow came from another lesson). However, this time we’ll add new depth to the level of interactivity; not only will users be able to click and drag on ornaments to decorate the tree with their mouse, they’ll also be able to guide selected ornaments using the arrow keys on a standard keyboard in order to nudge them into just the right spot.

We’ll use something new for this: Key.isDown, a function that checks to see if a key is pressed. When used in tandem with an if statement and other Key.parameter functions, it can be used to determine motion based on keypresses.

Explore Animation

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

Animation

  1. Home
  2. Computing & Technology
  3. Animation
  4. Flash Animation Tutorials
  5. Custom Christmas Tree Ornaments that Move with Drag & Drop or Arrow Keypresses

©2009 About.com, a part of The New York Times Company.

All rights reserved.