[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

as3 droptarget

Posted on 2011-09-21
8
Medium Priority
?
1,636 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 29

Accepted Solution

by:
dgofman earned 2000 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 2000 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

649 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