Jump to content


Stage has gone really small using LiquidStage

Recommended Posts

Hello again,


I have been working on a simple image gallery which dynamically loads at runtime. On image is the tiny thumbnail which goes into it's own movieclip and the other is the larger bigPic which, once the thumbnail is clicked gets loaded into it's own larger movieclip. Like I said a pretty basic image gallery and everything was working great until I added more thumbnails. At the moment the stage is wide enough to fit 12 thumbnails on it, the rest are sitting off stage. I've made it so that each gallery is an swf file that just loaded and unloaded into the main swf file. I have used the LiquidStage and Area so that the whole site gets resized when the html browser is resized. When I previewed the swf as an html file when on 12 thumbnails were sitting on the stage is displayed perfectly and everything looked good, but like I said, when I added more thumbnails the whole site became really small! I can't work out why the gallery is now really small on the screen with the additional thumbnails sitting off screen. I'm thinking maybe it's because I using the createAround(); method to wrap around my main swf stage but I thought that using the calculateVisable might only use what's visible and ignore the thumbnails sitting off stage. I'm thinking that since I've added extra thumbnails to the image gallery that has made the swf really wide and thanks why when it loads into the main swf the LiquidStage is resizing it properly but just relative to is now enormous size. Is there anyway of getting around this?


I've uploaded a zip file with both the image gallery and main flash file and all the mock images, so you can hopefully see for yourself what's going on. If anyone has experience this before I love to know how you solved it if at all, otherwise any pointers will be, as always much appreciated!






Link to comment
Share on other sites

I'm on the road right now, so I didn't have time to download and look at your files, but it sounds like the problem has to do with the fact that the container you attached to the LiquidArea has children (your extra images) that go way off the edge which affects the container's width/height. So imagine you've got a Sprite that is 400 pixels wide and then you add a 100-pixel wide image but its x-position is 500. That means the new width would be 600. Since you told LiquidArea to fit that Sprite into its area, it now has to shrink the 600-pixel wide Sprite into its area.


The solution? You can use the new "customBoundsTarget special property which allows you to basically define a separate DisplayObject to use when LiquidArea figures out the size. Think of it like a clipping shape. So in your case, let's say you want your Sprite to act like it's 400x400 even if you have images inside going way off the edge. You could create an invisible Shape object that's 400x400 inside your Sprite. Then use that as the customBoundsTarget when you attach() the Sprite.


http://greensock.com/as/docs/tween/com/ ... tArea.html

Link to comment
Share on other sites

Thanks for the suggestion of using the CustomBoundsTarget property, I'll have a look as the documentation now. But I had one question about using it. Like I said, I've got one swf file that is acting as the main stage for the various image galleries. These img galleries are externally loaded and unloaded but they also contain the images that run off the stage. Nothing runs off stage in the main swf. So would using the customBoundsTarget property on the main flash file still clip the images that run off the stage in the externally loaded swfs? Also is using a movieclip to wrap up the site contents ok instead of using a sprite which you referred to in your reply?

Link to comment
Share on other sites

Sure, you can use a MovieClip if you prefer. Sprites are basically the same thing but less memory.


As far as the customBoundsTarget, I'm not sure what you're asking. If you define one, it will be honored. It will use that target to determine the size/position. Give it a shot and hopefully you'll see how it works relatively quickly.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.