A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: drawing api bug

  1. #1
    President, save the
    New Zealand dollar foundation

    Join Date
    Jun 2000
    Posts
    1,743

    drawing api bug

    I have map labels, comprised of a central "dot", a filled rectangle, and a textfield populated with text.
    something like this ASCII:
    Code:
      *
       \
        \
        _\________________
       |                  |
       | label text here  |
       |__________________|
    get it?

    I'm using the drawing API to draw the filled rectangles, and creating/populating the textfields with actionscript also.
    as in the ASCII, the labels have a dot as their center point, and an API drawn "string" that connects the dot and the label. The dot stays fixed while the label is draggable. The "string" redraws as the label is dragged, so it always connects the two.

    I hope that description is adequate, I don't have an example to post sorry.

    my problem is this:
    the drawing API drawn shapes, and the "string" that connects the dot and label, wipe out the dynamic text on other labels, and the text in the label being dragged flickers also.

    I've tried attaching stage-drawn shapes for the labels, and they don't affect the text at all, but,
    I want to use the drawing API to do this, as the text size varies - the labels potentially have to be different sizes.

    does anyone have a trick, something like "updateAfterEvent" that somehow makes the text NOT flicker/disappear ??
    I've tried everything obvious, I'm posting in the hope that someone has experienced this in the past and has a lovely little trick that will take my pain away.

    cheers.
    b+

  2. #2
    President, save the
    New Zealand dollar foundation

    Join Date
    Jun 2000
    Posts
    1,743
    another observation:

    it only seems to occur when the labels _x position is negative (to the left of the dot)
    and also only affects other labels if they are to the left of the dot also (I have some labels to the right of the dot and they seem fine)

    drat and darn.
    b+

  3. #3
    Senior Member
    Join Date
    Nov 2003
    Location
    Las Vegas
    Posts
    770
    Are you drawing on the same level as the textfield(s)? This may be one issue.

    Instead of using the drawing api for the rectangles, try using a rectangle shape and setting it's _width and _height to that of the textfield after the text is loaded. Then just use the drawing api to connect the dot to the label (with the drawn line in it's own mc).

  4. #4
    President, save the
    New Zealand dollar foundation

    Join Date
    Jun 2000
    Posts
    1,743
    thanks for the thoughts Jerry,

    no, they're not on the same level (drawing something on the same level would overwrite anything else drawn on that level)

    the reason I'm using the drawing API in this case:
    the text is being loaded in dynamically and the length of it is therefore variable. So the label needs to be able to increase/decrease in size to fit the text.
    Along with that, the label box is a rounded rectangle, so to make it scale when attaching graphics from the library requires 9 separate pieces (so it can scale both _x and _y)
    Theres also an "_alpha'd out slightly bigger duplicate rounded rectangle" behind it, acting as a drop shadow.

    The drawing API method means that I can measure the textWidth, wrap the text if needed, and draw the label and its shadow accordingly.

    It's all definitely doable attaching graphics from the library, but far more elegant to draw it with a few lines of code in the perfect size for my text. or so I thought.....

    All that, along with the niceness of drawing all my stuff with code made me want to go in this direction (I even have little shields for state highways all drawn with code)
    shame a dirty little bug has to ruin it all for me

    thanks for the input, haven't had many replies at all so its greatly appreciated.
    b+

  5. #5
    Senior Member
    Join Date
    Nov 2003
    Location
    Las Vegas
    Posts
    770
    I understand your desire to do this elegantly, but it does seem to be a bug (have you checked the bug reports?).

    Perhaps you will have to go back to the old F5 method of creating a movieclip with a diagonal line, and scaling it's x/y scale properties to the proper size based on pythag's theorem. Still pretty elegant, only requires a couple of lines of code.

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center