 |

Dragable Objects
Now you've created an object which the user can drag around pointlessly. So what? It's time to add some action.
6.
Press Ctrl+F8 and create a new Movie Clip named HoleClip. This will be the symbol that the ball will react to when dropped on.
Now, create or import the HoleClip symbol.
7.
When the HoleClip symbol is finished, go back to the Scene 1 with the dragable ball. Create a new scene layer , and then drag it under the first layer, and name it Hole. Open the Library window Ctrl+L, and drag HoleClip onto the new layer.
8.
Double click on the HoleClip symbol in the scene, and set the Instance name to Hole, as well.
9.
Open the Library window Ctrl+L, and double click on the DragBall symbol to edit it it. Now, double click on the ball in the editing screen to open up the Instance Properties window, and go to the Actions Tab.
10.
This is where it gets a little bit tricky. Click on the End On of the Stop Drag operation, and add an If () action.
Click on the button to the right of the Condition text box and enter the Expression Editor.
11.
In the Functions box, scroll down and double click on GetProperty. This will add
GetProperty (target, property)
to the expression box. Change it to:
GetProperty ("/Ball", _droptarget) eq "/Hole"
Press OK to exit the expression editor.
12.
Inside the If statement, add whatever action you want flash to do after you drop Ball into Hole.
The rest of the tutorial will show you how to make the Ball disappear, and then skip to the next scene.
Add a Set Property action inside the If statement. Change the Set to Visibility and the Target to /Ball. Put 0 in the value box.
This tells the symbol instance named Ball to become invisible after it is dropped inside Hole.
Press OK to exit the Instance Properties window.
13.
Go back to the Scene 1. Holding down Shift select both layers, and then press F5 to add one new frame to each layer.
Create a new layer , and rename it Actions. Select frame 2 on this layer, and then press F6 to add a new keyframe. Double click on the new keyframe, and then go to the Actions tab.
Add a Go To action. Keep the Scene on current scene and the frame number 1, but select Go to and Play.
Press OK to exit the Frame Properties.
This will keep the scene constantly looping, on two frames.
14.
Double click on the first keyframe on the Actions layer, and go to the Actions tab. Add an If() statement, click on the button next to the condition box, and enter the Expression Editor.
Scroll down the functions box, and double click on the GetProperty function to add it.
This will add
GetProperty ( target, property )
to the expression. Change it to read:
GetProperty ( "/Ball", _visible ) = 0
Press OK to exit the Expression Editor.
16.
Inside the If statement, add a Go To action. Change the scene to Next Scene and press OK.
In the menu go:
Insert > Scene and have fun!
How this actually works is that the scene is constantly looping on two frames. The first frame tests to make sure the Ball is visible, and frame 2 tells it to go back to frame 1, and loop. As soon as you drag the Ball into the Hole, the Ball becomes invisible, and it fails the visibility test on frame 1. This causes it to execute the Next Scene action, or whatever other action you want to put in there.
|
|