11-20-2012 03:27 AM
Hi,
I am trying to add a scrollPane to BB10 AIR application unfortunatly It is deprecated... Afterthat i found Container have the scroll property I tryed to invoke scrollable property to my Container but it is not working. I am Sharing some code snippet please help me what is the wrong in my code
var scrollView:Container = new Container();
scrollView.scrollDirection = ScrollDirection.HORIZONTAL;
scrollView.addChild(menuScrollContainer);
scrollView.visible = true;
scrollView.width = stageWidth-15;
scrollView.height = 70;
scrollView.x = 5;
scrollView.y = (menuContainer.height-scrollView.height)/2;
scrollView.allowScrollPastEdge = true;
.addChild(scrollView);
Thanks
Deepu George Jacob
11-21-2012 01:01 PM
Dustin Malik has posted a working example in the issue tracker:
https://www.blackberry.com/jira/browse/BBTEN-253
My app : Get set - Get up! Get ready for the snooze revolution.
12-14-2012 02:17 AM
Please give a sampile code
12-14-2012 08:22 AM
You should be able to log into the issue tracker with your forum credentials ... but anyway here is Dustin's code:
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.display.StageOrientation;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import qnx.fuse.ui.core.Container;
import qnx.fuse.ui.listClasses.ScrollDirection;
import qnx.fuse.ui.display.Image;
import qnx.fuse.ui.layouts.rowLayout.RowLayout;
[SWF(frameRate="60", backgroundColor="#00FF00")]
public class ContainerDemo extends Sprite
{
private var container:Container;
private var image:Image;
public function ContainerDemo()
{
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
addEventListener(Event.ADDED_TO_STAGE,handleAddedT oStage);
}
private function handleAddedToStage(e:Event):void
{
doStuff();
removeEventListener(Event.ADDED_TO_STAGE,handleAdd edToStage);
// stage is avail, we can now listen for events
stage.addEventListener( Event.RESIZE, onResize );
// force a resize call
onResize(new Event(Event.RESIZE));
}
private function doStuff():void{
//create container
container = new Container();
container.scrollDirection = ScrollDirection.VERTICAL;
container.height = stage.stageHeight;
container.width = stage.stageWidth;
container.vScrollVisible = true;
container.allowScrollPastEdge = true;
//create layout
var row:RowLayout = new RowLayout();
container.layout = row;
row.spacing = 5;
row.padding = 5;
row.debugId = "imageRow";
//create image
image = new Image();
image.addEventListener(Event.COMPLETE, onImageLoaded);
image.setImage("http://farm9.staticflickr.com/8068/8179410953_026d 0ba7d3_k.jpg");
//add container to stage
this.addChild(container);
}
protected function onImageLoaded(event:Event):void
{
//add image to container
container.addChild(image);
}
private function onResize(event:Event):void
{
//portrait
if ( stage.stageHeight > stage.stageWidth ) {
trace("portrait mode");
container.width = stage.stageWidth;
container.height = stage.stageHeight;
//landscape
}else{
trace("landscape mode");
container.width = stage.stageWidth;
container.height = stage.stageHeight;
}
}
}
}
My app : Get set - Get up! Get ready for the snooze revolution.
12-17-2012 05:19 AM
This is not working
12-19-2012 01:57 PM
Hi,
Sorry I was using the wrong layout., Here is some updated code that scroll horizontally and vertically.
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.display.StageOrientation;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import qnx.fuse.ui.core.Container;
import qnx.fuse.ui.listClasses.ScrollDirection;
import qnx.fuse.ui.display.Image;
import qnx.fuse.ui.layouts.gridLayout.GridLayout;
[SWF(frameRate="60", backgroundColor="#00FF00")]
public class DisplayTest extends Sprite
{
private var container:Container;
private var image:Image;
public function DisplayTest()
{
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
addEventListener(Event.ADDED_TO_STAGE,handleAddedT oStage);
}
private function handleAddedToStage(e:Event):void
{
doStuff();
removeEventListener(Event.ADDED_TO_STAGE,handleAdd edToStage);
// stage is avail, we can now listen for events
stage.addEventListener( Event.RESIZE, onResize );
// force a resize call
onResize(new Event(Event.RESIZE));
}
private function doStuff():void{
//create container
container = new Container();
container.scrollDirection = ScrollDirection.BOTH;
container.height = stage.stageHeight;
container.width = stage.stageWidth;
container.hScrollVisible = true;
container.vScrollVisible = true;
container.allowScrollPastEdge = true;
//create layout
var layout:GridLayout = new GridLayout();
layout.padding = 10;
container.layout = layout;
layout.spacing = 5;
layout.padding = 5;
layout.debugId = "imageRow";
//create image
image = new Image();
image.addEventListener(Event.COMPLETE, onImageLoaded);
image.setImage("http://farm9.staticflickr.com/8068/8179410953_026d 0ba7d3_k.jpg");
//add container to stage
this.addChild(container);
}
protected function onImageLoaded(event:Event):void
{
//add image to container
container.addChild(image);
}
private function onResize(event:Event):void
{
//portrait
if ( stage.stageHeight > stage.stageWidth ) {
trace("portrait mode");
container.width = stage.stageWidth;
container.height = stage.stageHeight;
//landscape
}else{
trace("landscape mode");
container.width = stage.stageWidth;
container.height = stage.stageHeight;
}
}
}
}