Flexpaper API example request

2.1k views Asked by At

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!

1

There are 1 answers

0
Drenai On BEST ANSWER

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>