Ask a Question related to Macromedia Flash Actionscript, Design and Development.

  1. #1

    Default Shrink pic and stop

    Hi everyone, I'm a newbie and getting frustrated trying to do this. Any help greatly appreciated. My objective:

    1. Two layers of content
    2. On the uppermost layer, a large jpg (I won't say graphic or movie clip or button, because I don't know which to use).
    3. On the layer beneath, hidden by the jpg in layer one, a picture frame.
    4. I would like the viewer to see the large pic when they view the page. When they click anywhere on the page I would like the jpg to shrink to fit within the picture frame (and stop).

    I know how to tween an image.
    I know how to write a script to make it stop (b/c it's in the tutorial).
    I don't know how to make the movie stay on the first frame until someone clicks, and then have the image shrink on the page.

    Many thanks for advice,
    drew


    drewp88 webforumsuser@macromedia.com Guest

  2. Similar Questions and Discussions

    1. Shrink text without loosing info
      thanks bob, works great!
    2. Shrink Registry (CFVariables)
      Hi We've been having a few problems with our servers recently and looking into it I discovered that the software registry hive on both servers...
    3. Help on Shrink IBDATA1 file
      How can I shrink the file IBDATA1 on MYSQL directory? I use windows 2003. Thanks a lot. Roberto
    4. How to Shrink PDF Files?
      If you are not already doing so, try creating your PDF by making a postscript file and distilling it. The resulting PDF should be incredibly smaller.
    5. Shrink to fit
      Hi I'm very new, trying to do a very simple site for a coming attraction. Here's my plan: 1. Have two layers of content. On the bottom layer, a...
  3. #2

    Default Re:Shrink pic and stop

    assuming your jpg (converted into a movieclip with instance name picMC) is wider and heigher than your picture frame (with instance name frameMC), attached to picMC you can use:
    on(press){
    clearInterval(shrinkI);
    shrinkI=setInterval(shrinkF,50);
    }
    and attached to a timeline frame use:
    function shrinkF() {
    if (picMC._width>=frameMC._width-factorX-2*offsetX) {
    //choose offsetX and offsetY to suit your needs
    picMC._xscale -= factorX; // pick factorX and factorY to suit your needs
    widthDone = 0;
    } else {
    widthDone = 1;
    }
    if (picMC._height>=frameMC._height-factorY-2*offsetY) {
    picMC._yscale -= factorY;
    heightDone = 0;
    } else {
    heightDone = 1;
    }
    picMC._x = frameMC._x+offsetX;
    picMC._y = frameMC._y+offsetY;
    if (widthDone && heightDone) {
    clearInterval(shrinkI);
    }
    }



    kglad webforumsuser@macromedia.com Guest

  4. #3

    Default Re: Shrink pic and stop

    ok here we go;

    ok I am assuming you have on the _root. a.k.a maintimeline and didn't do any
    timeline action like tween or something else.

    Now choose your jpeg press f8 make it graphic. then return to mantimeline
    again and choose it and press f8 again and now choose movieclip. What we
    have achieved so far is we have a jpeg that is graphic nested in a
    movieclip.

    now assuming we are in the timeline of the jpeg movieclip put a keyframe on
    the frame you like ( this changes directly the speed of the tween, like if
    you put at 5 and you have a 20fps swf, it would take 0.25 seconds to
    complete and so on) then assuming you have put a keyframe on the 10th frame
    on the timeline shoose the jpeg again in the 10 frame and resize it to your
    needs.

    now what was your needs? You wanted to put this shrinking image to a picture
    frame, so make another layer in the jpeg mc and put it beneath the jpeg and
    make sure they are going to the same frame together. so when let's say on
    the fram1 0 you should be having a jpeg that fits the picture frame.

    now put a stop action at the first and the last frame and go back to the
    maintimeline again.
    now what do we have, we have jpeg movieclip residing on the maintimeline.
    and beneath we have our picture frame but we don't see it now because it is
    under the jpeg. (also it is in the jpeg_mc movieclip)

    now you can do two things

    make a new layer and name it actions and choose the first frame and press f9
    and write this.

    this.onPress = function() {
    jpeg_mc.gotoAndPlay(2);
    }

    now test it...

    this is just introductionary, you can fit yourself with the tutorials.
    hth



    "drewp88" <webforumsuser@macromedia.com> wrote in message
    news:bv8m6h$4h4$1@forums.macromedia.com...
    > Hi everyone, I'm a newbie and getting frustrated trying to do this. Any
    help greatly appreciated. My objective:
    >
    > 1. Two layers of content
    > 2. On the uppermost layer, a large jpg (I won't say graphic or movie clip
    or button, because I don't know which to use).
    > 3. On the layer beneath, hidden by the jpg in layer one, a picture frame.
    > 4. I would like the viewer to see the large pic when they view the page.
    When they click anywhere on the page I would like the jpg to shrink to fit
    within the picture frame (and stop).
    >
    > I know how to tween an image.
    > I know how to write a script to make it stop (b/c it's in the tutorial).
    > I don't know how to make the movie stay on the first frame until someone
    clicks, and then have the image shrink on the page.
    >
    > Many thanks for advice,
    > drew
    >
    >

    ilti Guest

  5. #4

    Default Re:Shrink pic and stop

    thanks kglad. so, it's easier than I thought (NOT!).

    Holy cow...I had no idea it would take so much scripting. Guess I have a ton to learn. Q: are the scripts you offered available in the Actions panel, or are they custom?

    -d


    drewp88 webforumsuser@macromedia.com Guest

  6. #5

    Default Re:Shrink pic and stop

    ok, i've tried this and have the following questions/observations:

    1. clearly it's way over my head, but i appreciate it and i'm trying to get it
    2. re the statement "and attached to a timeline frame" confuses me b/c there's only one frame in this simle example, and it doesn't indicate whether this should be attached to the upper or lower layer. or, am i supposed to add a keyframe to the timeline?
    3. if i knew a little bit more about the language i would be doing better. for example, the statement

    if (picMC._width>=frameMC._width-factorX-2*offsetX)

    reads to me, "if the width of picMC is greater than or equal to the width of frameMC less some factor less two times some other factor (called "offset"...i assume the location of one of the objects)"

    is this the right way to read it? if so great, but i'm still lost...what do the factors represent?

    Thanks again,
    Drew


    drewp88 webforumsuser@macromedia.com Guest

  7. #6

    Default Re:Shrink pic and stop

    2. attach that part of the code to your only movie frame (1).
    3. factorX is the amount of shrinkage per loop. adjusting factorX will adjust how rapidly your picMC shrinks. offsetX is the "width" of your picture frame. that's not the _width of the picture frame movieclip, but how much of your frame you want visible. for example, you don't want to have your picture and picture frame left and top aligned. you want some offset so the picture appears to fit within the frame.
    p.s. you your picMC and frameMC should have registration points at the top left.


    kglad webforumsuser@macromedia.com 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