Solved

Flash AS2 Thumbnail Grid resize rows and cols

Posted on 2009-05-11
1
757 Views
Last Modified: 2013-11-11
Hey everyone,

I'm trying to create a XML thumbnail gallery that will re size with the stage. I want to have a XML file load the thumbnail but I want the thumbs to distribute based on how wide the movie clip that they are contained with is set to. For example if it's 500 wide they may be 5 thumbnails in the first row but if the stage is re sized and the container movie clip is squat to 300 there may only be 3 thumbnails on the first row....

Although it's a little hard to explain what I'm attempting I found another person asking the same question with an animated example.

Can you guys have a look at: http://board.flashkit.com/board/showthread.php?t=782139 and if anyone has any idea on how this could be accomplished in AS2, your help would be greatly appreciated.

Thanks!
0
Comment
Question by:markm5i
1 Comment
 
LVL 39

Accepted Solution

by:
blue-genie earned 500 total points
ID: 24396176
Hi there.
you say you want the thumbnails to distribute based on how wide the movieclip is. but you want the movieclip to resize according to the stage?

you need to do some maths to get the size of the movieclip. you're not going to resize the thumbnails right you're just going to reduce the number of items per column/row.
off the top of my head this might be rather intensive in terms of processing as you'll need to reload everything each time.

have a look at this example to get the size of the stage.
this.createTextField("stageSize_txt", this.getNextHighestDepth(), 10, 10, 100, 22);
var stageListener:Object = new Object();
stageListener.onResize = function() {
    stageSize_txt.text = "w:"+Stage.width+", h:"+Stage.height;
};
Stage.scaleMode = "noScale";
Stage.addListener(stageListener);


so each time the stage is resized you need to resize the movieclip. then I'm assuming your'e creating movieclips dynamically to load the thumbnails, so you'll need to call the function again.

if you want to make it easier you could hardcode the items.

so use a switch statement for example and say if the stage width is between 100 and 200 do this, if it's between 200-300 do that etc.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now