Author Topic: MegaZine.getPageAnchor - where?  (Read 1212 times)

marison

  • Jr. Member
  • **
  • Posts: 42
MegaZine.getPageAnchor - where?
« on: July 12, 2009, 06:15:13 pm »
According to the new version:
Change: the 'page' property of zoom state change event objects (as well as the new zoom change events) now represents the number of the page the currently displayed image's base version resides in. Use MegaZine.getPageAnchor(uint) if you need the anchor name of a page.


But where's the "getPageAnchor" function? I couldn't found it in megazine.js
Then I created one :

getPageAnchor : function(page){
        return Megazine.getMovie().getPageAnchor(page);
    },


But it doesn't work.

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1985
  • MegaZine3 Developer
    • MegaZine3
Re: MegaZine.getPageAnchor - where?
« Reply #1 on: July 18, 2009, 09:53:07 pm »
Gah, sorry. Seems I forgot to finish that when I started it...

The function is already in the MegaZine class, but not yet in the JavaScript interface.

To get it, please add this to the IMegaZine interface:
Code: (actionscript3)
  1.        /**
  2.          * Looks up the anchor associated with this page. If it exists, returns that, if
  3.          * not returns null.
  4.          *
  5.          * @param page The page for which to look up the anchor.
  6.          * @return The anchor associated with the given page.
  7.          */
  8.        function getPageAnchor(page : uint) : String;
  9.  

and this to the JSConnector class
Code: (actionscript3)
  1. // In 'init()'
  2.            ExternalInterface.addCallback("getPageAnchor", getPageAnchor);
  3.  
  4. // And this function
  5.        /**
  6.          * Looks up the anchor associated with this page. If it exists, returns that, if
  7.          * not returns null.
  8.          *
  9.          * @param page The page for which to look up the anchor.
  10.          * @return The anchor associated with the given page.
  11.          */
  12.        public static function getPageAnchor(page : uint) : String {
  13.            if (_mz != null) return _mz.getPageAnchor(page);
  14.            else throw new IllegalOperationError("No MegaZine instance set!");
  15.        }
  16.  

Then recompile the megazine.swf
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.

marison

  • Jr. Member
  • **
  • Posts: 42
Re: MegaZine.getPageAnchor - where?
« Reply #2 on: July 18, 2009, 11:08:28 pm »
Yes, I've already did it :) I posted just to let you know.

thanks

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1985
  • MegaZine3 Developer
    • MegaZine3
Re: MegaZine.getPageAnchor - where?
« Reply #3 on: July 22, 2009, 10:15:40 am »
Good to hear :)

Well, it'll be in there per default starting next version (1.38) ;)
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.