# How it's done?

**URL:** <https://forum.kirupa.com/t/how-its-done/61115>\
**Category:** Uncategorized\
**Created:** [August 16, 2004, 6:44am UTC](https://forum.kirupa.com/t/how-its-done/61115 "2004-08-16T06:44:13Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![elwatie](https://avatars.discourse-cdn.com/v4/letter/e/a587f6/32.png) [@elwatie](https://forum.kirupa.com/u/elwatie)\
**Post date:** [August 16, 2004, 6:44am UTC](https://forum.kirupa.com/t/how-its-done/61115/1 "2004-08-16T06:44:13Z")

</div>

i have posted last time on how to scale using as.what i mean is…take a look at [www.itworks.com.pt](http://www.itworks.com.pt) , 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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2004, 11:22am UTC](https://forum.kirupa.com/t/how-its-done/61115/2 "2004-08-16T11:22:58Z")

</div>

Hi,

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

```auto
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:

```auto

// 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:

```auto
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:

```auto

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

```

I hope this is what you mean 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2004, 11:25am UTC](https://forum.kirupa.com/t/how-its-done/61115/3 "2004-08-16T11:25:57Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2004, 1:51pm UTC](https://forum.kirupa.com/t/how-its-done/61115/4 "2004-08-16T13:51:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 19, 2004, 1:09am UTC](https://forum.kirupa.com/t/how-its-done/61115/5 "2004-08-19T01:09:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 19, 2004, 2:20am UTC](https://forum.kirupa.com/t/how-its-done/61115/6 "2004-08-19T02:20:30Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 19, 2004, 3:08am UTC](https://forum.kirupa.com/t/how-its-done/61115/7 "2004-08-19T03:08:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 19, 2004, 6:14am UTC](https://forum.kirupa.com/t/how-its-done/61115/8 "2004-08-19T06:14:13Z")

</div>

> [@pixeldude](#):
>
> 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?

```auto
//code
//if statement
loadBar._visible=1;

```

?

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 19, 2004, 7:58am UTC](https://forum.kirupa.com/t/how-its-done/61115/9 "2004-08-19T07:58:20Z")

</div>

```auto

//code
//if statement
loadBar._visible=1;

```

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…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 19, 2004, 10:34am UTC](https://forum.kirupa.com/t/how-its-done/61115/10 "2004-08-19T10:34:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 19, 2004, 7:00pm UTC](https://forum.kirupa.com/t/how-its-done/61115/11 "2004-08-19T19:00:53Z")

</div>

nice fla there scotty as always 😉 …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…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 19, 2004, 10:03pm UTC](https://forum.kirupa.com/t/how-its-done/61115/12 "2004-08-19T22:03:33Z")

</div>

Love it Scotty!!😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 20, 2004, 2:12am UTC](https://forum.kirupa.com/t/how-its-done/61115/13 "2004-08-20T02:12:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 20, 2004, 3:19am UTC](https://forum.kirupa.com/t/how-its-done/61115/14 "2004-08-20T03:19:52Z")

</div>

thanks for the fla scotty!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 20, 2004, 6:51am UTC](https://forum.kirupa.com/t/how-its-done/61115/15 "2004-08-20T06:51:48Z")

</div>

Thank you guys=)  
@ramo_integ  
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.

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 21, 2004, 7:40am UTC](https://forum.kirupa.com/t/how-its-done/61115/16 "2004-08-21T07:40:43Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 21, 2004, 5:52pm UTC](https://forum.kirupa.com/t/how-its-done/61115/17 "2004-08-21T17:52:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 22, 2004, 4:57pm UTC](https://forum.kirupa.com/t/how-its-done/61115/18 "2004-08-22T16:57:02Z")

</div>

Thank you, FlashPlaya=)

scotty(-:
