I've got this code in AS3
var products:Array; var list:Sprite = new Sprite(); function complete(e:Event):void { addChild(list); products = JSON.parse(loader5.data) as Array; for(var i:int = 0, l:int = products.length - 1; l >= 0; i++, l--){ createListItem(i, products[l]); if(products.length >=10){ next.visible=true; } } showList(); }
It displays a list of all the products contains in my table database.
Now I added if(products.length >=10){
and it's working.
I would like to add :
if(products.length >=10){ What shoud I put here for showing only 10 products. next.visible=true; next.addEventListener(MouseEvent.CLICK, show10Next); } function show10Next(event:MouseEvent){ What should I put here for showing the 10 next products ? }
I've tried createListItem(i, products[10]); but it's showing me the product number 10 x times. How can I tell the code to show me the 10 first products only ?
Thx