A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: how to keep an internal movie the original size when the parent movie is scaled?

  1. #1
    Senior Member
    Join Date
    Jun 2001
    Posts
    104

    how to keep an internal movie the original size when the parent movie is scaled?

    What I am trying to do is to make my own scrollbar component. I have made them before but always have to custom build it. What I would like to do is to build a component.

    The problem I can't seem to find an answer to is that when you stretch the component in author mode, the buttons (movies) stretch, I don't want them to stretch. Actually, don't care if they stretch in author mode, but what them the original size in runtime.

    I have torn apart the original scrollbar, but can't see where it solves that problem..

    anyone got an answer to this one?

    Jim
    Jim Booth

  2. #2
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    I assume you're talking about stretching the body of the scrollbar, but not stretching the "thumb" or the buttons on either end.

    In the following example, I'm assuming you're making a vertical scrollbar, although the same principles apply for a horitontal one as well.

    One method you might consider is making the part that stretches a 'sibling' to the parts that don't stretch (rather than a 'parent').

    You'd have a parent object which doesn't stretch (scrollbar). It contains the following parts:

    scrollbar.bar (stretches)
    scrollbar.up_arrow (doesn't stretch)
    scrollbar.down_arrow (doesn't stretch)
    scrollbar.thumb (doesn't stretch)

    Another method would be to compute the scale of the parts that don't stretch as the inversion of the parent object's scale. So when the parent object is at 200%, the parts that don't stretch are at 50%.

    Here's the math:

    ratio = bar._yscale / 100;
    thumb._yscale = 100 * 1/ratio;

    This reduces algebraically to:

    thumb._yscale = 100*(100/bar._yscale);

    or

    thumb._yscale = 10000/bar._yscale;

  3. #3
    Senior Member
    Join Date
    Jun 2001
    Posts
    104
    Hey jbum,

    i really like your idea of the sibling, not sure exactly what you mean there, any chance you could elaborate on it or point me to a site this is discussed? I will do some searches on the web for this as well..

    thanks jbum.. got me started on a different solution..

    jim
    Jim Booth

  4. #4
    Senior Member
    Join Date
    Jun 2001
    Posts
    104
    i think it just occurred to me what you were suggesting.. that when i drag the component on the the stage, i edit it, and stretch the scrollbar, rather than the up and down arrows.. that would work i think.. maybe just edit in place to line up with the textfield..
    Jim Booth

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