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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to