Is your target a movieClip with a graphic inside?
Try this...
for (index= 0; index < count; index++) {
trace(aButtons[index].dropTarget.parent);
}
gregb
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Lord,
Susan, CTR, DSS
Sent: Thursday, September 25, 2008 4:03 PM
To: Flash Coders List
Subject: RE: [Flashcoders] Problems creating a drag and drop
Nevermind my last message... that was not the problem. The problem is my
hit test. When I add the following code to determine whether the object
is over the target, everything stops working:
for (index= 0; index < count; index++) {
trace(aButtons[index].hitTestObject(dropSpots[index]));
}
Even having it in there as a simple trace messes things up. Any ideas
on how to accommodate the hitTest? Is there a different way to do a hit
test in AS3?
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Lord,
Susan, CTR, DSS
Sent: Thursday, September 25, 2008 4:43 PM
To: Flash Coders List
Subject: RE: [Flashcoders] Problems creating a drag and drop
Thanks for all of your suggestions. I ended up restructuring the code
and adding the event listeners for the mouse up to the stage instead and
took them out of the array. It seems to be working well (as long as I
keep my mouse on the stage). I am very happy to have a working model!
If anyone has any ideas for the occasion when the user moves the mouse
off stage, that would be great! One sample I saw had the following in
the stopDrag code -- if (event.target == circle ||
circle.contains(event.target))--- But the contains code did not work for
me.
Below is my current code. Again thanks!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
for (i= 0; i < count; i++) {
aButtons[i].addEventListener(MouseEvent.MOUSE_DOWN,
startDragging);
aButtons[i].mouseChildren = false;
}
function startDragging(event:MouseEvent):void {
for (i= 0; i < count; i++) {
if (event.target == aButtons[i] ) {
trace("start dragging");
aButtons[i].startDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP,
stopDragging);
}
}
function stopDragging(event:MouseEvent):void {
for (i= 0; i < count; i++) {
if (event.target == aButtons[i] ) {
trace("stop dragging");
aButtons[i] .stopDrag();
}
}
stage.removeEventListener(MouseEvent.MOUSE_UP, stopDragging);
}
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders