Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: RE: FLASH: Drag and drop
From: Eric Smollin
Date: Wed, 9 Feb 2000 20:58:55 GMT

>In a quiz I want to use drag and drop, so that users can drag the correct
>answer into a gap in a flow diagram. The problem comes with checking which
>answer they selected. I don't want to add another button that checks the
>answer. Should I use the x,y co-ords or is there a simpler way.


You might want to describe your situation a little more in-depth. From what
I hear, you could use the _droptarget feature to check if the correct answer
was dragged onto the correct target. Here is an example.

On your main timeline you have several possible targets, each are MC's with
an Instance Name of Target1, Target2, Target3, etc...

You also have the draggable objects. Each one of these is also a MC, and
each contains a button in the first frame. On the first keyframe of this MC,
set the original position of the object:

Set Variable: "OrgX" = GetProperty ("", _x )
Set Variable: "OrgY" = GetProperty ( "", _y )

On the second keyframe of the MC, insert a Stop action and change the
definition of the button from Button to Graphic. You'll see why in a minute.

Each button will contain the following code:

On (Press)
Start Drag ("")
End On
On (Release)
Stop Drag
If (_droptarget eq "/Target1")
Go to Next Frame
Else
Set Property ("", Y Position) = OrgY
Set Property ("", X Position) = OrgX
End If
End On

If the user drops an answer on the correct target, the playhead will advance
to the next frame which contains a stop action and the image as a graphic
symbol (so it is no longer clickable). If an answer is dropped on the wrong
target, it will snap back to its original position (orgX and orgY).

Send me an email OFF LIST if you would like me to whip up an example FLA for
you.

Good Luck
-Eric-


flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flashforward2000 and The Flash Film Festival
"The World�s Premier Flash Solutions Conference and Expo"
March 27-29, Nob Hill Masonic Center, San Francisco, California

-Register before Feb 25 and save $200!!-- www.flashforward2000.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com


[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]