Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 01-28-2004, 01:47 PM   #1
Registered User
Join Date: Jan 2004
Posts: 1
Default Shrink to fit

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 (hiding the picture frame beneath). 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,

ps - i did post this to macromedia flash support boards. is it kosher to cross post? I received a (generous) reply there that was complicated (for me, again I'm new and not a programmer), but I'm trying to parse it. I am looking for (hopefully) something simpler. The reply (from kglad) was as follows:

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:
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) {
drewp2 is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT. The time now is 02:22 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.