FLASH >> dynamic photo sizing
- Started
- Last post
- 5 Responses
- jevad
You know what I mean...there's quite a few sites that do it where you have a photo gallery or jsut a next button and the bg of the photo expands or contracts depending on the image size and then the photo loads.
How is this done?
ta
- jevad0
help a poor brutha out man!
- finnpimp0
doing stuff with movieclips while they're dynamicly loading images can be tricky, but there are ways I've heard of but never tested.
check out my site behind the profile. I know it's crap and just a beta, but there's a frame that goes around every pic displayed. This frame is resized and positioned by an MovieClip.onLoad event. It's not smooth but it works. Having it animate in a smooth way would be kinda cool too.
Or then you could have the bg run a constant onclipevent (enterframe) and resize itself according to the content.
did that answer something remotely relevant?
- jevad0
nice photos dude.
Yeah thats kinda what I want to do - smooth transition.
You given me ideas though - thanks!
- finnpimp0
oh, and if you do the enterFrame on the bg, you could also have it constantly run an x and y variable. when it loads a new image, it takes the new width and height (not yet revealing the image) and then do some serious math. I don't have the script here, but if you just divide the difference between the old width and the new width by 2, you should get a value that approaches (smoothly) the new width, thereby creating a nice animation.
about. I could elaborate it a bit more, but get the idea? have the bg change it's size constantly according to that "smooth-factor" :)
- finnpimp0
ok, so that math part went wrong, but it's something in that style.
notice that running the eventFrame tends to go pretty hard on cpu power, especially while the resizing animation takes place.