# \[FMX\] Loading a .swf into a square container from a button thats within a movie

**URL:** https://forum.kirupa.com/t/fmx-loading-a-swf-into-a-square-container-from-a-button-thats-within-a-movie/8576
**Category:** flash
**Created:** [November 24, 2002, 3:45am UTC](https://forum.kirupa.com/t/fmx-loading-a-swf-into-a-square-container-from-a-button-thats-within-a-movie/8576 "2002-11-24T03:45:53Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![kruza](https://avatars.discourse-cdn.com/v4/letter/k/a9a28c/32.png) [@kruza](https://forum.kirupa.com/u/kruza)
#### Post date: [November 24, 2002, 3:45am UTC](https://forum.kirupa.com/t/fmx-loading-a-swf-into-a-square-container-from-a-button-thats-within-a-movie/8576/1 "2002-11-24T03:45:53Z")

</div>

I would like to know how to load a .swf into a square container  
from a button thats within a movie (button on a sliding menu)

Could someone please post the scripting needed for the button + any others…  
let the container be named “container1” & .swf to be named “sunny.swf”

thanks

---

<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: [November 24, 2002, 10:51am UTC](https://forum.kirupa.com/t/fmx-loading-a-swf-into-a-square-container-from-a-button-thats-within-a-movie/8576/2 "2002-11-24T10:51:43Z")

</div>

Check this tutorial:

[http://www.kirupa.com/developer/mx/loading.asp](http://www.kirupa.com/developer/mx/loading.asp)

and about the button script, add this code into ur \_root (main) timeline:

```php
myButton.onRelease = function(){
//Insert the script from the tutorial here
}

```

Yoiurs,  
h88

---

<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: [November 26, 2002, 1:22am UTC](https://forum.kirupa.com/t/fmx-loading-a-swf-into-a-square-container-from-a-button-thats-within-a-movie/8576/3 "2002-11-26T01:22:56Z")

</div>

ok i worked it out and now i have the .SWF loaded but i would like it to load into a “specific” sized container.  
How to i define this in the code for the conatiner?

---

<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: [November 26, 2002, 1:25am UTC](https://forum.kirupa.com/t/fmx-loading-a-swf-into-a-square-container-from-a-button-thats-within-a-movie/8576/4 "2002-11-26T01:25:51Z")

</div>

> “specific” sized container

Well, other than your image size, Try \_xscale and \_yscale, be aware, this will scale your images by percents.

---

<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: [November 26, 2002, 2:35am UTC](https://forum.kirupa.com/t/fmx-loading-a-swf-into-a-square-container-from-a-button-thats-within-a-movie/8576/5 "2002-11-26T02:35:05Z")

</div>

so i can’t determine the actual size of the .SWF when loaded?

because eventually i would like to load some projects of mine into a .SWF gallery much like a photo gallery

---

<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: [November 26, 2002, 2:39am UTC](https://forum.kirupa.com/t/fmx-loading-a-swf-into-a-square-container-from-a-button-thats-within-a-movie/8576/6 "2002-11-26T02:39:34Z")

</div>

Okay, here:

```php
container._width = 100
container._height = 100

```

Tell me how it goes!

yours,  
h88

---

<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: [November 26, 2002, 2:49am UTC](https://forum.kirupa.com/t/fmx-loading-a-swf-into-a-square-container-from-a-button-thats-within-a-movie/8576/7 "2002-11-26T02:49:59Z")

</div>

i thought it was something like that…

but i inserted that code and no go…

when i click the button it doesn’t _edit_| LOAD …

---

<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: [November 26, 2002, 2:51am UTC](https://forum.kirupa.com/t/fmx-loading-a-swf-into-a-square-container-from-a-button-thats-within-a-movie/8576/8 "2002-11-26T02:51:10Z")

</div>

Can u zip up all your folder :q:Fla, images, etc. and attach it here?

---

<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: [November 26, 2002, 2:56am UTC](https://forum.kirupa.com/t/fmx-loading-a-swf-into-a-square-container-from-a-button-thats-within-a-movie/8576/9 "2002-11-26T02:56:34Z")

</div>

i can’t upload at the moment…but i will do later…

for the moment this is what i have in frame 1 scene 1

[COLOR=blue]MyButton.onPress = function () {  
\_root.createEmptyMovieClip(“container”, 1);  
loadMovie(“sunnyvale.swf”, “container”);  
container.\_width = 402 ;  
container.\_height = 402 ;  
container.\_x = 507 ;  
container.\_y = 11 ;[/COLOR]

and obviously a button called “MyButton” on one of the other frames…

---

<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: [November 26, 2002, 3:03am UTC](https://forum.kirupa.com/t/fmx-loading-a-swf-into-a-square-container-from-a-button-thats-within-a-movie/8576/10 "2002-11-26T03:03:54Z")

</div>

Okay, check the fla, and tell me how it goes, works fine here: 🙂

---

<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: [November 26, 2002, 3:08am UTC](https://forum.kirupa.com/t/fmx-loading-a-swf-into-a-square-container-from-a-button-thats-within-a-movie/8576/11 "2002-11-26T03:08:18Z")

</div>

sorry, attachment:

---

<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: [November 26, 2002, 3:24am UTC](https://forum.kirupa.com/t/fmx-loading-a-swf-into-a-square-container-from-a-button-thats-within-a-movie/8576/12 "2002-11-26T03:24:47Z")

</div>

ok for some reason

\_width & \_height don’t work…but yscale & xscale do work…

---

<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: [November 26, 2002, 3:26am UTC](https://forum.kirupa.com/t/fmx-loading-a-swf-into-a-square-container-from-a-button-thats-within-a-movie/8576/13 "2002-11-26T03:26:20Z")

</div>

Hmm, then ur reporting success, or u want it using \_height and \_width :q:

---

<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: [November 26, 2002, 3:31am UTC](https://forum.kirupa.com/t/fmx-loading-a-swf-into-a-square-container-from-a-button-thats-within-a-movie/8576/14 "2002-11-26T03:31:23Z")

</div>

yeh i want the \_width & \_height setup…

otherwise it works with x&yscale…but not to the desired effect…

maybe i will have to try something different ?
