How to draw a line between two buttons?

Hello.

I want to do two mobile buttons attached to a line. When changing the position of any button you change in the appearance of the line of course.  I know how to draw a line, but after MOUSE_DOWN and I don't know how to remove an old monotube and how this line to appear all the time?

My code

btn2.addEventListener (MouseEvent.MOUSE_DOWN,
mouseDownHandler3);
btn2.addEventListener (MouseEvent.MOUSE_UP, mouseUpHandler3);
btn3.addEventListener (MouseEvent.MOUSE_DOWN, mouseDownHandler3);
btn3.addEventListener (MouseEvent.MOUSE_UP, mouseUpHandler3);

Set a mouse down Manager (the user is dragging)
function mouseDownHandler3(evt:MouseEvent):void {}
var object = evt.target;
We have to limit them by dragging to the area inside the canvas
object.startDrag ();
}
function mouseUpHandler3(evt:MouseEvent):void {}
var obj = evt.target;
obj.stopDrag ();
spisujemy x, y
var x2Pos:Number = btn2.x;
var y2Pos:Number = btn2.y;
var x3Pos:Number = btn3.x;
var y3Pos:Number = btn3.y;
trace (x3Pos);
trace (y3Pos);
var roundObject:Shape = new Shape();
roundObject.graphics.lineStyle (2, 0 x 990000,. 75);
roundObject.graphics.moveTo (x2Pos, y2Pos);
roundObject.graphics.lineTo (x3Pos, y3Pos);
this.addChild (roundObject);
this.removeChild (this.getChildAt (this.numChildren-1));
}

Source. FLA: http://www.mediafire.com/?y2tyzz4zxun

Here is a solution that you can adapt for two or more buttons...

var btns:Array = [btn2, btn3]; instances in concert

handlers all btn
function setBtns (): void {}
for (var i = 0; i)
inclinometer [i] .buttonMode = true;
inclinometer [i] .addEventListener (MouseEvent.MOUSE_DOWN, grab);
inclinometer [i] .addEventListener (MouseEvent.MOUSE_UP, drop);
}
}

setBtns();

inspired by ECCAS btns lines all while occurs wildfire
function drawLines(e:Event=null):void {}
Graphics.Clear;
graphics.lineStyle (2, 0xFF0000);
((graphics.moveTo(btns[0].x+(btns[0].width/2), btns[0].y+(btns[0].height/2));

for (var j = btns.length - 1; j > = 1; j-) {}
((graphics.lineTo(btns[j].x+(btns[j].width/2), btns[j].y+(btns[j].height/2));
}
}

managers
function grab(event:MouseEvent):void {}
event.target.startDrag ();
addEventListener (Event.ENTER_FRAME, drawLines);

}

function drop(event:MouseEvent):void {}
event.target.stopDrag ();
removeEventListener (Event.ENTER_FRAME, drawLines);

}

drawLines();

Tags: Adobe Animate

