0) ? true : false; nextVisible = (totalProducts > offset + pageSize) ? true : false; } public function searchClickHandler(event:MouseEvent):void{ var button:Button = event.target as Button; var widget:Object = button.parentDocument; if(button.label == 'Search'){ keywords = widget.keywords.text; if(keywords != ''){ searchProducts(0); button.label = 'Cancel'; widget.keywords.enabled = false; } else { Alert.show('Please enter something to search for.', 'Search Error:'); } } else { keywords = ''; widget.keywords.text = ''; getProducts(0); button.label = 'Search'; widget.keywords.enabled = true; } } private function searchProducts(startID:uint):void{ trace('searching products for '+keywords); amfphp.call('com.almerblank.ISBN8962.Ch7.Products.search', searchResultHandler, faultHandler, keywords, startID); CursorManager.setBusyCursor(); } private function searchResultHandler(result:Array):void{ try { productsDP = new ArrayCollection(result); var total:uint = productsDP.length - 1; pageSize = productsDP.getItemAt(total).pageSize; offset = productsDP.getItemAt(total).offset; totalProducts = productsDP.getItemAt(total).totalProducts; setPageText(); setButtonVisibility(); trace('offset = '+offset+'\npageSize = '+pageSize+'\ntotalProducts = '+totalProducts); } catch(error:*) { trace('search products error: '+error.message); } finally { CursorManager.removeBusyCursor(); } } private function fetchPage(startID:uint):void{ if(keywords != ''){ searchProducts(startID); } else { getProducts(startID); } } private function setPageText():void{ lowLimit = offset+1; highLimit = (totalProducts > 5) ? lowLimit+4 : totalProducts; pageText = 'Displaying items '+lowLimit+' - '+highLimit+' of '+totalProducts; } ]]>