Reputation: 2682
I'm trying to use the Flexpaper APIs but I don't really understand how to go about implementing them.
http://code.google.com/p/flexpaper/wiki/API
I'd like to run a function once the user is on or passed page 10 of the pdf.
How do I go about getting a function to run using the getCurrPage of the Flexpaper API.
Thanks!
Upvotes: 1
Views: 2128
Reputation: 12357
Basically the same as adding event listeners to any object, the following works fine:
<fx:Script>
<![CDATA[
import com.devaldi.events.CurrentPageChangedEvent;
import mx.controls.Alert;
import mx.events.FlexEvent;
private var _pageToWatchFor:int = 3;
private function onCreationComplete(event:FlexEvent):void
{
flexPaperViewer.addEventListener(CurrentPageChangedEvent.PAGE_CHANGED, pageChanged);
}
private function pageChanged(event:CurrentPageChangedEvent):void{
if(event.pageNum == _pageToWatchFor){
Alert.show("Page 3 now being viewed");
}
}
]]>
</fx:Script>
Upvotes: 1