Similar Questions

  • Draw a line between two entities

    Hello. I am on the Data Modeler and I use the Visual tool. I want to connect 2 entities with just a line that I can add comments or notes. I can create a relationship of foreign key between 2 entities now, but a primary key is required to do this. Some of my tables do not have primary keys, but I need to put a line between them, with comments or notes saying what relations there are. I know that the software is by default to foreign key relationships via primary keys, but I need to draw my own in there. Any ideas? Thank you!

    Yes, this is a frequent question on the forum. Once you draw the line, he opens a straight dialogue/property box? On the left, you will see a node called related columns. Click on that. You will see the map with the column name that is generated in the child column field. Click on that column and you'll see that it really is a drop-down selection list, which will show you all the FK "candidate" columns already in the table. One of them will be hopefully the FK column that you want to attach. Pick it up. When you click on apply or OK, the tool will ask you if you want to remove the generated column. Select "Yes".

    Note: the drop-down list won't give you the possibility to select the columns having the same exact data type and column PK of the source size. If the column that you want to attach to the is not an exact match, the tool will not let you join her. I had a situation where my PK was a surrogate Number key (9), but the target FK column was Number (6). I had to change the definition of column target in order to define the FK in the model. (So I added a note on the column of this change and why I did it). Unfortunately the model is now synchronized with the Pb of the production. Finally, we must convince the DBA to make the change (unless it's a third-party to which application cases you will have to live with it).

  • How to create sharp lines between two text boxes?

    I create a book that is written by several people, and so I want to create a "chapter... author.

    Like this:

    Chapter 1... Jon Doe

    chapter2 ................................. Simon Harper

    so that these points have always the same distance.

    Help, please!

    Well, if your 'chapter' and your 'jon doe' is in the separate text boxes, then there is no easy way to do it. (You could draw a bunch of lines dotted, which isn't difficult, but the only way to standardize manually drag the lines around).

    However, if "chapter" and "jon doe" is in the same text box, separated by a tab character, then it is quite easy. Have you used a ruler before tab? This gives a test:

    (1) type a brief sample in a text area, like the one in your post, but instead of separate columns with points, simply use a single tab

    (2) select all text

    3) go to the Type-> tabs

    (4) I hope it sounds familiar to you (probably from MS Word, or maybe using a typewriter) but otherwise,.

    (4A), click once on the sovereign to insert a tab stop

    4 (b) type a question in the area of 'leader', and

    4 c) press Tab or Enter to confirm

    FYI, it's what you want, a 'leader' or a 'leader of dot. Knowing that he has called a "Chief" will help you find it in InDesign help.

  • Draw a line connecting two points in the WPF chart

    I'm trying to understand the best way to draw a line between two existing points on my graph in WPF.  At first, I thought I had it works fine; I just added another parcel to my graph then given exactly two points for rendering.  But I quickly noticed that the app has become surprisingly slow and CPU was quite high (adding other plots does not affect the use of the CPU as long as they have a complete set of points (?)).  He wants me if I looked at using the DataToScreen method on the chart but I can't know what the parameters are.  The second parameter is simply an IList that tells me a lot.  This seems to be the method I want to use for the coordinates of a point on the graph screen.

    No one knows what the second parameter is supposed to be for the DataToScreen method?  Everything I tried throws an Exception of Argument.

    Thank you
    Dan

    DataToScreenwill return a screen coordinate in the plot area of a chart of the value of the raw data horizontal and vertical in the given list. The parameter value is a IList for compatibility with other methods of graphical query such as FindNearestValue , return IList values containing raw data.

    A concrete example, say you had a graphical configuration with a wide horizontal axis ranging from 0 to 100 and a vertical axis double precision ranging from 10 to 20:


            
                
                
            
        

    To get the screen coordinates of the value at the center of the two axes, you can call:

    graph.DataToScreen(plot, new object[] { 50, 15.0 })

    Note that the raw data values corresponding to the type of axes (horizontal AxisInt32 returns the integer 50 and vertical AxisDouble Gets the value 15.0 ).

    You also mentioned a performance issue where "adding other plots does not affect the CPU so that they have a complete set of points". I did a simple test app that adds an array of two points of a chart on each key (for example graph.Data.Add(new[] { new Point(x1, y1), new Point(x2, y2) }); ), but could not reproduce the problem you saw. Could you share the code, you use to draw the connection line?

  • How to draw the line under STROKE and fill of an object in illustrator cc? Ideas: D...

    How to draw the line under STROKE and fill of an object in illustrator cc? Any ideas ...

    Aleksandar,

    If I (put) understand it, you will need to divide the object. You can:

    (1) select the object and Ctrl / Cmd + C + F, and then remove the filling of the copy and the blow of the original;

    Draw 2) and drag the new piece down between Division 1 objects) in the layers palette, or select 1 copy) and Ctrl / Cmd + C + F + X + F or similar.

  • draw the line between black pixel: coordinates of the selected pixels?

    Hello

    I want to build a script that can check a Photoshop file and:

    -find the black pixel

    -for each black pixel, looking for an another black pixel at a maximum distance of 5 pixels

    -then draw a line between the two black pixels.

    I wrote this script below (my first script...), but it's VERY slow (and my final image is VERY large), I think because I test the color for each pixel in the image.

    So an alternative would be to select a black pixel with the wand, then the script record all the details of the selected pixels, then my script wil test only the pixels (less than 1% of the pixels are black in my image).

    Is this possible with JavaScript?

    Thank you for your answer!

    Marc

    function main(){
     var startRulerUnits = app.preferences.rulerUnits;
     app.preferences.rulerUnits = Units.PIXELS;
    
    
     var myHeight = app.activeDocument.height;
     var myWidth = app.activeDocument.width;
    
    
    // Find black pixel
     for(var i=5; i<myWidth; i++) {
      for(var j=5; j<myHeight; j++) {
       activeDocument.colorSamplers.removeAll()
       var sampler = activeDocument.colorSamplers.add([new UnitValue (i, 'px'), new UnitValue (j, 'px')]);
       if (sampler.color.rgb.hexValue === "000000") {
    
    
    // For each black pixel, search another black pixel below left up to 5 pixels
        for (var m=i-5; m<i; m++) {
         for (var n=j+1; n<j+5; n++) {
          activeDocument.colorSamplers.removeAll()
          var test = activeDocument.colorSamplers.add([new UnitValue (m, 'px'), new UnitValue (n, 'px')]);
          if (test.color.rgb.hexValue === "000000") {
    
    
    // Then draw a black line between the two black pixels
           var FillColour = new SolidColor;
           FillColour.rgb.hexValue = '000000';
           var ad=activeDocument;
           ad.selection.select([[m,n],[i,j],[m,n+1],[i,j+1]], SelectionType.REPLACE, 0, true);
           ad.selection.fill(FillColour);
           ad.selection.deselect()
          }
         }
    
    
    // For each black pixel, search another black pixel below right up to 5 pixels
         for (var m=i+1; m<i+5; m++) {
          for (var n=j; n<j+5; n++) {
           activeDocument.colorSamplers.removeAll()
           var test = activeDocument.colorSamplers.add([new UnitValue (m, 'px'), new UnitValue (n, 'px')]);
           if (test.color.rgb.hexValue === "000000") {
    
    
    // Then draw a black line between the two black pixels
            var FillColour = new SolidColor;
            FillColour.rgb.hexValue = '000000';
            var ad=activeDocument;
            ad.selection.select([[i,j],[m,n],[m,n+1],[i,j+1]], SelectionType.REPLACE, 0, true);
            ad.selection.fill(FillColour);
            ad.selection.deselect()
           }
          }
         }
        }
       }
      }
     }
    }
    main();
    
    

    If someone wants to do the same thing, the ImageJ software works very well on very large images (1 billion pixels) by the process according to > binary > close

  • I want to draw a line between 2 specific points on an image inserted in a Panel? Help, please!

    I am a beginner in working with LabWindows/CVI and I want to draw a line between 2 specific points on an image inserted in a Panel? Please help or examples of code.

    As evidenced by the Wolfgang there is a problem in the definition of recall. InstallCtrlCallback wants a reminder of the standard of review as a parameter: apparently you have structured your reminder callbackName on the prototype of a recall of Panel, which obviously missing the setting "control".

    In addition, the recall of control should be said somewhere before it can be used. In other words, you must add his statement before your function {main}, either in one of your include files, or directly in the code. This is the reason for the error 'found int, whereas CtrlCallbackPtr. '

    Third point: you create a new picture control in the callback assigned to the image control. And you reuse variable 'Test', which already holds a valid control ID...

    Finally: what you expect to make from '1' in callbackData parameter, given that you do not use anyway? Unless you want to adapt the behavior of recall some past in callbackData conditions, you must pass NULL as the parameter.

  • I have Adobe Acrobat XI and can not know how to draw a line.  I need to redline some documents but can not.  Does version XI even not this feature?

    I have Adobe Acrobat XI and can not know how to draw a line.  I need to redline some documents but can not.  Does version XI even not this feature?

    Yes, Acrobat Pro XI and standard have this ability.
    There is the comment > Annotations > online tool.
    There is the comment > Annotations > tool bar.

    In the Properties dialog box for one, you can select a desired color (i.e. red).
    So, in properties, you can check a choice to make this the default value of the tool.

    Basically, all versions of Acrobat (including the new "DC") offer this feature.

    If you work with a scanned image that has been placed in the PDF don't forget to use the OCR to get an output of a 'real' text - Acrobat provides a feature of OCR.

    Be well...

  • How to draw a line in Muse?

    I think that it is a stupid Questtion, but I can't.

    How to draw a line?

    Draw a rectangle with 1 Pixel in height and no respect.

    If you want to dashed or dotted lines:

    http://forums.Adobe.com/ideas/1944#comment-5008

  • How to remove a path between two anchor points

    Hello

    everything is in the title,

    could you tell me please how to remove a path between two anchor points without using the tool Eraser path?

    When I select these two folders and press to remove all disappeared.

    PS: I want to keep the anchor after the removal

    Thank you

    with the Selection tool direct (white pointer), click the path segment (no points) or select slide above without going on something else and tap on delete.

  • How to draw a line under the first paragraph

    Hello

    I am trying to solve a problem: my text field should be divided into two parts, horizontally. First part is intended for a log book, and the second is for the body. I need to divide them visually tracing a line between them. The logic is to take the first paragraph and make a summary. The rest is the body. So I need to be able to get the height of the first paragraph in order to draw the line at the right position. And I will have to adjust its position whenever the user scrolls the text.

    Any ideas how to on this subject?

    see you soon,

    Jan

    There is a discussion about the various ways to do it in this thread:

    http://forums.Adobe.com/message/3382440#3382440

    You will also find the recent message on the blog useful:

    http://blogs.Adobe.com/tlf/2011/01/decoration-example.html

    -robin

  • Graphics.drawText: How to draw a line of text with words in different colors?

    BB OS 5.0.0

    I'm watching the documentation of the API for graphics and I can't determine how can I use Graphics.drawText to draw a single line in two colors.

    I get the content from the server and in my class that extends the field, layout and painting methods. In the paint method, I need to use drawText to paint the contents from the server in two colors, such as:

    New coffee blends available at the counter & - 1 hour ago

    I thought that the following drawText could be useful, but I don't see how I can use it with two colors. Ideas, samples or advice would be greatly appreciated.

    public int drawText(StringBuffer aText,
                        int aOffset,
                        int aLength,
                        int aX,
                        int aY,
                        int aFlags,
                        int aWidth)
    

    You will need two calls drawText, each following a call setColor for the font you want for this particular piece color.

    In order to calculate the offset x from the second drawText compared to the first, use font.getAdvance (firstString) (where the police is your graphic police present, accessible via graphics.getFont ()).

    Use simple methods and you will get your results faster.

  • The line between two labels

    Hello world

    I wrote this little program where iam creating two label and I can drag this label and this works perfectly.
    I also try to include a line between this label. I am not getting the correct result because I see my tag, but not the line. (I know that my program is incomplete to separating it from the label, since I can't see the line with label iam not able to proceed)

    I am a newbie so my code is perhaps not too professional. Hoping to find a few tips.
    import java.awt.*;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseMotionListener;
    import java.awt.geom.Line2D;
    
    import javax.swing.*;
    
    @SuppressWarnings("serial")
    public class test extends JFrame implements MouseListener, MouseMotionListener  {
    
    private JPanel panel = new JPanel(null);   
    private JLabel label1 = new JLabel();
    private JLabel label2 = new JLabel();
    private int mouseX = 200;
    private int mouseY = 100;
    private boolean drag = false;
    
    
    public test() {
        this.add(panel);
        panel.setBackground(Color.WHITE);
    
        panel.add(label1);
        label1.setOpaque(true);
        label1.setBackground(Color.BLUE);
        label1.setBounds(mouseX, mouseY, 100, 50);
        label1.addMouseMotionListener(this);
        label1.addMouseListener(this);
    
        panel.add(label2);
        label2.setOpaque(true);
        label2.setBackground(Color.RED);
        label2.setBounds(mouseX + 200, mouseY, 100, 50);
        label2.addMouseMotionListener(this);
        label2.addMouseListener(this);
          
    }
    
    @Override
    public void mousePressed(MouseEvent e) {
        if (e.getSource() == label1) {
            drag = true;
        }
        if (e.getSource() == label2) {
            drag = true;
        }
    }
    
    
    
    @Override
    public void mouseReleased(MouseEvent e) {
        drag = false;
    }
    
    @Override
    public void mouseDragged(MouseEvent e) {
          if (drag == true)
        {
            JComponent jc = (JComponent)e.getSource();
            jc.setLocation(jc.getX()+e.getX(), jc.getY()+e.getY());
        }
    }
    
    public void mouseMoved(MouseEvent e) {}
    public void mouseEntered(MouseEvent e) {}
    public void mouseExited(MouseEvent e) {}
    public void mouseClicked(MouseEvent e) {}
    
    public void paint(Graphics g) {
        Graphics2D g2 = (Graphics2D) g;
        Line2D lin = new Line2D.Float(100, 100, 250, 260);
        g2.draw(lin);
        super.paint(g2);
    }
    
    public static void main(String[] args) {
        test frame = new test();
        frame.setVisible(true);
        frame.setSize(600, 400);
        frame.setResizable(false);
        frame.setLocationRelativeTo(null);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       
       
    }
    }
    Thanks for all your time and help.

    Outside of the Netbeans IDE is also there another tool that can help in creating faster GUI swing application.
    public void paint(Graphics g) {
        super.paint(g);
        Graphics2D g2 = (Graphics2D) g;
        Line2D lin = new Line2D.Float(100, 100, 250, 260);
        g2.draw(lin);
    }
    

    Also I suggest

    public void mousePressed(MouseEvent e) {
        if (e.getSource() == label1 || e.getSource() == label2) {
            drag = true;
        }
    }
    
  • How to create a relationship between two blocks

    Oracle forms 6i
    Hai All

    I've created a form that I have four button ADD, QUERY, SAVE, EXIT.

    I have two block named head and members.

    Four Chief areas namely block unitid, deptcode, codeno name.

    When I pressed the query button, and the cursor goes to the Chief name field when I enter the name of the leader and click

    Enter I give the codeno, the deptcode and the unitid of the leader_name.

    so now, I created another block in a tabular structure to bring members in the same deptcode that belongs to Leader_name.

    So pls tell me the steps how to create the relationship between these two blocks.


    When I enter the leader_name and gives enter need to bring the codeno, the deptcode, the unitid and

    I also need to give the members of this deptcode...


    Thanks in advance

    Srikkanth.M

    To write, only State a selection:

     :blk2.item = :blk1.item
    

    François

  • How to give a delay between two Boolean?

    Hi all

    I want to insert a dalay in time between two Boolean values. My requirement is I want the second boolean to be switched on after delay 2 sec of variable Boolean 1 is turned on.

    How to do?

    Thank you

    Yes, I don't want to do antthing...

    Meanwhile, I also had the same idea...

    Thanks for the reply

Maybe you are looking for