Hi all,
I'm working on a project that contains lots of photos with different widths/heights. When a thumbnail image within flash (which is a button) is pressed the popup will open a detailed image inside it. The popup should resize to the size of the photo loaded within it.
i'm not sure if i understand exactly what you need but i have an idea regarding the code for the pop-up:
I've created a .fla file and attached it here so that it might help a bit more.
1st i've declared 2 variables on the 1st frame, which are "var xscale and var yscale".
Then i've created 2 thumbnails images. Converted them both to a movie clip (or button if you want to. Either will do as you can attach an "on (rollover)" handler).
I also created a movie clip with the images (which are 2 different sizes), full size (the idea is that when you rollover a thumnail, it tells this movie clip to jump to certain frame and stop). To this movie clip I've attached a script:
onClipEvent (enterFrame) {
_root.xscale = this._width;
_root.yscale = this._height;
}
What this is doing is that at every moment of the clip it is setting the 2 variables declared at the start to it's width and height. As the 2 images in the clip are different sizes, the variables will change when going from one image to the next.
Finally, i've created a last movie clip (the popUp) as a border for the images and i've attached the following code:
onClipEvent (enterFrame) {
this._width = _root.xscale+3;
this._height = _root.yscale+3;
}
This is setting it's width and height to the the variables value + 3, so that it looks like a border.
Hi OnAir,
Thankyou for your script..that helped alot.
How difficult would it be to create a popup through javascript that auto resize depeding on the image loaded?
glad that script helped you out.
Unfortunatly I won't be able to help you out on the javascript question, as i don't actually know any javascript (even though actionScript is supposed to be similar to it).
Hopefully someone else will be able to help you out on that one.
OnAir, I can't open it either on MX only... Are you on Mac?
If so your MX only .fla also has to be zipped up to be able to open it on PC.
If you're on PC, then you didn't save it as a MX only format.
I've tried saving it again but i don't actualy think it'll work.
I went to "File - Save As" and in the "Save as type", choose Flash MX document. It then gives a message saying:
"This file contains the following data that will be lost if saved in the Flash MX format:
-Unicode
-ActionScript 2.0
-Persistent Library Data
Continue with save?"
1st time round i thought it was a standard message. Is it ?