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
agaripian
Posts: 133
Registered: ‎12-02-2010
My Device: Z10 & Dev Alpha C

Re: Jittery Scrolling on Spark List/Scroller in New Emulator?

 


TheDarkIn1978 wrote:

any list component that was not designed for mobile is probably using MouseEvent.MOUSE_MOVE for dragging.  MouseEvent.MOUSE_MOVE is a very expensive, often wasteful process and should be entirely avoided on mobile applications.

 

an easy work around is to stop the MouseEvent.MOUSE_MOVE event as soon as it's been triggered and call another method that doesn't continuously waste cycles.

 

here's an example that i use for clicking and dragging objects:

 

 

//Mouse Move Event Handler
private function mouseMoveEventHandler(evt:MouseEvent):void
	{
	evt.stopImmediatePropagation();
	
	removeEventListener(MouseEvent.CLICK, mouseClickEventHandler);
	removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveEventHandler);
	
	mouseMoveEventBypass();
	}
	
//Mouse Move Event Bypass
private function mouseMoveEventBypass():void
	{
	startDrag();
		
	addEventListener(MouseEvent.MOUSE_UP, mouseUpEventHandler);
	addEventListener(MouseEvent.MOUSE_OUT, mouseUpEventHandler);
	
	velocityTimer.start();
	}

 

 


How would I apply this to a list? Do I have overide certain methods? If you post some sample code for the list I will try it out on the PlayBook and let everyone know if the performance actually increases from this change. BTW isnt the flex hero list supposed to be mobile optimized??

 

---------------------------------------------------------------------
Developer of Stocks for Blackberry 10
Please use plain text.
Developer
TheDarkIn1978
Posts: 409
Registered: ‎12-10-2010
My Device: PlayBook

Re: Jittery Scrolling on Spark List/Scroller in New Emulator?

[ Edited ]

applying this to a list would be quite simple:

 

1.  on MouseEvent.MOUSE_DOWN within the list object, you save the local y coordinate to a variable.  let's call it originY.

 

2.  on MouseEvent.MOUSE_MOVE, remove MouseEvent.MOUSE_MOVE event listener and call a new function that activates a new Event.ENTER_FRAME, updating the local y coordinate to another variable.  let's call the new variable motionY.

 

3.  programatically scroll the list using the list's scrolling property (the Flash IDE List component uses a property called verticalScrollPosition, i dont' know about the Flex List component) using the equation:  scrollPositionY = motionY - originY;

 

4.  it would be a good idea to create a buffer zone for your list dragging, say about 10 pixels before the list will move so it's not as jumpy.  this will make selectable list items easier also.

 

5.  add your own velocity / momentum code.

 

6.  don't forget to remove event listeners - especailly Event.ENTER_FRAME event listeners when they are no longer used.


PlayBook Applications:
Drop Swatch
Please use plain text.
New Contributor
jjcool
Posts: 4
Registered: ‎12-13-2010
My Device: Storm 9550

Re: Jittery Scrolling on Spark List/Scroller in New Emulator?

has this been resolved yet?  I just developed a proof of concept app where it displays a list of customers (about 25) and if you click on the customer it then shows there details and all the items you're allowed to buy (many more, but under 1000).  Both lists scroll very terribly.  If you scroll slowly they don't scroll at all until you move your finger and then they scroll.  I can't work with this and I'm not sure the process of making my flex lists into qnx lists.  I'd be happy to do that if someone could tell me how.

Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Jittery Scrolling on Spark List/Scroller in New Emulator?

Best to use QNX list. RIM does not have control over the Adobe Spark framework.
Please use plain text.
New Contributor
jjcool
Posts: 4
Registered: ‎12-13-2010
My Device: Storm 9550

Re: Jittery Scrolling on Spark List/Scroller in New Emulator?

[ Edited ]

can you point me to some examples on how to do the QNX lists in Flash Builder? I'm new to this.

Please use plain text.
Developer
kylefowler
Posts: 526
Registered: ‎05-17-2009
My Device: 9900

Re: Jittery Scrolling on Spark List/Scroller in New Emulator?

[ Edited ]

There are very few examples out there for the qnx lists but if you search for cellrenderer on the forums you should find some examples. If you are building this with mxml/flex I suggest replacing your mxml declaration of your list with a mx:UiComponent and then add a creationcomplete event handler to the view or component where you can add your QNX list to that component. That way you can use the mxml for the rest of the app but have the improved performance of a qnx list.

Like all of my posts
Please use plain text.