How it's done?

i have posted last time on how to scale using as.what i mean is…take a look at , the content box change into different size when clicked on the other section.i tried to do something like that few times but it just didn’t work.can anyone show me where i can find the tutorial or tell me how to do that?


Here you have two functions. the first one is to rescale the box first in width and then in height:

function rescale(clip, targXS, targYS) {
diffXS = targXS-clip._xscale;
diffYS = targYS-clip._yscale;
clip.onEnterFrame = function() {
if (clip._xscale != targXS) {
clip._xscale += diffXS/20;
} else {
if (clip._yscale != targYS) {
	clip._yscale += diffYS/20;
} else {
	delete clip.onEnterFrame;

and the button action:

// use different values for the different buttons
test_btn.onRelease = function() {
targXS = Math.random()*200+100;
targYS = Math.random()*200+100;
rescale(this._parent.yourMC, targXS, targYS);

The second function rescales the width and height for the box at the same time:

function rescale (clip, width, height, speed){
clip.onEnterFrame = function(){
endW = width - this._width;
this._width += endW / speed;
endH = height - this._height;
this._height += endH / speed;
if (Math.abs(endW)<1){
this._width = width;
delete this.onEnterFrame

and for the buttons:

// use different values for the different buttons
test_btn.onRelease = function() {
rescale (yourMC, 300, 300, 4)

I hope this is what you mean :slight_smile:

it consists of just a few methods: loadMovie, a loadbar, and a Tween.
when the code loads a movie (loadbar) or picture it recieves the dimensions when it’s done loading (loadMovie). It then scales the container to the proper dimensions (width/height) with a tween (see mx.transitions.Tween class) for a smooth effect.

That’s really all it takes. The real difficult thing is to make it look so slick! It calls for great design skills.

good luck with that!

media monkey, you use easing, like dboers showed, not a tween.

where to put the codes?in the frame or the MC?

me too really curious about it…when it shrink ready to load another swf then the loader bar dynamically appear…how to do that any hint?

it would be good if someone can provide a simple fla. file

//if statement



//if statement

ello sir…good to hear respons from u sir…

anyway sorry my mistake anyway what i mean is actually the border for the container become border to loadbar when it shrink to load another swf…
my default border is not become loadbar border…because when i attempt to resize the border my fiel become mess up…when it loads swf…

hope u can clear up for me sir…

Here’s a .fla, it’s a little bit different from the code dboers gave you, but the idea is the same. In the button code replace Athos.jpg by the jpg/swf you have.

nice fla there scotty as always :wink: …2 questions for u …

  1. i tried to load a swf…and the border wouldnt grow with it how can i correct that??? (the swf loaded but the border stayed the same)…

  2. i added about 2 or 3 buttons and loaded images in the transition you created. on release of eas button the box slides out to the right couple of pixels how do i control exactly where it goes and how far it goes out?(just incase my canvas size was smaller)?? how i’m not confusing u …

thanks for your help in advance…

Love it Scotty!!:wink:

thanks for the fla scotty…i’ll look it to…

thanks for the fla scotty!

Thank you guys=)
1: give your swf a solid (transparent) background with the dimensions of your swf.
2: this fla was based on the size of jpg/swf and center that. Look at the code dboers gave, there you can set the size/position.


i have one problem with it now…it plays okay when i use it on a jpg file but when i use swf file,it appears outside the container…how to fix that?

Did you read the last thread scotty tells you how to do it…:wink:

Thank you, FlashPlaya=)