A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: LineCap=none ,still rendered in _width (bug?)

  1. #1
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560

    LineCap=none ,still rendered in _width (bug?)

    Ok,
    i don't have questions often, but as this might be a bug,
    i am out of ideas:

    I have movieClip with a square in it, which has horizontal lines.
    The caps of the lines i set to "none" as i will need to set/get
    the width of that square without those bloody round caps
    (was giving me headaches in the flash versions b4 8ball).

    But even, if the caps are set to "none" the round ending
    will render into the width of the MC the lines are in.
    Is this a Bug, or is this working as inteded ?

    Just incase i expressed myself unclearly i provide a fla.

    Any other workaround, but setting mc._width = widthWanted+lineThickness?
    Attached Files Attached Files
    My letters on the F1 key have faded, how are yours today?

  2. #2
    Product Designer keyone.it's Avatar
    Join Date
    Aug 2001
    Location
    Rome, Italy.
    Posts
    1,625
    I get it too, it's probably one of those cheap workarounds that Macromedia boys like taking... probably to cut out the rounds, the engine masks the lines (just guessing), or something else really dirty.

    That's what I hate of Flash, it's just cheap, but it comes with and expensive pricetag!


    Ascanio.
    Altruism does not exist. Sustainability must be made profitable.

  3. #3
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    This solves it:

    import flash.geom.Transform;
    var trans1:Transform = new Transform (test1);
    var trans2:Transform = new Transform (test2);
    var trans3:Transform = new Transform (test3);
    var rectObj1:Object = test1.getRect ();
    var rectObj2:Object = test2.getRect ();
    var rectObj3:Object = test3.getRect ();
    t1.text = "_width="+rectObj1.xMax;
    t2.text = "_width="+rectObj2.xMax;
    t3.text = "_width="+rectObj3.xMax;
    - The right of the People to create Flash movies shall not be infringed. -

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Forgot to eliminate the top 4 lines. I had those because of another method:

    trace(trans1.pixelBounds);

    which gives the same as _width.
    - The right of the People to create Flash movies shall not be infringed. -

  5. #5
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560
    Ok, that solves it for reading, good idea, i didn't know that getRect()
    will get the correct values without the caps..

    But mainly i want to set the width, not including the caps of course
    And i don't see the new Rectangle class helping me here... but maybe i
    worked too long to see the solution

    [Edit] i could of course draw the obects by code, but
    that will not comply with my coding, in which all
    graphics are in the fla file.
    My letters on the F1 key have faded, how are yours today?

  6. #6
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    I don't know the solution to that.

    Sometimes we are too much into AS . If you convert the lines to fills everything is fine. How about that? Nobody will notice.
    - The right of the People to create Flash movies shall not be infringed. -

  7. #7
    Senior Member Ray Beez's Avatar
    Join Date
    Jun 2000
    Posts
    2,793
    Are you publishing to ver 8?

  8. #8
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560
    Yes, i am publishing to FP8, that is why i posted in this sub-forum..

    And @ cancer yeah, it is the only solution that works perfect, but
    it is just another workaround... I used that quite a lot.
    My letters on the F1 key have faded, how are yours today?

  9. #9
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Here is your formula to deal with that, for example if you want to increase size etc. wFactor derived from the original drawing size will be the factor you need to use to manipulate the size.

    PHP Code:
    var rectObj1:Object test1.getRect ();
    var 
    rectObj2:Object test2.getRect ();
    var 
    rectObj3:Object test3.getRect ();
    var 
    wFactor1:Number test1._width/rectObj1.xMax;
    var 
    wFactor2:Number test2._width/rectObj2.xMax;
    var 
    wFactor3:Number test3._width/rectObj3.xMax;
    if (
    wFactor1>1) {
        
    setProperty (test1_width350*wFactor1);
        
    trace("w1: "+test1._width);
    } else {
        
    setProperty (test1_width350);
        
    trace("w2: "+test1._width);
    }
    if (
    wFactor2>1) {
        
    setProperty (test2_width350*wFactor2);
        
    trace("w1: "+test2._width);
    } else {
        
    setProperty (test2_width350);
        
    trace("w2: "+test2._width);
    }
    if (
    wFactor3>1) {
        
    setProperty (test3_width350*wFactor3);
        
    trace("w1: "+test3._width);
    } else {
        
    setProperty (test3_width350);
        
    trace("w2: "+test3._width);
    }

    t1.text "_width="+test1._width;
    t2.text "actual _width="+test2._width;
    t3.text "_width="+test3._width
    However, the value for getRect() is not changing, since it measures the actual fla-size width, so you cannot get the new getRect().
    - The right of the People to create Flash movies shall not be infringed. -

  10. #10
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560
    I think that is a good (exact) workaround.. gotto remember that one
    Maybe i put it in straight into my code later
    My letters on the F1 key have faded, how are yours today?

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