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
Developer
Deepu_George_Jacob
Posts: 235
Registered: ‎12-13-2011
My Device: Curve 9380
My Carrier: Vodafone-IN

Container not scrolling in BB10 devices

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

Please use plain text.
Developer
apman
Posts: 194
Registered: ‎11-12-2010
My Device: Not Specified

Re: Container not scrolling in BB10 devices

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.

 

 

Please use plain text.
Developer
Deepu_George_Jacob
Posts: 235
Registered: ‎12-13-2011
My Device: Curve 9380
My Carrier: Vodafone-IN

Re: Container not scrolling in BB10 devices

Please give a sampile code

Please use plain text.
Developer
apman
Posts: 194
Registered: ‎11-12-2010
My Device: Not Specified

Re: Container not scrolling in BB10 devices

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,handleAddedToStage);

}

private function handleAddedToStage(e:Event):void
{
doStuff();
removeEventListener(Event.ADDED_TO_STAGE,handleAddedToStage);

// 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_026d0ba7d3_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.

Please use plain text.
Developer
Deepu_George_Jacob
Posts: 235
Registered: ‎12-13-2011
My Device: Curve 9380
My Carrier: Vodafone-IN

Re: Container not scrolling in BB10 devices

This is not working

Please use plain text.
BlackBerry Development Advisor (Retired)
dmalik
Posts: 427
Registered: ‎02-22-2012
My Device: BlackBerry Z10, BlackBerry Dev Alpha C, BlackBerry PlayBook
My Carrier: Bell

Re: Container not scrolling in BB10 devices

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,handleAddedToStage);
			
		}
		
		private function handleAddedToStage(e:Event):void
		{
			doStuff();
			removeEventListener(Event.ADDED_TO_STAGE,handleAddedToStage);
			
			// 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_026d0ba7d3_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;
				
			}
			
		}
	}
}

 

Follow me on Twitter: @dustinmalik
-----------------------------------------------------------------------------------------------------
Keep up to date on BlackBerry development: http://devblog.blackberry.com/
Please use plain text.