draw line on top of bitmap

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default draw line on top of bitmap

    Hi, I am trying to draw bitmap on canvas and then lines on top of the
    bitmap. My code is attached. I found that the lines is alwasy
    underneath the bitmap and thus not visuable. How can I fix it?

    Thanks,

    var loader:Loader = Loader(event.target.loader);
    var image:Bitmap = Bitmap(loader.content);
    var bitmapHolder:UIComponent = new UIComponent();
    var mySprite:Sprite = new Sprite();
    mySprite.addChild(image);
    bitmapHolder.addChild(mySprite);
    canvas.height = image.height;
    canvas.width = image.width;
    canvas.addChild(loader);

    canvas.graphics.lineStyle(2, 0xff0000, 1);
    canvas.graphics.moveTo(-100, -100);
    canvas.graphics.lineTo(200, 200);

    finecur Guest

  2. Similar Questions and Discussions

    1. Draw line using Acrobat SDK
      I want to draw line on pdf page. I have x,y coordinate depend upon that i want to draw line on page. Thanks in advance
    2. draw line as a Component
      hi all, I have a Cancas A, then I want to display a line as A's display child but not a A's graphic child, how can I do it? thanks steve
    3. Flag for permitting bitmap.draw permission
      Justin Everet mentioned in his blog that you can set a flag in FMS3 which permits the bitmap.draw() function on a video object connected to an rtmp...
    4. 3D Draw Line?
      Hi, I'm very new to 3D so I'm not sure if this is basic or not. I've created 2D hierarchical tree-structures in the past in using flash and I'm...
    5. draw a line
      is it possible to draw a simple line from one point to another. i only want to use two points. i think that the #wire mode will not do the job...
  3. #2

    Default Re: draw line on top of bitmap

    What I did to solve this problem was make the background of my
    Drawable Component transparent, and then position it on top of another
    canvas with the desired background colour.

    This works nicely, and means you can use your drawable component to
    draw over anything aswell.

    There is a sample application and sample code on my blog:
    [url]http://www.munkiihouse.com/?p=4[/url]

    Hope that helps
    Tony

    On Sep 27, 3:23 am, finecur <fine...@yahoo.com> wrote:
    > Hi, I am trying to draw bitmap on canvas and then lines on top of the
    > bitmap. My code is attached. I found that the lines is alwasy
    > underneath the bitmap and thus not visuable. How can I fix it?
    >
    > Thanks,
    >
    > var loader:Loader = Loader(event.target.loader);
    > var image:Bitmap = Bitmap(loader.content);
    > var bitmapHolder:UIComponent = new UIComponent();
    > var mySprite:Sprite = new Sprite();
    > mySprite.addChild(image);
    > bitmapHolder.addChild(mySprite);
    > canvas.height = image.height;
    > canvas.width = image.width;
    > canvas.addChild(loader);
    >
    > canvas.graphics.lineStyle(2, 0xff0000, 1);
    > canvas.graphics.moveTo(-100, -100);
    > canvas.graphics.lineTo(200, 200);

    Munkii Guest

  4. #3

    Default Re: draw line on top of bitmap

    On Oct 5, 2:43 pm, Munkii <tfend...@gmail.com> wrote:
    > What I did to solve this problem was make the background of my
    > Drawable Component transparent, and then position it on top of another
    > canvas with the desired background colour.
    >
    > This works nicely, and means you can use your drawable component to
    > draw over anything aswell.
    >
    > There is a sample application and sample code on my blog:[url]http://www.munkiihouse.com/?p=4[/url]
    >
    > Hope that helps
    > Tony
    >
    > On Sep 27, 3:23 am, finecur <fine...@yahoo.com> wrote:
    >
    > > Hi, I am trying to draw bitmap on canvas and then lines on top of the
    > > bitmap. My code is attached. I found that the lines is alwasy
    > > underneath the bitmap and thus not visuable. How can I fix it?
    >
    > > Thanks,
    >
    > > var loader:Loader = Loader(event.target.loader);
    > > var image:Bitmap = Bitmap(loader.content);
    > > var bitmapHolder:UIComponent = new UIComponent();
    > > var mySprite:Sprite = new Sprite();
    > > mySprite.addChild(image);
    > > bitmapHolder.addChild(mySprite);
    > > canvas.height = image.height;
    > > canvas.width = image.width;
    > > canvas.addChild(loader);
    >
    > > canvas.graphics.lineStyle(2, 0xff0000, 1);
    > > canvas.graphics.moveTo(-100, -100);
    > > canvas.graphics.lineTo(200, 200);
    Wow! What a simple and useful tool. Any idea about how to save that
    drawing as an image or swf with the click of a button. I am working
    on a social network and would like to allow users to draw a logo for
    themselves. I would like to add flash like drawing and text
    features. With the powerful actionscript 3 classes, I bet this
    wouldn't be terribly difficult. Can someone try to implement these
    features?

    baberuth Guest

  5. #4

    Default Re: draw line on top of bitmap

    In Flex3 you can do this through the ImageSnapshot class. This is a
    convenience class to capture the appearance of any control

    In Flex2 this is a little more complicated. You have to create a
    BitmapData class, and then call draw function on the bitmap data
    object to get an image of the control. From there you can turn it
    into an image or save it out to a server etc

    Munkii Guest

  6. #5

    Default Re: draw line on top of bitmap

    var loader:Loader = Loader(event.target.loader);
    var image:Bitmap = Bitmap(loader.content);
    var bitmapHolder:UIComponent = new UIComponent();
    var mySprite:Sprite = new Sprite();
    mySprite.addChild(image);
    bitmapHolder.addChild(mySprite);
    canv.height = image.height;
    canv.width = image.width;
    canv.addChild(loader);

    Property loader not found on mx.controls.Button and there is no default value . i got this error on a button click
    basava Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139