Solved

as3 droptarget

Posted on 2011-09-21
8
1,586 Views
Last Modified: 2013-11-11
I'm doing a drag and drop interaction.  The very basic code is

function mouseDown(event:MouseEvent):void
{
	event.currentTarget.startDrag();
}


function mouseReleased(event:MouseEvent):void
{
	event.currentTarget.stopDrag();
	if (event.currentTarget.dropTarget != null)
	{		
		event.currentTarget.x = event.currentTarget.dropTarget.parent.x;
		event.currentTarget.y = event.currentTarget.dropTarget.parent.y;
	}	
}

Open in new window


I'll have several draggable objects and droptargets.  Now the problem I have is if a given droptarget already has something dropped on it, it shouldn't allow anything else to be dropped on it ie. "disabled".  If I drag the object off of it, that particular target would need to be "enabled" again.  Haven't come up with any idea on how to do this.

Oh yeah, all the draggable objects are able to be dropped on all of the droptargets.  I'll evaluate whether the correct objects have been dropped on the correct targets later.
0
Comment
Question by:moglie
8 Comments
 
LVL 29

Accepted Solution

by:
dgofman earned 500 total points
ID: 36577626
If you are using DragManager class

http://livedocs.adobe.com/livecycle/8.2/programLC/common/langref/mx/managers/DragManager.html

You should control all your drop target(s) by acceptDragDrop API

http://livedocs.adobe.com/flex/3/html/dragdrop_7.html
0
 

Author Comment

by:moglie
ID: 36577691
Not using Flex or any ui components.  The draggable objects and droptargets are just movieclips.
0
 
LVL 29

Assisted Solution

by:dgofman
dgofman earned 500 total points
ID: 36577704
But DragManager is not for Flex is ActionScript 3 class.

Check this example its pure AS

http://icodesnippet.com/snippet/actionscript-3/as3-drag-n-drop
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 29

Expert Comment

by:dgofman
ID: 36577733
Check this tutorial it will tell you basic steps

http://www.youtube.com/watch?v=ALqGYMsRWxw
0
 
LVL 29

Expert Comment

by:dgofman
ID: 36577739
and in step 2 showing how to control drop target

http://www.youtube.com/watch?NR=1&v=1hR3CVIdfuY
0
 
LVL 10

Expert Comment

by:Carnou
ID: 36581721
Why not simply add a flag to the drop target that says there is something dropped in it? MovieClips are dynamic; you can create a new field and check to see if it exists and is set in your MouseDown event.
0
 
LVL 37

Expert Comment

by:CyanBlue
ID: 37337072
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Download slideshow or picture elements 16 437
Crash with shockwave flash 8 245
Flash player 17 install script .bat or .vbs 9 542
embedding a media live encoder stream 3 133
This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question