Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 22nd, 2011, 05:40 PM
Tuskony Tuskony is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 43 Tuskony User rank is Sergeant Major (2000 - 5000 Reputation Level)Tuskony User rank is Sergeant Major (2000 - 5000 Reputation Level)Tuskony User rank is Sergeant Major (2000 - 5000 Reputation Level)Tuskony User rank is Sergeant Major (2000 - 5000 Reputation Level)Tuskony User rank is Sergeant Major (2000 - 5000 Reputation Level)Tuskony User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 10 h 42 m 58 sec
Reputation Power: 32
Arrow ActionScript 3 - Need help with a dynamic display and scroll bars

Hey guys,

I have a file uploader that uses a file reference list (FRL) to upload files. However what I want to do is use the FRL to display all the images/files that were selected and then display them in either a list, or photo gallery. I would lean more towards the photo gallery approach but I don't know how to dynamically lay out the thumbnails properly.

What's the best way to display the thumbnails in rows 3 pictures wide and then skip down a line etc.

Now ofcourse I don't know how many files will be selected so my next question would be can I draw the thumbnail gallery in a seperate container (or frame sort of like in VB) and then have that container have it's own scroll bars?

In most other programming languages I would have no problem doing this but I am a bit new to flash and I am a bit stumped.

Thanks for any advice or direction!

Reply With Quote
  #2  
Old May 23rd, 2011, 05:09 PM
ahillecke ahillecke is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2010
Posts: 27 ahillecke User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 7 m 14 sec
Reputation Power: 0
I recently made a memory/concentration game where I randomly picked 8 pairs out of 20 cards and then randomly assigned them to places in the grid using this code:

Code:
//place cards in window
for (p=1; p<=numCards; p++){
	var card:Card = new Card(); //new sprite
	card.x=(((p%colCt)+1) * wid) - wid +18;
	card.y=(trunc((p-1)/colCt)) * wid + 5;

	this.addChild(card); //puts it on stage
}


Essentially, it loops through a list of cards (numCards=cardsChosen.length). Each run through creates a Card (custom class that inherits from MovieClip). I assign it a horizontal (x) position. wid is the width of the cards plus spacing (if your images are all the same size, you can assign wid explicitly somewhere, otherwise, you'll probably have to calculate the width you want). I added 18 to the width to offset from the edge of the stage, same for the 5 in the vertical (y) position. trunc is a custom function:

Code:
function trunc(val:Number):Number {
	trace("function trunc");
	var num = val.toString();
	var float = num.indexOf(".");
	if (float<0){
		return val;
	}
	else{
		return Number(num.substr(0,float));
	}
}


If you don't want to create a custom class (like my Card class), you could put all the images in a movieClip (each in a different frame, with stop() in an added action layer that spans across the keyframes of the movieClip), and then before adding it to the stage, you can put card.gotoAndStop(chosenImg);

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > ActionScript 3 - Need help with a dynamic display and scroll bars

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap