[flexcoders] Re: How to restrict Drag and Drop to one axis? (like the X-Axis only)

2009-08-21 Thread transdimensionalmachine_elf

Unfortunately this only worked for locking to the X-Axis.

Meaning you can only drag something left and right but not up and down.


The problem now is I cannot restrict dragging left/right.


This is because the DragProxy and it's children don't seem to report valid 
widths.

Whenever I trace it out the width's are 0.

Also the coordinate space of the dragProxy doesn't seem to sync with anything 
else in the app.

Even when I use dragProxy.systemManager.topLevelSystemManager.localToGlobal().



The DragProxy seems to set it's own position internally using 
DisplayObject(sandboxRoot).globalToLocal(stagePoint);

But sandboxRoot is not accessible outside of DragProxy and I have no idea what 
it actually references.




Any ideas?


All I am trying to do is limit how far you can drag the dragProxy left and 
right so that it cannot be dragged outside the bounds of the list it is being 
dragged from.




Thanks
--Kelly























--- In flexcoders@yahoogroups.com, Archibald dek...@... wrote:

 
 By doing this on the highest level UIComponent I could access I was able to 
 lock it to one access even when dragging outside of the target container.
 
 
 Unfortunately it only worked up to the highest level component within a 
 Module.
 
 
 It did not work when added to a component in the main app when the target 
 container is inside of a module.
 
 
 
 
 
 
 
 --- In flexcoders@yahoogroups.com, Archibald dekayd@ wrote:
 
  
  I found a way to kindof do this.
  
  
  It's not perfect but I guess it's acceptable.
  
  
  
  It only works as long as you don't move the mouse outside the container 
  that you want to restrict dragging to.
  
  Once you mouse out of the container the proxy goes wherever the mouse goes 
  again.
  
  
  Pretty weak.
  
  
  I will post again if I find a better solution.
  
  
  
  
  
  
  override protected function dragOverHandler(event:DragEvent):void{
  super.dragOverHandler(event);
  this.dragProxy = DragManager.mx_internal::dragProxy;
  this.dragProxy.y = this.localToGlobal(new Point(this.x, this.y)).y;
  
  /* if(DragAndDropRules.canDropHere(event.){
  
  } */
  } 
  
  
  
  
  
  --- In flexcoders@yahoogroups.com, Archibald dekayd@ wrote:
  
   This is super easy using startDrag and seems to be stupid hard using the 
   DragManager.
   
   
   Am I missing something?
   
   
   Why would this relatively common need not be addressed in the DragManager?
   
   
   I have seen like 20 people ask the same question with no answer.
   
   
   I am working on a linear editor using an HList and want to use the built 
   in DragDrop support but it has to restrict to only drag horizontally.
   
   
   
   Thanks.
   
   --Kelly
  
 





[flexcoders] Re: How to restrict Drag and Drop to one axis? (like the X-Axis only)

2009-08-17 Thread Archibald

By doing this on the highest level UIComponent I could access I was able to 
lock it to one access even when dragging outside of the target container.


Unfortunately it only worked up to the highest level component within a Module.


It did not work when added to a component in the main app when the target 
container is inside of a module.







--- In flexcoders@yahoogroups.com, Archibald dek...@... wrote:

 
 I found a way to kindof do this.
 
 
 It's not perfect but I guess it's acceptable.
 
 
 
 It only works as long as you don't move the mouse outside the container that 
 you want to restrict dragging to.
 
 Once you mouse out of the container the proxy goes wherever the mouse goes 
 again.
 
 
 Pretty weak.
 
 
 I will post again if I find a better solution.
 
 
 
 
 
 
 override protected function dragOverHandler(event:DragEvent):void{
   super.dragOverHandler(event);
   this.dragProxy = DragManager.mx_internal::dragProxy;
   this.dragProxy.y = this.localToGlobal(new Point(this.x, this.y)).y;
   
   /* if(DragAndDropRules.canDropHere(event.){
   
   } */
 } 
 
 
 
 
 
 --- In flexcoders@yahoogroups.com, Archibald dekayd@ wrote:
 
  This is super easy using startDrag and seems to be stupid hard using the 
  DragManager.
  
  
  Am I missing something?
  
  
  Why would this relatively common need not be addressed in the DragManager?
  
  
  I have seen like 20 people ask the same question with no answer.
  
  
  I am working on a linear editor using an HList and want to use the built in 
  DragDrop support but it has to restrict to only drag horizontally.
  
  
  
  Thanks.
  
  --Kelly
 





[flexcoders] Re: How to restrict Drag and Drop to one axis? (like the X-Axis only)

2009-08-14 Thread Archibald

I found a way to kindof do this.


It's not perfect but I guess it's acceptable.



It only works as long as you don't move the mouse outside the container that 
you want to restrict dragging to.

Once you mouse out of the container the proxy goes wherever the mouse goes 
again.


Pretty weak.


I will post again if I find a better solution.






override protected function dragOverHandler(event:DragEvent):void{
super.dragOverHandler(event);
this.dragProxy = DragManager.mx_internal::dragProxy;
this.dragProxy.y = this.localToGlobal(new Point(this.x, this.y)).y;

/* if(DragAndDropRules.canDropHere(event.){

} */
} 





--- In flexcoders@yahoogroups.com, Archibald dek...@... wrote:

 This is super easy using startDrag and seems to be stupid hard using the 
 DragManager.
 
 
 Am I missing something?
 
 
 Why would this relatively common need not be addressed in the DragManager?
 
 
 I have seen like 20 people ask the same question with no answer.
 
 
 I am working on a linear editor using an HList and want to use the built in 
 DragDrop support but it has to restrict to only drag horizontally.
 
 
 
 Thanks.
 
 --Kelly