Ask a Question related to Macromedia Flash Actionscript, Design and Development.
-
drewp88 webforumsuser@macromedia.com #1
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
-
Shrink text without loosing info
thanks bob, works great! -
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... -
Help on Shrink IBDATA1 file
How can I shrink the file IBDATA1 on MYSQL directory? I use windows 2003. Thanks a lot. Roberto -
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. -
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... -
kglad webforumsuser@macromedia.com #2
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
-
ilti #3
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...help greatly appreciated. My objective:> Hi everyone, I'm a newbie and getting frustrated trying to do this. Anyor button, because I don't know which to use).>
> 1. Two layers of content
> 2. On the uppermost layer, a large jpg (I won't say graphic or movie clipWhen they click anywhere on the page I would like the jpg to shrink to fit> 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.
within the picture frame (and stop).clicks, and then have the image shrink on the page.>
> 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
>
> Many thanks for advice,
> drew
>
>
ilti Guest
-
drewp88 webforumsuser@macromedia.com #4
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
-
drewp88 webforumsuser@macromedia.com #5
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
-
kglad webforumsuser@macromedia.com #6
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



Reply With Quote

