[Flashcoders] Drag and drop in AS3

2008-09-23 Thread Lord, Susan, CTR, DSS
Hi there,

I am programming a drag and drop using a instance array.   The problem I
am having is that the instances have dynamic text within them.  I am
trying to track what symbol the user clicked so that I can drag that
instance.  Well... sometimes, the program registers the button name, and
sometimes it registers the text within the button.  Is there a clean way
to prevent this from happening?

Any help you can provide is appreciated!  

Thanks!
Susan

~~

var aButtons:Array  = new Array(b0, b1, b2, b3);
aButtons[0].txDrag.text= Drag 1;
aButtons[1].txDrag.text= Drag 2;
aButtons[2].txDrag.text= Drag 3;
aButtons[3].txDrag.text= Drag 4;

//var _rectangle:Sprite;
var i:Number;


for (i= 0; i  aButtons.length; i++) {
aButtons[i].addEventListener(MouseEvent.MOUSE_DOWN,
startDragging);
aButtons[i].addEventListener(MouseEvent.MOUSE_UP, stopDragging);

}



function startDragging(event:MouseEvent):void {
var count:Number = aButtons.length;
var index:Number;
trace(event.target.name)
for (i = 0; i  count; i++) {
if (evt.target.name == aButtons[i].name ) {
//drag code to be added...
aButtons[i].startDrag();
}



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Drag and drop in AS3

2008-09-23 Thread Glen Pike

Hi,

   Try something like the following - choose one or the other depending 
on your implementation...


//loop...
aButtons[i].mouseChildren = false;
//or
aButtons[i].text.mouseEnabled = false;

HTH

Glen

Lord, Susan, CTR, DSS wrote:

Hi there,

I am programming a drag and drop using a instance array.   The problem I
am having is that the instances have dynamic text within them.  I am
trying to track what symbol the user clicked so that I can drag that
instance.  Well... sometimes, the program registers the button name, and
sometimes it registers the text within the button.  Is there a clean way
to prevent this from happening?

Any help you can provide is appreciated!  


Thanks!
Susan

~~

var aButtons:Array  = new Array(b0, b1, b2, b3);
aButtons[0].txDrag.text= Drag 1;
aButtons[1].txDrag.text= Drag 2;
aButtons[2].txDrag.text= Drag 3;
aButtons[3].txDrag.text= Drag 4;

//var _rectangle:Sprite;
var i:Number;


for (i= 0; i  aButtons.length; i++) {
aButtons[i].addEventListener(MouseEvent.MOUSE_DOWN,
startDragging);
aButtons[i].addEventListener(MouseEvent.MOUSE_UP, stopDragging);

}



function startDragging(event:MouseEvent):void {
var count:Number = aButtons.length;
var index:Number;
trace(event.target.name)
for (i = 0; i  count; i++) {
if (evt.target.name == aButtons[i].name ) {
//drag code to be added...
aButtons[i].startDrag();
}



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


  


--

Glen Pike
01326 218440
www.glenpike.co.uk http://www.glenpike.co.uk

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Drag and drop in AS3

2008-09-23 Thread Matt S.
I find that sometimes if the font for the dynamic text isnt embedded
it can cause weird mouseover issues, where the mouse is affected by
the dynamic text, even if I set mouseChildren and mouseEnabled to
false.

2¢...

.m

On Tue, Sep 23, 2008 at 10:58 AM, Lord, Susan, CTR, DSS
[EMAIL PROTECTED] wrote:
 Hi there,

 I am programming a drag and drop using a instance array.   The problem I
 am having is that the instances have dynamic text within them.  I am
 trying to track what symbol the user clicked so that I can drag that
 instance.  Well... sometimes, the program registers the button name, and
 sometimes it registers the text within the button.  Is there a clean way
 to prevent this from happening?

 Any help you can provide is appreciated!

 Thanks!
 Susan

 ~~

 var aButtons:Array  = new Array(b0, b1, b2, b3);
 aButtons[0].txDrag.text= Drag 1;
 aButtons[1].txDrag.text= Drag 2;
 aButtons[2].txDrag.text= Drag 3;
 aButtons[3].txDrag.text= Drag 4;

 //var _rectangle:Sprite;
 var i:Number;


 for (i= 0; i  aButtons.length; i++) {
aButtons[i].addEventListener(MouseEvent.MOUSE_DOWN,
 startDragging);
aButtons[i].addEventListener(MouseEvent.MOUSE_UP, stopDragging);

 }



 function startDragging(event:MouseEvent):void {
var count:Number = aButtons.length;
var index:Number;
trace(event.target.name)
 for (i = 0; i  count; i++) {
if (evt.target.name == aButtons[i].name ) {
//drag code to be added...
aButtons[i].startDrag();
 }



 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Drag and drop in AS3

2008-09-23 Thread Gerry

Susan,
Try...

aButton[i].buttonMode = true;
aButtons[i].mouseChildren = false;



On Sep 23, 2008, at 10:58 AM, Lord, Susan, CTR, DSS wrote:


Hi there,

I am programming a drag and drop using a instance array.   The  
problem I

am having is that the instances have dynamic text within them.  I am
trying to track what symbol the user clicked so that I can drag that
instance.  Well... sometimes, the program registers the button name,  
and
sometimes it registers the text within the button.  Is there a clean  
way

to prevent this from happening?

Any help you can provide is appreciated!

Thanks!
Susan

~~

var aButtons:Array  = new Array(b0, b1, b2, b3);
aButtons[0].txDrag.text= Drag 1;
aButtons[1].txDrag.text= Drag 2;
aButtons[2].txDrag.text= Drag 3;
aButtons[3].txDrag.text= Drag 4;

//var _rectangle:Sprite;
var i:Number;


for (i= 0; i  aButtons.length; i++) {
aButtons[i].addEventListener(MouseEvent.MOUSE_DOWN,
startDragging);
aButtons[i].addEventListener(MouseEvent.MOUSE_UP, stopDragging);

}



function startDragging(event:MouseEvent):void {
var count:Number = aButtons.length;
var index:Number;
trace(event.target.name)
for (i = 0; i  count; i++) {
if (evt.target.name == aButtons[i].name ) {
//drag code to be added...
aButtons[i].startDrag();
}



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [BULK] Re: [Flashcoders] Drag and drop in AS3

2008-09-23 Thread Lord, Susan, CTR, DSS
aButtons[i].mouseChildren = false; worked like a charm! 

Thanks!


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gerry
Sent: Tuesday, September 23, 2008 11:23 AM
To: Flash Coders List
Subject: [BULK] Re: [Flashcoders] Drag and drop in AS3
Importance: Low

Susan,
Try...

aButton[i].buttonMode = true;
aButtons[i].mouseChildren = false;



On Sep 23, 2008, at 10:58 AM, Lord, Susan, CTR, DSS wrote:

 Hi there,

 I am programming a drag and drop using a instance array.   The  
 problem I
 am having is that the instances have dynamic text within them.  I am
 trying to track what symbol the user clicked so that I can drag that
 instance.  Well... sometimes, the program registers the button name,  
 and
 sometimes it registers the text within the button.  Is there a clean  
 way
 to prevent this from happening?

 Any help you can provide is appreciated!

 Thanks!
 Susan

 ~~

 var aButtons:Array  = new Array(b0, b1, b2, b3);
 aButtons[0].txDrag.text= Drag 1;
 aButtons[1].txDrag.text= Drag 2;
 aButtons[2].txDrag.text= Drag 3;
 aButtons[3].txDrag.text= Drag 4;

 //var _rectangle:Sprite;
 var i:Number;


 for (i= 0; i  aButtons.length; i++) {
   aButtons[i].addEventListener(MouseEvent.MOUSE_DOWN,
 startDragging);
   aButtons[i].addEventListener(MouseEvent.MOUSE_UP, stopDragging);

 }



 function startDragging(event:MouseEvent):void {
   var count:Number = aButtons.length;
   var index:Number;
   trace(event.target.name)
 for (i = 0; i  count; i++) {
   if (evt.target.name == aButtons[i].name ) {
   //drag code to be added...
   aButtons[i].startDrag();
 }



 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Drag and drop in AS3

2008-09-23 Thread Ashim D'Silva
When you recieve an event the difference between event.currentTarget and
event.target could be of much help. I can never remember which is which but
check the language reference. But nothing like disabling the childrens mouse
events with mouseChildren = false;

2008/9/24 Matt S. [EMAIL PROTECTED]

 I find that sometimes if the font for the dynamic text isnt embedded
 it can cause weird mouseover issues, where the mouse is affected by
 the dynamic text, even if I set mouseChildren and mouseEnabled to
 false.

 2¢...

 .m

 On Tue, Sep 23, 2008 at 10:58 AM, Lord, Susan, CTR, DSS
 [EMAIL PROTECTED] wrote:
  Hi there,
 
  I am programming a drag and drop using a instance array.   The problem I
  am having is that the instances have dynamic text within them.  I am
  trying to track what symbol the user clicked so that I can drag that
  instance.  Well... sometimes, the program registers the button name, and
  sometimes it registers the text within the button.  Is there a clean way
  to prevent this from happening?
 
  Any help you can provide is appreciated!
 
  Thanks!
  Susan
 
  ~~
 
  var aButtons:Array  = new Array(b0, b1, b2, b3);
  aButtons[0].txDrag.text= Drag 1;
  aButtons[1].txDrag.text= Drag 2;
  aButtons[2].txDrag.text= Drag 3;
  aButtons[3].txDrag.text= Drag 4;
 
  //var _rectangle:Sprite;
  var i:Number;
 
 
  for (i= 0; i  aButtons.length; i++) {
 aButtons[i].addEventListener(MouseEvent.MOUSE_DOWN,
  startDragging);
 aButtons[i].addEventListener(MouseEvent.MOUSE_UP, stopDragging);
 
  }
 
 
 
  function startDragging(event:MouseEvent):void {
 var count:Number = aButtons.length;
 var index:Number;
 trace(event.target.name)
  for (i = 0; i  count; i++) {
 if (evt.target.name == aButtons[i].name ) {
 //drag code to be added...
 aButtons[i].startDrag();
  }
 
 
 
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




-- 
The Random Lines
My online portfolio
www.therandomlines.com
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders