[flexcoders] Tree Control Drag and Drop Help

2009-02-02 Thread adrianpomilio
This is a two part question.

1 - How can I keep a child from being dropped outside of it's parent?
 I want to be able to drag and drop within a nodes parent.

2 - How do I get a handle on the new index of the node that has been
dropped.

I can get the current index, the parents name, but not the location it
was dropped.

I am using an ArrayCollection to populate the tree, using the children
attribute to create the child nodes.  I am stuck with having to use
the ArrayCollection.

Any pointers would be great.



[flexcoders] Re: Tree Control Drag and Drop Help

2009-02-02 Thread adrianpomilio
Yves, THANK YOU , THANK YOU , THANK YOU... life is good.  Worked like
a champ.  I had never done the mx_internal piece, great pointer thank
you very much.

Here is a sample of the function I created, David I hope this helps:


private function dropData( event:DragEvent ) : void
{   
var parent:String =
event.dragInitiator.mx_internal::_dropData.parent.label;
var childParent:String = item.parentComp;
if(parent == BOXC){

trace(moved through the match);
}else{
event.preventDefault();
trace(moved out of the match);
   }
}

Put this in your import statement area:
import mx.core.mx_internal;
use namespace mx_internal;

Thanks again Yves!

--- In flexcoders@yahoogroups.com, Yves Riel r...@... wrote:

 When a drag  drop operation occurs on a tree, the drag  drop handlers
 call the public calculateDropIndex() function. This function stores all
 the properties that you want in an mx_internal variable called _dropData
 of Object data type.
  
 So, make sure that your class import and use the mx_internal namespace
 and attach a listener to the tree's dragDrop event. In the event
 handler, look up the _dropData variable and specifically the parent
 and index properties. If this drop operation should not be allowed,
 call the preventDefault() method on the event.
  
 That should do the trick.
 
 
 
 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
 Behalf Of David Kramer
 Sent: Monday, February 02, 2009 12:34 PM
 To: flexcoders@yahoogroups.com
 Subject: RE: [flexcoders] Tree Control Drag and Drop Help
 
 
 
 Adrian,
  
 I am up against the same problem.  Please share your knowledge on it so
 far.  kramer.da...@... mailto:kramer.da...@... 
  
 Many thanks.
  
 David
 
 
 
 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
 Behalf Of adrianpomilio
 Sent: Monday, February 02, 2009 8:45 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Tree Control Drag and Drop Help
 
 
 
 This is a two part question.
 
 1 - How can I keep a child from being dropped outside of it's parent?
 I want to be able to drag and drop within a nodes parent.
 
 2 - How do I get a handle on the new index of the node that has been
 dropped.
 
 I can get the current index, the parents name, but not the location it
 was dropped.
 
 I am using an ArrayCollection to populate the tree, using the children
 attribute to create the child nodes. I am stuck with having to use
 the ArrayCollection.
 
 Any pointers would be great.





[flexcoders] A great feature for Flex Builder would be getter and setter automation.

2008-06-20 Thread adrianpomilio
I use eclipse for Java development and there is a great feature where
you highlight your class variables, right click and select 'generate
getters and setters'.  What a time saver.

Is there any plugins for Flex Builder that will do this?  It is
getting annoying to type in the same basic plumbing for every class.

If there isn't then maybe we have a community project ;-)



[flexcoders] Issue - XML values being converted to Scientific Notation in ArrayCollection

2008-06-17 Thread adrianpomilio
Okay, so I am bringing in a string with a value of 33E-30 for Train Id.  
A JSP is returning the following XML to Flex via an HTTPService call:
train
trainId33E-30/trainId
/train

The above is showing up in the ResultObject of the http service call as:
3.2997e-29

So when viewing my ArrayCollection I am not getting the string 33E-30,
which is what I want.

All other values for this XML are working correctly, unless it is some
number followed by an E (3E-4, 44E-2, etc)

It looks like Flex is treating this as some mathematical formula
instead of as a string, even though it is typed as a string.  Any
ideas on how to work around this?  

I am thinking that it is happening when the xml is being returned to
Flex.  

Any ideas?