Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player


Summary:

Add Code for each Draggable Item in Flash

    ●   Copy your existing code and duplicate it for each Draggable item in Flash.


Learn About:

Actionscript 3 Movie Clips Keyframes Actions Panel

  •   This is the 2nd tutorial in the Drag and Drop Project.

 


1 - Beginning Code    2 - Draggable Items    3 - Origin Code  4 - Reset Button    5 - Target Dropzone     6 - Sound  


Other People's Work:

Here are examples of work inspired by this tutorial.

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player


Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player


Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

 

Step #1: Your 2nd Draggable Item in Flash ~

Hopefully you've done this tutorial first

Click your 2nd draggable item.

character image

Make a Movie Clip out of your draggable item by highlighting it and hitting F8 and call it item2_mc

Make sure you type the name PERFECTLY item2_mc


Step #2: Name the Instance - AGAIN ~

In the Properties menu set the instance name:

instance name

Name the instance:


Step #3: View the Actionscript ~

Click on your Actions and Labels keyframe keyframe actions

… hit Alt (⌥) F9 f9 - and open the Actions panel …

this is the code


Step #4: Add some Space ~

Then hit Enter several times to clear some space …

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player


Step #5: Copy the Code ~

Copy the first 2 lines of code and paste it below with a space in between …

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

Then change the code to item2_mc like this …

change the number


Step #6: See if it Works!

Hit Cmd () + Enter cmd enter key and move your object!

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player


Step #7: Wash, Rinse and Repeat ~

Each draggable item must be:

‣ Turned into a Movie Clip (F8) movie clip small

‣ Changed Instance Name instance name small

‣ Add 2 new lines of code for each draggable item in the Actions and Labels panel


multiple items code

 

 

Again, if you've got only 3 draggable objects, you will need to remove EVERYTHING referencing item4_mc, item5_mc, item6_mc and item7_mc

 

If you've got MORE than 7 items, you will have to add those accordingly.


If you're ready, keep working on your Origin Code …


Last Step: Save and View your work ~

View your work by hitting the keyboard shortcut: Cmd(⌘)+Enter cmd enter

Save your work as - FIRST_NAME_LAST_NAME_PROJECT_NAME.fla]

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

 

•   ALWAYS save your projects using the following naming convention:
FIRST_NAME_LAST_NAME_PROJECT_NAME


  •   DO NOT name your project any other way - Improperly named projects will not receive credit and you will be sad.


  •   NEVER leave your work on the desktop or depend on a flash drive - instead, save your work in a folder you can find later - preferably on a virtual drive where it can be backed up.


Other Resources: http://www.danfergusdesign.com/classfiles/oldClasses/VCB324-richMedia2/exercises/matchingGame.php