9 Replies Latest reply on Jan 8, 2009 1:42 PM by hsfrey

    Dragging components

    hsfrey Level 1
      I've seen examples where jpgs are dragged around panels, or where list items are dragged and dropped between text boxes, but I want the user to be able to drag text boxes around the panel.

      Can anyone suggest where I might look? I didn't see anything like that in the cookbook.

      Could I just use absolute positioning and bind the coordinates to variables set by the mouse location?
        • 1. Re: Dragging components
          Level 7

          "hsfrey" <webforumsuser@macromedia.com> wrote in message
          news:gk1kre$p8m$1@forums.macromedia.com...
          > I've seen examples where jpgs are dragged around panels, or where list
          > items
          > are dragged and dropped between text boxes, but I want the user to be able
          > to
          > drag text boxes around the panel.
          >
          > Can anyone suggest where I might look? I didn't see anything like that in
          > the
          > cookbook.
          >
          > Could I just use absolute positioning and bind the coordinates to
          > variables
          > set by the mouse location?

          http://www.quilix.com/node/3


          • 2. Re: Dragging components
            hsfrey Level 1
            Thanks Amy!

            That's helpful, but it doesn't allow me to change the location of a component within the SAME UIComponent; it just allows me to move it to ANOTHER component.

            I think I'm going to have to be able to dynamically change the x & y coordinates of the component based on the location of the mouse.

            It's seems as though it ought to be straight-forward, so I'm surprised I haven't seen an example.

            My project involves a tree structure with cross-links, where I want to be able to drag any given node to the center of the display panel, and move the connecting nodes to surround it.
            • 3. Re: Dragging components
              Level 7

              "hsfrey" <webforumsuser@macromedia.com> wrote in message
              news:gk3dsd$aa3$1@forums.macromedia.com...
              > Thanks Amy!
              >
              > That's helpful, but it doesn't allow me to change the location of a
              > component
              > within the SAME UIComponent; it just allows me to move it to ANOTHER
              > component.

              Drag and drop is at the UIComponent level. You'll need to use separate
              UIComponents for each piece that needs to be moved. If they ARE in separate
              UIComponents, then I think you can just accept the drag in the same
              component.

              > I think I'm going to have to be able to dynamically change the x & y
              > coordinates of the component based on the location of the mouse.

              Maybe just on the location of the component.

              > It's seems as though it ought to be straight-forward, so I'm surprised I
              > haven't seen an example.
              >
              > My project involves a tree structure with cross-links, where I want to be
              > able
              > to drag any given node to the center of the display panel, and move the
              > connecting nodes to surround it.

              I'm not sure how to interpret that.


              • 4. Re: Dragging components
                hsfrey Level 1
                Amy:

                >I'm not sure how to interpret that. <

                It's a big XML structure where any node can refer to a distant node by its ID.

                To see all the references to any node, I want to move it in the center of the screen and surround it with all the nodes it references or which reference it.

                Harvey
                • 5. Re: Dragging components
                  Level 7

                  "hsfrey" <webforumsuser@macromedia.com> wrote in message
                  news:gk49h0$eqg$1@forums.macromedia.com...
                  > Amy:
                  >
                  > >I'm not sure how to interpret that. <
                  >
                  > It's a big XML structure where any node can refer to a distant node by its
                  > ID.
                  >
                  > To see all the references to any node, I want to move it in the center of
                  > the
                  > screen and surround it with all the nodes it references or which reference
                  > it.

                  Maybe this will already do what you want...

                  http://mark-shepherd.com/blog/2006/11/17/a-flex-component-for-graph-visualization/


                  • 6. Re: Dragging components
                    hsfrey Level 1
                    Amy:

                    >Maybe this will already do what you want...
                    http://mark-shepherd.com/blog/2006/11/17/a-flex-component-for-graph-visualization/<

                    WOW! Does it Ever! <G>

                    Thank You !!!!

                    Harvey
                    • 7. Re: Dragging components
                      Level 7

                      "hsfrey" <webforumsuser@macromedia.com> wrote in message
                      news:gk5aug$sbf$1@forums.macromedia.com...
                      > Amy:
                      >
                      >>Maybe this will already do what you want...
                      > http://mark-shepherd.com/blog/2006/11/17/a-flex-component-for-graph-visualization/<
                      >
                      > WOW! Does it Ever! <G>
                      >
                      > Thank You !!!!

                      :o)

                      You're welcome.


                      • 8. Re: Dragging components
                        bholli
                        Or, you can simply do the following:

                        <mx:TextArea id="myText" mouseDown="myText.startDrag();" mouseUp="myText.stopDrag();" />
                        • 9. Re: Dragging components
                          hsfrey Level 1
                          Yes, I certainly prefer working at a level that minimizes the use of other people's possibly inscrutable code.

                          But Shepard's package seems to provide lots of other pretty features that, now that I see them, I would want.

                          :-)