Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Highlighted
Contributor
Posts: 42
Registered: ‎01-05-2011
My Device: Not Specified
Accepted Solution

Re: Container Objects Stacked One on Top of Another Instead of in a Column in ScrollPane

Hey All,

 

I'm trying to figure out how laying out objects in the Container class works...

 

I got scrolling of my ScrollPane working, but for some reason the images I add to my container are stacked on top of eachother instead of a tall column....

 

Here's my code:

 

 

scroller=new ScrollPane();
scroller.width=1024;
scroller.height=600;
this.addChild(scroller);

container=new Container();
container.flow=ContainerFlow.VERTICAL
container.align = ContainerAlign.NEAR;
container.padding = 200;
scroller.addScrollContent(container);


for each (var photo:Photo in list)
{
var url:String='http://farm' + photo.farmId + '.static.flickr.com/' + photo.server + '/' + photo.id + '_' + photo.secret + '_s.jpg';
var thumb:Thumb=new Thumb(url, photo);
thumb.addEventListener("allLoaded", position, false, 0, true);
container.addChild(thumb);
}


private function position(event:Event=null):void
{
container.layout();
scroller.update();
}

 

I thought the padding param of the container had to be adjusted, but changing that value doesn't affect placement of the children being added to the container.

 

I want to load a bunch of images and add them to a container as a column that is scrollable. Simple right??

 

Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Container Objects Stacked One on Top of Another Instead of in a Column in ScrollPane

hey,

 

containers are a pretty moody bunch. i usually dislike em. i think i ran into this issue a few times. most of the times the reason why they arent laying out properly is because i didnt use the setSize method and set the size of the container. try setting the size and see what happens. good luck!

 

Example:

 

 

container.setSize(1024, 1200);

 

 

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Contributor
Posts: 42
Registered: ‎01-05-2011
My Device: Not Specified

Re: Container Objects Stacked One on Top of Another Instead of in a Column in ScrollPane

[ Edited ]

Wow. Quick reply. I tried setSize() method for the container and it worked right away. Thanks!

Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Container Objects Stacked One on Top of Another Instead of in a Column in ScrollPane

we try our best around here -  just glad we could help Smiley Happy

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman