Flasher Archive
[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]
Subject: | RE: FLASH: setting up "drop targets" in flash |
From: | Eric Smollin |
Date: | Mon, 17 Jan 2000 22:16:45 GMT |
>I'm trying to set up a multiple choice game that
>would require a user to drag and drop a ball into
>a specific area. I have figured out how to set up
>the drag part (thanks to the FlashLite site), but now
>I am wondering if there is a way to set it up so a movie
>would recognize where the ball has been dropped.
Here is the basic idea.
you have your draggable objects (an MC with a button inside) and your
dropTarget areas (also MC's).
The buttons inside the draggable MC's will have some ActionScript, e.g.:
On (Press)
Start Drag (GetProperty(_x, _y))
End On
On (Release)
Stop Drag
If (_droptarget eq "Target")
Set Property ("", Y Position) = Target:_y
Set Property ("", X Position) = Target:_x
Go to Next Frame
Begin Tell Target ("/whereEver")
Go to Next Frame
End Tell Target
Else
Set Property ("", Y Position) = OrgY
Set Property ("", X Position) = OrgX
End If
End On
In the example above, "Target" would be the Instance Name of the movie clip
that is the desired target area on the stage. If the object is in the
designated area, perform whatever action, in the example above it is a tell
target action. You'll notice the script in the Else statement. This snaps
the object back to it's position if it is dropped in an area other than the
desired dropTarget. OrgX and OrgY are variables set in the first keyframe of
the drag MC indicating the original positions of the objects.
Hope this helps, shoot me an email OFF-LIST if you would like me send you an
example.
Good Luck
-Eric-
flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Streaming Media WEST '99 Conference & Exhibition
"The Worlds largest Internet Audio & Video Event"
December 7 - 9, San Jose Convention Center, California
Reserve your space today at http://www.streamingmedia.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpchinwag [dot] com
[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]