Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using motion tweening to "zoom in" on an image

Status
Not open for further replies.

Gurnsy

Technical User
Sep 9, 2003
5
0
0
GB
Hello,
I'm very new at using Flash MX so apologies for the newbie question.

I am trying to use motion tweening to move between two jpg's, one of which is 10% bigger than the other.

The effect I'm after is that you "zoom in" slowly on the static image over the duration of the tween.

Now I've managed to get it to work by converting the jpg's to symbols but the problem is that the tween grows the image so that exceeds the boundaries of the stage.

What I'd like to do is to increase the size of the final tweened image but not have the stage grow in size.

Is this possible please?

Best regards and thanks,
Gurnsy
 
make them movie clips and give them instance names

not quite sure what you want but see how close this is

say the one getting larger is called bigger(instance name)

then add this code to the timeline

i = 0;
increase = setInterval(enlarge,500);
function enlarge(){
i++
bigger._xscale +=i
bigger._yscale +=i
if(i==10)
clearInterval(increase)
}
 
Hello Bill,

Many thanks for the information. :)

I've done the following:
- imported a jpg image
- converted this to a movie symbol called "chaos"
- added an instance of this to frame 1 (instance name "chaos")
- I've then added your example script as an action on frame 1 against the instance of "chaos"

The script reads thus:
i = 0;
increase = setInterval(enlarge,500);
function enlarge(){
i++
chaos._xscale +=i
chaos._yscale +=i
if(i==10)
clearInterval(increase)
}

Unfortunately, when I check the script for errors I get the following errors:

Scene=Scene 1, Layer=Layer 1, Frame=1: Line 1: Statement must appear within on/onClipEvent handler
i = 0;

Scene=Scene 1, Layer=Layer 1, Frame=1: Line 2: Statement must appear within on/onClipEvent handler
increase = setInterval(enlarge,500);

Scene=Scene 1, Layer=Layer 1, Frame=1: Line 3: Statement must appear within on/onClipEvent handler
function enlarge(){

However if add the same script to "Actions for frame1 of layer name Layer 1" (as opposed to the chaos instance) the "check script for errors" reports no errors.

Do you have ideas what I'm doing wrong here please?

Many thanks and regards,
Gurnsy
 
The code needs something to trigger its start before it will run.

I was thinking that you might want to place the original symbol and the enlarged one x frames apart on the same time line, and then create a mask layer above this time line and have the mask animated, which gives you full control over what parts of the enlarged image are visible on the main stage.
 
sounds like you have the code in the wrong place

the code must be in the frame actions...not attached to the clip
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top