A Flash Paint Application

The Paint Function

Now we'll create a function that attaches an instance of our paint MovieClip whenever it's called. First, return to Scene 1 before you do anything! It's amazingly common for novice Flash programmers to make the mistake of placing actions inside the MovieClip they're referencing. So, please return to Scene 1, and rename Layer 1 Actions:

Now that we're starting on the right foot, let's declare a variable called count with a Number data type:

OK, now let's create a paint function:

function paint () {
}

If you've been following along with the previous exercises, this should't be much of a stretch for you. We're going to need to do the following:

  1. Increment the count variable
  2. Attach an instance of the paint MovieClip
  3. Create a reference for our new MovieClip
  4. Set the _x position of the clip equal to _xmouse
  5. Set the _y position of the clip equal to _ymouse

That's it for the paint function! Nothing will happen until we call that function.