12 Replies Latest reply on Jun 1, 2009 1:33 AM by Richard_Abbott

    could anyone help me on this. Urgent.

    sarathlella

      I have 10 textbox kind of items, i want to join two or three text boxes by using arrow. could anyone help me on this. it very urgent.

       

      also i need the script & file.

       

       

      Thanks in advance.

       

       

      Sarath Lella.

        • 1. Re: could anyone help me on this. Urgent.
          *Prashant Shelke* Level 4

          Hi, actually cannt see image u attached. But i think u r requirement is like


          Text 1 < ---> Text 2 , I think here you can usage image as connector or VRule or HRule anything you want.


          Hope my understanding is right.


          Thanks.

          • 2. Re: could anyone help me on this. Urgent.
            Michael Borbor Level 4

            What do you mean by joining them by an arrow?

             

            Sincerely,

             

            Michael

             

            El 01/06/2009, a las 1:23, sarathlella <forums@adobe.com> escribió:

             

            >

            I have 10 textbox kind of items, i want to join two or three text 

            boxes by using arrow. could anyone help me on this. it very urgent.

            >

            also i need the script & file.

            >

            >

            Thanks in advance.

            >

            >

            Sarath Lella.

            >

            • 3. Re: could anyone help me on this. Urgent.
              sarathlella Level 1

              i want to join those two textboxes by using arrows and create in to new text box.

              • 4. Re: could anyone help me on this. Urgent.
                sarathlella Level 1

                Now you can see the image

                 

                Thanks

                • 5. Re: could anyone help me on this. Urgent.
                  sarathlella Level 1

                  Could you please send me sample file also then it will be great.

                   

                  Thanks & Regards,

                  SarathLella.

                  • 6. Re: could anyone help me on this. Urgent.
                    Richard_Abbott Level 3

                    SarathLella,

                    how about putting the text boxes at known locations inside a canvas (so you know the x/y/height/width values of each) and then just drawing on the canvas graphics?

                    For example in your picture if

                    textbox 1 is at x=10, y=10, height=15, width=100

                    textbox 2 is at x=10, y=30, height=15, width=100

                    textbox 1+2 is at x=150, y=15, height=15, width=100

                     

                    Then do something like

                    canvas.graphics.lineStyle(1, 0x888888);

                    canvas.graphics.moveTo(110,18);

                    canvas.graphics.lineTo(130,18);

                    canvas.graphics.lineTo(130,23);

                    canvas.graphics.lineTo(150,23);

                     

                    etc. It's a bit clunky, to be sure, and you'd want to put the drawing code into a separate function with suitable arguments rather than have all the instructions just in the main code. But this might be something you could develop into what you want.

                    Richard

                    • 7. Re: could anyone help me on this. Urgent.
                      sarathlella Level 1

                      hi,

                       

                      its not dyanamic one

                      its a static

                      code

                      • 8. Re: could anyone help me on this. Urgent.
                        *Prashant Shelke* Level 4

                        please see attachment: I think there is some problem while uploading...


                        <?xml version="1.0" encoding="utf-8"?>
                        <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
                            <mx:TextInput x="185" y="50" id="txtInp1" width="79"/>
                            <mx:TextInput x="185" y="115" id="txtInp2" width="79"/>
                            <mx:TextInput x="349" y="85" id="txtInp3"/>
                            <mx:VRule x="295" y="59" width="1" height="71"/>
                            <mx:VRule x="295" y="59" width="1" height="71" strokeColor="#191B1B"/>
                            <mx:HRule x="264" y="59" strokeColor="#101111" width="32" height="2"/>
                            <mx:HRule x="264" y="59" strokeColor="#101111" width="32" height="2"/>
                            <mx:HRule x="295" y="94" strokeColor="#101111" width="55" height="2"/>
                            <mx:HRule x="264" y="127" strokeColor="#101111" width="32" height="3"/>
                           
                            <mx:Button label="Concat" click="txtInp3.text = (txtInp1.text + txtInp2.text);"  x="185" y="162"/>
                            <mx:Label x="125" y="52" text="Label 1"/>
                            <mx:Label x="125" y="117" text="Label 2"/>
                        </mx:Application>

                         

                         

                        • 9. Re: could anyone help me on this. Urgent.
                          Richard_Abbott Level 3

                          Hi SarathLella,

                          I'd seriously consider making it a dynamic project as this will give you so much more flexibility. In your MXML file you would simply have the canvas, sized to whatever is appropriate, but make sure you give it an id value, say id="my_canvas". Also in the application tag add an applicationComplete or creationComplete handler in which you have lines like

                          text_box_1 = new TextBox();

                          text_box_1.id = "text_box_1";

                          text_box_1.x = 10;

                          text_box_1.y = 10;

                          text_box_1.height = 15;

                          text_box_1.width = 100;

                          my_canvas.addChild(text_box_1);

                          // same for each text box altering x and y values - another good candidate for a separate method

                          // then add the lines as per previous message.

                           

                          Make sure you do the addChild calls otherwise your newly created objects will not show. If you prefer not to do the dynamic creation of the text boxes then all these can be put into the MXML file as children of the canvas, but my personal preference is to do as much dynamically as possible (but then, I'm very comfortable with the ActionScript coding side of things). I know of no way to do the canvas arrow drawing without doing it at run-time in one of the handlers.

                          Richard

                          • 10. Re: could anyone help me on this. Urgent.
                            sarathlella Level 1

                            i want to add the arrows manually. i mean i need to drag the arrows between these textitems.

                            • 11. Re: could anyone help me on this. Urgent.
                              sarathlella Level 1

                              i want to add the arrows manually. i mean i need to drag the arrows between these textitems.

                              • 12. Re: could anyone help me on this. Urgent.
                                Richard_Abbott Level 3

                                SarathLella,

                                in that case, catch the mouse down, move, and up events on the background canvas (my_canvas.addEventListener(MouseEvent.MOUSE_DOWN, canvas_mouse_down) etc) and write handlers for them:

                                Mouse down would mark the start point of a line (my_canvas.graphics.moveTo(x-coord, y-coord);)

                                Mouse move could show the user the current line position in some suitable way - this is the most difficult to do in a clear manner

                                Mouse up would mark the end point of the line (my_canvas.graphics.lineTo(x-coord, y-coord);)

                                You might well want to constrain the start and end points to particular places (eg the middle of the right or left edges of the correct text box), and from your original picture, you wanted line segments that were horizontal/vertical pieces rather than, say, a diagonal line joining directly, but those things are easy modifications on the basic scheme.

                                Richard