05-01-2012 12:03 AM
I want a simple vertical scrolling space where I can place images and other things. I tried using the fuse container class, but the code below doesn't scroll. Do I need to add a layout? Is the old ScrollPane class better for this?
import flash.display.Sprite;
import flash.events.Event;
import qnx.fuse.ui.core.Container;
import qnx.fuse.ui.listClasses.ScrollDirection;
import qnx.ui.display.Image;
[SWF(height="600", width="1024", frameRate="30")]
public class ContainerDemo extends Sprite
{
private var container:Container;
private var image:Image;
public function ContainerDemo()
{
super();
//create container
container = new Container();
container.scrollDirection = ScrollDirection.VERTICAL;
container.height = stage.stageHeight;
container.width = stage.stageWidth;
container.vScrollVisible = true;
container.allowScrollPastEdge = true;
//create image
image = new Image();
image.addEventListener(Event.COMPLETE, onImageLoaded);
image.setImage("http://farm8.staticflickr.com/7174/6787853901_bd49 c6d82d_o.jpg");
//add container to stage
this.addChild(container);
}
protected function onImageLoaded(event:Event):void
{
//add image to container
container.addChild(image);
}
}
Solved! Go to Solution.
05-01-2012 03:41 PM
Anyone have some quick pointers on doing this? I think if I can figure out this simple example it will help me in understanding the containers.
Also, there seems to be some javascript errors preventing this documentation from showing inherited methods and properties.
05-04-2012 10:14 AM
05-05-2012 02:22 AM
The documentation says the fuse container includes scroll support. That's why I'm thinking I don't need the scroll pane. But this code isn't working.
import flash.display.Sprite;
import flash.events.Event;
import qnx.fuse.ui.core.Container;
import qnx.fuse.ui.display.Image;
import qnx.fuse.ui.events.ScrollEvent;
import qnx.fuse.ui.listClasses.ScrollDirection;
[SWF(height="600", width="1024", frameRate="30")]
public class ContainerDemo extends Sprite
{
private var container:Container;
private var image:Image;
public function ContainerDemo()
{
super();
//create container
container = new Container();
container.scrollDirection = ScrollDirection.VERTICAL;
container.height = stage.stageHeight;
container.width = stage.stageWidth;
container.vScrollVisible = true;
container.allowScrollPastEdge = true;
//create image
image = new Image();
image.addEventListener(Event.COMPLETE, onImageLoaded);
image.setImage("http://farm8.staticflickr.com/7174/6787853901_bd49 c6d82d_o.jpg");
//add container to stage
this.addChild(container);
//listen for scrolling
container.addEventListener(ScrollEvent.SCROLL_BEGI N, onScrollBegin);
container.addEventListener(ScrollEvent.SCROLL_MOVE , onScrollMove);
container.addEventListener(ScrollEvent.SCROLL_END, onScrollEnd);
}
protected function onScrollEnd(event:Event):void
{
trace("scroll end");
}
protected function onScrollMove(event:ScrollEvent):void
{
trace("scroll move");
}
protected function onScrollBegin(event:ScrollEvent):void
{
trace("scroll begin");
}
protected function onImageLoaded(event:Event):void
{
//add image to container
container.addChild(image);
}
}
08-20-2012 08:41 PM
Here's an old thread. Anyone ever get the fuse container to scroll? Finally converting over to it for BB10, but there are no practical examples to scroll something simple. I have a UIComponent that I want to scroll (think chart), and it just sits there.
Please RIM, add examples to all the classes that show basic and advanced features.
08-29-2012 11:16 AM
Amen jtgen,
I'm also trying to get scrolling working. Sent MSohm a message.
08-29-2012 11:25 AM
Scrolling is working for me now.
The problem was that my "Container" object was given the height of the stage, so even though it exceeded the visible height (defined by the presence of an ActionBar), there was nothing to scroll.
The solution was to resize the Container to be the height of the stage minus the height of the ActionBar.
08-29-2012 02:07 PM
I had got this to work by using a StackLayout in conjunction with a Container, but then I realized that StackLayout is different than the Cascades StackLayout and so switched to using RowLayout. But RowLayout isn't working for me since it seems to resize labels to be a single line in height.
So I stopped using the Layout controls and went back to manually positioning Label controls in a Container, and now scrolling isn't working. Perhaps this is what others are finding as well?
09-12-2012 09:52 AM
I ran into the same problem.
I tried to use a StackLayout with a Container - but nothing too. Maybe i did something wrong.
Has someone a working example?
09-12-2012 12:00 PM