PDA

View Full Version : [FMX] Loading a .swf into a square container from a button thats within a movie



kruza
November 23rd, 2002, 10:45 PM
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

h88
November 24th, 2002, 05:51 AM
Check this tutorial:

http://www.kirupa.com/developer/mx/loading.asp

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


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

Yoiurs,
h88

kruza
November 25th, 2002, 08:22 PM
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?

h88
November 25th, 2002, 08:25 PM
"specific" sized container

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

kruza
November 25th, 2002, 09:35 PM
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

h88
November 25th, 2002, 09:39 PM
Okay, here:


container._width = 100
container._height = 100

Tell me how it goes!

yours,
h88

kruza
November 25th, 2002, 09:49 PM
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 ...

h88
November 25th, 2002, 09:51 PM
Can u zip up all your folder :q:Fla, images, etc. and attach it here?

kruza
November 25th, 2002, 09:56 PM
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

MyButton.onPress = function () {
_root.createEmptyMovieClip("container", 1);
loadMovie("sunnyvale.swf", "container");
container._width = 402 ;
container._height = 402 ;
container._x = 507 ;
container._y = 11 ;

and obviously a button called "MyButton" on one of the other frames...

h88
November 25th, 2002, 10:03 PM
Okay, check the fla, and tell me how it goes, works fine here: :)

h88
November 25th, 2002, 10:08 PM
sorry, attachment:

kruza
November 25th, 2002, 10:24 PM
ok for some reason

_width & _height don't work....but yscale & xscale do work...

h88
November 25th, 2002, 10:26 PM
Hmm, then ur reporting success, or u want it using _height and _width :q:

kruza
November 25th, 2002, 10:31 PM
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 ?