How to detect mouseover of line drawing

I have a series of lines that I draw onto my canvas. I would
like to be able to detect the mouseover for the specific line then
based on the line show certain information. I can create a
mouseover for a button or object, but am unsure of how to do this
for a specific line being drawn on the canvas. Any direction would
be great, Thanks!

I was drawing the line and assigning it to a MovieClip.
The code in Flash 8 for the function that does that is:
drawLines = function():Void{
myColor = this.color_ = 0x000000;
myLine = this.linea = 5;
if(origin) {
x1 = Canvas._xmouse;
y1 = Canvas._ymouse;
origin = !origin;
msg.text ="Move and click the mouse where you want to end
the line";
msgFormat();
} else{
x2 = Canvas._xmouse;
y2 = Canvas._ymouse;
Canvas.createEmptyMovieClip("line"+nLines,Canvas.getNextHighestDepth());
Canvas["line"+nLines].lineStyle (myLine, myColor, 100);
Canvas["line"+nLines].moveTo (x1,y1);
Canvas["line"+nLines].lineTo (x2,y2);
Canvas["line"+nLines].p1 = {x:x1, y:y1};
Canvas["line"+nLines].p2 = {x:x2, y:y2};
gsbTrace("p1= "+Canvas["line"+nLines].p1.x +" p2=
"+Canvas["line"+nLines].p2.x);
drawing = false;
msg.text ="To draw another line, click on 'Draw Routes'
again\n\nTo delete the line click on it and then on 'Delete
Selected Object'";
msgFormat();
nLines ++;
for(var sInstance:String in Canvas) {
Canvas[sInstance].onPress = function():Void {
mSelected = null;
lSelected = this;
l_selected.text = lSelected._name;
index = lSelected._name.substr(1);
var myColor:Number = 0xFF0000;
lSelected.clear();
lSelected.lineStyle (5, myColor, 100);
lSelected.moveTo (lSelected.p1.x,lSelected.p1.y);
lSelected.lineTo (lSelected.p2.x,lSelected.p2.y);
myDragger._visible = false;
gsbTrace("lSelected... "+ lSelected);
In Flex, instead of creating the line in a MovieClip, you can
put it on a sprite (basically a component) using the addChild
method.
I hope this helps.
Gilbert

Similar Messages

  • How can I isolate the line drawing in this picture?

    Hello,
    I want to copy the snake, including the scales, and make it a vector so I can resize it and colour the inside. I tried Live Trace in Illustratror and I can't get the whole snake outline at once. I tried paths but I couldn't get the circles without making the lines crooked.
    I got as far as cropping and erasing most of the background. I am using CS3. I'm pretty new at doing this so I'm sure I'm missing something obvious. Any help would be appreciated.

    Well, at least I'll learn something new in Illustrator!
    I found some info in the Resource Centre and will give it a go, but will go to the AI forum if I get stuck.
    Thanks for your help!

  • I have a line drawing (black on white paper) i have scanned and need to make the white paper transparent, maintaining the line drawing, can i and then HOW can i do this in PS?

    i have a line drawing (black on white paper) i have scanned and need to make the white paper transparent, maintaining the line drawing, can i and then HOW can i do this in PS? this is for my business logo. ive used it for years but with a solid background. id like to have it just be the drawing over my photos with a transparent background.

    First let me apologize for posting a reply that was only suitable for advanced users.  Photoshop is broad and powerful therefore has a huge learning curve.  In fact I would state no one knows and uses all of Photoshop.  When we first get Photoshop it intimidate us and we're very uncomfortable using it.  Many thing are not intuitive there in much learning involved.  After some time we begin to know something and we are able to do some thing.  Learning become rapid and we start playing in Photoshop.  It is very important to play with Photoshop.  Playing with Photoshop and asking for help with in forums like this IMO is the best way to learn. 
    Photoshop Power lies in layers, selection and automation.  However it takes knowledge to use photoshop well so most powerful tool you have ins Photoshop is the gray matter between your ears.  Most at one time or another want to watermark or put a logo on their image.  So its best to automate this process. All run into a problem in the process. "Size"  We find our assets vary in size and aspect ratios. Landscape, Portraits, Panoramas and others. This complicates automation.  Vector graphics works best when size vary greatly.  If you can not work out how to create a vector solution like a custom shape.  Create your Logo and watermark large thing scale down better the up. Text scale well for text uses vectors graphics however if you rasterize text it will not scale well.
    I do not type or do English well so let me do some screen captures.  I can not stress enough how important Black, White, Grays and Blending is when it come to image processing.  Become friends with Multiply, Screen, Overlay and Luminosity blending.....
    However when there is a white or black background though you can blend them you can not add a style like a drop shadow, emboss or make it invisible setting fill to 0 so only the style is visible.  When there is contrast between the logo and background it is easy to separate the two. To select the background and delet it to have the logo with a transparent background.  Many tools can be used to create the selection hee I use my action kill white.
    Vector Shape would work better for scaling However it would be best to create the logo from scratch in a vector program like illustrator but I never had the resources to justify the Creative suite. I only had Photoshop.  Recently Adobe gave me and other a year subscription to the creative suite for our participation here.  I still have not installed anything but Photoshop,  A while back I found a program that can create vector patf for black and white art work.  It will not be as good as using something like illustrator. However vector paths can be edited in Photoshop and cleaned up some. Here is the PSD it 13MB because od the gradient http://www.mouseprints.net/old/dpr/AmPm24-7.psd

  • I tried to import a PDF of a line drawing into Photoshop Elements. The thumbnail looks fine, but when imported the file is empty. This used to work in the past. What is wrong and how do I solve this?

    I tried to import a PDF of a line drawing into Photoshop Elements. The thumbnail looks fine, but when imported the file is empty. This used to work in the past. What is wrong and how do I solve this?

    Hi
    The value of the Channel Strip volume etc is not stored within the C Strip setting, as you have discovered.
    If you really wanted, you could add a Gain plug to the strip, with it set to give the correct output level with the Fader set to 0
    (Or just set the fader manually in MS)
    CCT

  • How can get a Graphics to draw line on screen?

    How can get a Graphics to draw line on screen?
    Now, I can get a Graphics to draw line based on component. For example JPanel, but I want to get a Graphics to draw line on screen.

    By drawing on the screen, I assume you mean drawing outside the bounds of a top-level window like
    JFrame or JDialog. You can't do that. At least, without going native and even then that's a dodgey thing
    for any platform to let you do. One thing you can do is simulate it with a robot's screen capture:
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import javax.swing.*;
    public class X {
        public static void main(String[] args) throws Exception {
            Rectangle bounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
            BufferedImage image = new Robot().createScreenCapture(bounds);
            Graphics2D g2 = image.createGraphics();
            g2.setStroke(new BasicStroke(20));
            g2.setPaint(Color.RED);
            g2.drawLine(0, 0, bounds.width, bounds.height);
            g2.drawLine(bounds.width, 0, 0, bounds.height);
            g2.dispose();
            JLabel label = new JLabel(new ImageIcon(image));
            label.addMouseListener(new MouseAdapter(){
                public void mousePressed(MouseEvent evt) {
                    System.exit(0);
            JFrame f = new JFrame();
            f.setUndecorated(true);
            f.getContentPane().add(label);
            f.setBounds(bounds);
            f.setVisible(true);
    }

  • How do I change the white background color in a b/w line drawing jpg?

    How do I change the white background color in a b/w line drawing jpg?

    Just put a Solid Color Layer atop it and set it to Blend Mode Multiply or
    • load the Channel with the best contrast (cmd-click it in the Channels Panel)
    • invert Selection (cmd-I)
    • create a black Solid Color Layer
    • put whatever below that Layer

  • How do i bend a line in photoshop (trying to draw a spider web)

    how do i bend a line in photoshop (trying to draw a spider web)?

    Draw the web on a new empty layer  then play with the layer's  blending modes and layers opacity, fill and blend if gray settings. Also try adding layer styles.

  • How to do  Line Drawing

    Just how do I use a photo of a church building and make a line drawing of it? There are hundreds of lines, bricks, indented windows, steps,etc. and the whole thing is flooded with trees. They don't want a photo image and I've tried drawing it in PS 7 and am going nuts. There's no help with using the "auto trace" tool in AI 10.
    I suppose this can be done in several days, but I don't have that time. Unless there's a way to do this more efficiently than line by line, they'll have to get someone else to do this for them.
    I love challenges, but this one is crazy..................mm

    There are several filters that should be close to what you need. The three that I ran across are:
    Stamp
    Photocopy
    Charcoal
    Each of these filters can be found at filter>sketch>name of filter.
    sorry I do not recall the name of the one similar to threshold.

  • How can i convert a jpeg into a line drawing/sketch?

    Hey just wondering what is the best tool and is Illustrator the best program  - to convert a standard JPEG image into a line drawing?
    Someone please help! Thank you

    Try VectorMagic (Google will find it for you). You can use it for free a few times on the web, or  you can buy a license. You can control the level of detail and the number of colours to use, and it will write an AI file.
    (I have no affiliation, I just think it works well).

  • How to make the diagonal line in the swing table cell?

    Hi all,
    How to make the diagonal line in the swing table cell just like the link below?
    http://61.132.17.188/webber/table.gif

    One improvement.. To get a line that is neat, use a bit of Graphics2D
        public void paintComponent(java.awt.Graphics g)
            int w = getSize().width;
            int h = getSize().height;
            // draw a line between (0,0) and (w,h)  
            g.setColor(getForeground());
            if (strTop == null)
                strTop = "  ";
            if (strBottom == null)
                strBottom = "  ";
                java.awt.Graphics2D g2 = (java.awt.Graphics2D)g;
              g2.setRenderingHint(java.awt.RenderingHints.KEY_ANTIALIASING,java.awt.RenderingHints.VALUE_ANTIALIAS_ON);
              //g2.setStroke(new java.awt.BasicStroke(14.0f));
            g.drawLine(0, 0, w, h);
            //the following lines will draw the two strings,
            //one above the top of the line and the above below it.     
            g2.drawString(strTop, (w/2)+2, (h/2)-2);
            g2.drawString(strBottom, 2, (h / 2) + 2);
            //the x,y for drawString are only based on assumption.   //do necessary changes to suit ur needs.
        }Then create a TableCellRenderer and set it to the Table Header for ur table's 1st row.....
    Cheers

  • [SOLVED] terminals & line drawing characters problem

    I use quite some escape sequences in my bash prompt, amongst them a few that produce line drawing characters. Works fine in the virtual consoles (tty), but no terminals in X (tried xterm, terminal, urxvt) display them correctly, for some reason. My locale settings seem fine, and I've tried various fonts (including the one I use in the virtual consoles).
    What could the issue be?
    FYI, my bash prompt variable. Does it display correctly for you?
    DRED='\e[0;31m'
    DGREEN='\e[0;32m'
    DYELLOW='\e[0;33m'
    DBLUE='\e[0;34m'
    DPURPLE='\e[0;35m'
    DCYAN='\e[0;36m'
    DWHITE='\e[0;37m'
    LRED='\e[1;31m'
    LGREEN='\e[1;32m'
    LYELLOW='\e[1;33m'
    LBLUE='\e[1;34m'
    LPURPLE='\e[1;35m'
    LCYAN='\e[1;36m'
    LWHITE='\e[1;37m'
    COLRESET='\e[0m'
    PS1="\n\[$DBLUE\]\[\016\]l\[\017\]\[$DRED\](\u@\h)\[$DBLUE\]\[\016\]qqq\[\017\](\[$LBLUE\]H\!\[$DBLUE\])\[\016\]qq\[\017\](\[$LBLUE\]C\#\[$DBLUE\])\[\016\]qq\[\017\](\[$LBLUE\]J\j\[$DBLUE\])\[\016\]qqq\[\017\](\[$LBLUE\]\D{%H:%M %A %d - %B %Y}\[$DBLUE\])\n\[\016\]t\[\017\]\[\016\]q\[\017\](\[\[$LBLUE\]\w\[$DBLUE\])\n\[\016\]mqq\[\017\]> \[$LBLUE\]"
    Last edited by Mzg (2010-07-09 10:00:41)

    After some detective work I have managed to come up with an explanation as well as what seems to be a working solution.
    If you have not tried the prompt above, basically I tried to use some line drawing characters in my bash prompt, but these refused to display correctly under any X terminals I tried (though it looked fine on virtual consoles).
    The problem was in the
    \[\016\] ... \[\017\]
    sequences. The \016 escape sequence is supposed to enter the alternate character set mode (common way to draw e.g. lines in text mode) while \017 returns the terminal to the standard character set. These work fine on the virtual consoles, but are apparently a no-no in (some) X terminals. If you tried the prompt you would notice that the color escape sequences worked fine, only the line drawing characters failed.
    So that is the explanation part. So for the solution...
    For urxvt, which is my preferred terminal emulator, the solution is quite simple. This should also work with other rxvt-derived terminals (including the popular aterm), though I have not tested this.
    These terminals offer the same functionality as the virtual consoles, though the escape sequences are different. "\033(0" enters alternate charset mode while "\033(B" returns to standard charset mode. So the solution is simply to replace all previous
    \[\016\] ... \[\017\]
    sequences with
    \[\033(0\] ... \[\033(B\]
    But this poses a problem, as the virtual consoles do not recognize these sequences and you'll get the same problem as before, only in text mode instead of X. I solved this by using the PROMPT_COMMAND variable to run fgconsole every time a command is ran in bash, checking if the command is ran in tty7 (i.e. X11) or in one of the (other) virtual consoles. This is my code for the root prompt:
    DRED='\e[0;31m'
    DGREEN='\e[0;32m'
    DYELLOW='\e[0;33m'
    DBLUE='\e[0;34m'
    DPURPLE='\e[0;35m'
    DCYAN='\e[0;36m'
    DWHITE='\e[0;37m'
    LRED='\e[1;31m'
    LGREEN='\e[1;32m'
    LYELLOW='\e[1;33m'
    LBLUE='\e[1;34m'
    LPURPLE='\e[1;35m'
    LCYAN='\e[1;36m'
    LWHITE='\e[1;37m'
    COLRESET='\e[0m'
    function prompt_func
    # Running in tty7 or larger (X11)
    if [ `sudo fgconsole` -gt 6 ]
    then
    PS1="\n\[$DBLUE\]\[\033(0\]l\[\033(B\]\[$DRED\](\u@\h)\[$DBLUE\]\[\033(0\]qqq\[\033(B\](\[$LBLUE\]H\!\[$DBLUE\])\[\033(0\]qq\[\033(B\](\[$LBLUE\]C\#\[$DBLUE\])\[\033(0\]qq\[\033(B\](\[$LBLUE\]J\j\[$DBLUE\])\[\033(0\]qqq\[\033(B\](\[$LBLUE\]\D{%H:%M %A %d - %B %Y}\[$DBLUE\])\n\[\033(0\]t\[\033(B\]\[\033(0\]q\[\033(B\](\[\[$LBLUE\]\w\[$DBLUE\])\n\[\033(0\]mqq\[\033(B\]> \[$LBLUE\]"
    else
    PS1="\n\[$DBLUE\]\[\016\]l\[\017\]\[$DRED\](\u@\h)\[$DBLUE\]\[\016\]qqq\[\017\](\[$LBLUE\]H\!\[$DBLUE\])\[\016\]qq\[\017\](\[$LBLUE\]C\#\[$DBLUE\])\[\016\]qq\[\017\](\[$LBLUE\]J\j\[$DBLUE\])\[\016\]qqq\[\017\](\[$LBLUE\]\D{%H:%M %A %d - %B %Y}\[$DBLUE\])\n\[\016\]t\[\017\]\[\016\]q\[\017\](\[\[$LBLUE\]\w\[$DBLUE\])\n\[\016\]mqq\[\017\]> \[$LBLUE\]"
    fi
    PROMPT_COMMAND=prompt_func
    Note that I do not claim to be a good bash programmer, so there might be better ways. This has however worked flawlessly so far, including when su'ing to other users, and switching between tty's and X.
    The code is the same for my other users, except from the colors. Note the
    `sudo fgconsole`
    Sudo proved necessary for non-root users. I added an entry in the sudoers config file to let all users run fgconsole as root without providing a password.
    Okay, that's it. It's a bit dirty, but it solved my problem at least.
    Last edited by Mzg (2010-07-10 07:06:44)

  • Want to do pencil line drawing based on photograph

    PS Elements has a really neat quick line drawing effect.  I'd like to do something similar in PS CS3.  Does anyone know how?  I've been trying the sketch filter, but it doesn't seem quite as nicely done.  Can I use that action out of my elements folder in CS3?  Elements regularly freezes my computer which is why I'm not using it any longer and intend to uninstall soon.
    THanks!

    It all depends on the original.
    You might have success with Image > Mode > Grayscale
    Then increase Contrast via Image > Adjustments
    followed by Filter > Stylize > Find Edges and a Threshold adjustment if necessary.
    You have to experiment!

  • HELP. How do I lock a line to a shape so it will auto extend when dragging the shape?

    How do I lock a line to a shape so it will auto extend when dragging the shape? I cant figure out how to turn this feature on and off.

    Edit: JET got there first but I believe your problem is not as complex as he would have you believe :-)
    Complex? What is simpler for the user than being able to connect pre-shaped text frames (not limited to Illustrator's silly Convert To Shape options) with rules, and then be able to move the text frames and have the rules auto-adjust (automatically avoiding other objects, automatically reshaping right-angle bends, etc. etc,) accordingly. What's "complex" about drawing a flowchart?
    One can properly construct a dozen such diagrams in a program that provides proper connector lines in the time it takes to fuss and twiddle with Illustrator for such a simple task. FreeHand, Draw, Canvas, Visio all provide connector lines features.
    The diagramming features in the draw module of Open Office is as good as any of them for the purpose of mundane decision tree diagrams, org charts, and flowcharts; and OpenOffice can be had for free. The same is true of Inkscape. You can download and install either one in less time than it will take to build a single typical such diagram in Illustrator. Using such tools is vastly more intuitive for a beginner than futzing about with Illustrator's "direct selection" routines.
    JET

  • Smooth line drawing in as3

    I am looking for a smoothe line drawing effect as in the pencil tool in Flash. I need to implement the same using as3. Any idea how I can achieve that?

    Smoothness is a relative concept. Pencil tool in Flash doesn't produce very smooth lines. Nevertheless, runtime drawing smoothness depends on how often you draw lines between points. Here is a quick and dirty drawing board (just paste it on timeline). If you want it even smoother - you will need to write an algorithm that takes into account direction, speed, angles, etc.
    var board:Sprite = new Sprite();
    addChild(board);
    board.x = board.y = 20;
    var g:Graphics = board.graphics;
    g.beginFill(0xcccccc);
    g.drawRect(0, 0, stage.stageWidth - 40, stage.stageHeight - 40);
    g.endFill();
    board.addEventListener(MouseEvent.MOUSE_DOWN, startDraw);
    function draw(e:MouseEvent):void {
         g.lineTo(board.mouseX, board.mouseY);
    function startDraw(e:MouseEvent):void {
         stage.addEventListener(MouseEvent.MOUSE_UP, stopDraw);
         addEventListener(MouseEvent.MOUSE_MOVE, draw);
         g.lineStyle(1, Math.random() * 0xffffff);
         g.moveTo(board.mouseX, board.mouseY);
    function stopDraw(e:MouseEvent):void {
         removeEventListener(MouseEvent.MOUSE_MOVE, draw);
         stage.removeEventListener(MouseEvent.MOUSE_UP, stopDraw);

  • How do I make a line fade?

    http://bhbws.com/images/line_fade.png
    How can I get a line to fade out at the bottom like this one does?  I know how to add the dropshadow but it doesn't fade out at the bottom....
    TIA

    If I wanted to do that (and do it in a non-destructive fashion), I'd draw the the solid white line. Then I'd create square with a gradient fill next to it for the shadow. I'd then group them and go to Commands > Creative > Auto Vector Mask. There's a million different ways to acheive that effect, but that's where I'd personally start.

Maybe you are looking for

  • How can I get my music from a digital book onto my MAC?

    I purchased an album from iTunes using my iPad and now that I want to add it to my daughter's Nook from Mac its not giving me the music to download only the Digital book. How can I get my music and add to my library?

  • Error while saving or submitting the page

    I have an application with sharepoint2010 and in the code behind visual studio 2012,Innitially evry module was working,but now when i am saving or submitting any page its giving me UNEXPECTED error with a co-relation id. I went through the error log,

  • How to: create a Login page with data tags

    hi, how could i create a jsp login page using the data tags.. and how to associate it with the other jsp pages that should be displayed in case of the correct insertion of the password .

  • Satellite internet users cannot connect to Flash based online multiplayer games

    Hello, I have found that Satellite internet users are unable to connect to the game Club Penguin because of the recent security fixes that have been added to the flash player over the last 6 months or so. Club Penguin used to require at least Flash P

  • Graphics In Reports

    I am new to printing reports using LV. As I see it, there are two ways to handle printing: 1) print front panel - this is good because I can print plots, text, etc. but LV seems to throw in extra header stuff at the top that I can't turn off. 2) Prin