Packagede.mightypirates.megazine
Interfacepublic interface IMegaZine extends flash.events.IEventDispatcher
ImplementorsMegaZine

Interface for the MegaZine class, to be used in (external) elements. The reason the actual class is not used for external elements is to make the files smaller. They do not need to instantiate a MegaZine class, so they only need to know what methods they can call.



Public Properties
 PropertyDefined by
  currentAnchor : String
[read-only] Returns the anchor name of the page currently being displayed.
IMegaZine
  currentPage : uint
[read-only] Returns the number of the currently 'focused' page, i.e.
IMegaZine
  draggingEnabled : Boolean
Whether to currently allow mouse interaction with pages.
IMegaZine
  flipState : String
[read-only] Get the current page flipping state of this instance (turning or not).
IMegaZine
  leftToRight : Boolean
[read-only] Tells whether the book is read from left to right (true) or right to left (false).
IMegaZine
  localizer : Localizer
[read-only] The localizer instance used throughout the book to localize gui elements / page elements.
IMegaZine
  muted : Boolean
The mute state for all elements that support it.
IMegaZine
  pageCount : uint
[read-only] Get the number of pages in the book.
IMegaZine
  pageHeight : uint
[read-only] Get the default height for pages
IMegaZine
  pageOffset : int
[read-only] Get the pages offset for the book, i.e.
IMegaZine
  pageWidth : uint
[read-only] Get the default width for pages
IMegaZine
  reflection : Boolean
Get the current setting for reflection useage
IMegaZine
  shadows : Boolean
Get the state of shadow useage for pages
IMegaZine
  stage : Stage
[read-only] Get the stage the megazine object resides on.
IMegaZine
  state : String
[read-only] Get the current state of this instance
IMegaZine
  xml : XML
[read-only] The underlying XML data used to describe the book, starting at the root node (book).
IMegaZine
  zoomState : String
[read-only] Get the current zoom state of this instance (open or closed).
IMegaZine
Public Methods
 MethodDefined by
  
firstPage(instant:Boolean = false):void
Turn to the first page of the book.
IMegaZine
  
getAbsPath(url:String, protocols:Array = null):String
Converts relative paths to absolute paths, using the location of the swf holding the megazine as the base location all paths are relative to.
IMegaZine
  
Returns the element referred to by the given id.
IMegaZine
  
getPage(page:uint):IPage
Returns the page with the given number.
IMegaZine
  
getPageInfos():String
Lists some basic information about all pages in the book.
IMegaZine
  
getThumbnailsFor(page:int):Array
Gets the thumbnails for the left and right page for the given page.
IMegaZine
  
gotoAnchor(id:String, instant:Boolean = false):void
Go to the page with the specified anchor as specified in the xml.
IMegaZine
  
gotoPage(page:uint, instant:Boolean = false):void
Go to the page with the specified number.
IMegaZine
  
lastPage(instant:Boolean = false):void
Turn to the last page of the book.
IMegaZine
  
load(xml:XML = null):void
Begin loading the megazine.
IMegaZine
  
nextPage(instant:Boolean = false):void
Turn to the next page in the book.
IMegaZine
  
openZoom(galleryOrPath:String, page:uint, number:int = -1):void
Open the zoom mode for the image with the given path.
IMegaZine
  
prevPage(instant:Boolean = false):void
Turn to the previous page in the book.
IMegaZine
  
registerGalleryImage(gallery:String, page:uint, paths:Dictionary):uint
Allow pages containing images with hires images belonging to a gallery to register those images.
IMegaZine
  
slideStart():void
Start the slideshow mode.
IMegaZine
  
slideStop():void
Stop slideshow.
IMegaZine
  
zoomIn():Boolean
Try to zoom in, if the zoom is open.
IMegaZine
  
zoomOut():Boolean
Try to zoom out, if the zoom is open.
IMegaZine
Events
 EventSummaryDefined by
   Dispatched when the page turning state changes (pages turning <-> no pages turning).IMegaZine
   Dispatched when the all sounds should be muted.IMegaZine
   Dispatched when the current page changes.IMegaZine
   Dispatched when the slideshow starts.IMegaZine
   Dispatched when the slideshow stops.IMegaZine
   Dispatched when the status changes.IMegaZine
   Dispatched when all sounds should be unmuted.IMegaZine
   Dispatched when the gallery image changes.IMegaZine
   Dispatched when the zoom mode is opened or closed.IMegaZine
Property detail
currentAnchorproperty
currentAnchor:String  [read-only]

Returns the anchor name of the page currently being displayed. If the page has no anchor defined, the anchor of the chapter is returned. If the chapter has no anchor defined, null is returned. This first checks for an anchor in the left page, then in the right page. I.e. if an anchor is set in both pages, the left one is returned.

Implementation
    public function get currentAnchor():String
currentPageproperty 
currentPage:uint  [read-only]

Returns the number of the currently 'focused' page, i.e. the page the book is opened on when there is no page turn active. If a page is turned this will hold the future main page. If multiple pages are turned it will be updated rapidly and always return current main page. This will always be an even number, i.e. the number of the page on the right, starting the count at 0.

Implementation
    public function get currentPage():uint
draggingEnabledproperty 
draggingEnabled:Boolean  [read-write]

Whether to currently allow mouse interaction with pages.

Implementation
    public function get draggingEnabled():Boolean
    public function set draggingEnabled(value:Boolean):void
flipStateproperty 
flipState:String  [read-only]

Get the current page flipping state of this instance (turning or not).

Implementation
    public function get flipState():String
leftToRightproperty 
leftToRight:Boolean  [read-only]

Tells whether the book is read from left to right (true) or right to left (false).

Implementation
    public function get leftToRight():Boolean
localizerproperty 
localizer:Localizer  [read-only]

The localizer instance used throughout the book to localize gui elements / page elements.

Implementation
    public function get localizer():Localizer
mutedproperty 
muted:Boolean  [read-write]

The mute state for all elements that support it.

Implementation
    public function get muted():Boolean
    public function set muted(value:Boolean):void
pageCountproperty 
pageCount:uint  [read-only]

Get the number of pages in the book.

Implementation
    public function get pageCount():uint
pageHeightproperty 
pageHeight:uint  [read-only]

Get the default height for pages

Implementation
    public function get pageHeight():uint
pageOffsetproperty 
pageOffset:int  [read-only]

Get the pages offset for the book, i.e. the number added to the actual page number before it is displayed below the book.

Implementation
    public function get pageOffset():int
pageWidthproperty 
pageWidth:uint  [read-only]

Get the default width for pages

Implementation
    public function get pageWidth():uint
reflectionproperty 
reflection:Boolean  [read-write]

Get the current setting for reflection useage

Implementation
    public function get reflection():Boolean
    public function set reflection(value:Boolean):void
shadowsproperty 
shadows:Boolean  [read-write]

Get the state of shadow useage for pages

Implementation
    public function get shadows():Boolean
    public function set shadows(value:Boolean):void
stageproperty 
stage:Stage  [read-only]

Get the stage the megazine object resides on. Used by elements for setup when they themselves have not yet been added to the stage.

Implementation
    public function get stage():Stage
stateproperty 
state:String  [read-only]

Get the current state of this instance

Implementation
    public function get state():String
xmlproperty 
xml:XML  [read-only]

The underlying XML data used to describe the book, starting at the root node (book). This is the raw form of the XML data as loaded from file. This will return null if the XML data has not been loaded yet. The xml will be completely interpreted after it was loaded, so changes to this datastructure will not have any effect, and are not recommended, to avoid inconsistencies with other components accessing this variable later on.

Implementation
    public function get xml():XML
zoomStateproperty 
zoomState:String  [read-only]

Get the current zoom state of this instance (open or closed).

Implementation
    public function get zoomState():String

See also

de.mightypirates.megazine.MegaZine.ZOOM_STATUS_OPEN
de.mightypirates.megazine.MegaZine.ZOOM_STATUS_CLOSED
Method detail
firstPage()method
public function firstPage(instant:Boolean = false):void

Turn to the first page of the book. If there is currently a page turn animation in progress this method does nothing.

Parameters
instant:Boolean (default = false) — No animation, but instantly going to the page.
getAbsPath()method 
public function getAbsPath(url:String, protocols:Array = null):String

Converts relative paths to absolute paths, using the location of the swf holding the megazine as the base location all paths are relative to. If the url starts with one of the allowed protocol types assume the url is already absolute and return it as it was, else add the absolute path component and return it.

Parameters
url:String — The original path/url.
 
protocols:Array (default = null) — Array of allowed protocols that will be recognized. Per default the following protocols are recognized: http, https, file. Protocols must be defined with the completely, i.e. up to the point where the actual address starts. E.g. http is defined as http://

Returns
String — The absolute path to the location specified in the given url.
getElementById()method 
public function getElementById(id:String):IElement

Returns the element referred to by the given id. If no such element is known the function returns null.

Parameters
id:String — The id of the element.

Returns
IElement — The element (the wrapper class, actually, so you'll have to check yourself if it's actually loaded.
getPage()method 
public function getPage(page:uint):IPage

Returns the page with the given number. If the number is invalid, null is returned.

Parameters
page:uint — the number of the page to get. Must be between 0 and pageCount - 1.

Returns
IPage — the page with the given number, or null if the number is invalid.
getPageInfos()method 
public function getPageInfos():String

Lists some basic information about all pages in the book.

Returns
String — A string with information on the pages, separated by newlines.
getThumbnailsFor()method 
public function getThumbnailsFor(page:int):Array

Gets the thumbnails for the left and right page for the given page.

Parameters
page:int — The page number for which to get the left and right page.

Returns
Array — An array with the left page at 0 and the right at 1.
gotoAnchor()method 
public function gotoAnchor(id:String, instant:Boolean = false):void

Go to the page with the specified anchor as specified in the xml. Chapter anchors are handled via this method as well, because their anchors are just mapped to their first page. If there is no such anchor it is checked whether it is a predefined anchor. Predefined anchors are: first, last, next, prev. If it is no predefined anchor it is checked whether a number was passed, and ich yes it is interpreted as a page number. If that fails too, nothing will happen. If there is currently a page turn animation in progress this method does nothing.

Parameters
id:String — The anchor id, predefined anchorname or page number.
 
instant:Boolean (default = false) — No animation, but instantly going to the page.
gotoPage()method 
public function gotoPage(page:uint, instant:Boolean = false):void

Go to the page with the specified number. Numeration begins with zero. If the number does not exist the method call is ignored. If there is currently a page turn animation in progress this method does nothing.

Parameters
page:uint — The number of the page to go to.
 
instant:Boolean (default = false) — No animation, but instantly going to the page.
lastPage()method 
public function lastPage(instant:Boolean = false):void

Turn to the last page of the book. If there is currently a page turn animation in progress this method does nothing.

Parameters
instant:Boolean (default = false) — No animation, but instantly going to the page.
load()method 
public function load(xml:XML = null):void

Begin loading the megazine. Only has an effect while the megazine is in the PREINIT state. Starts loading the xml file with the megazine configuration and parses it plus generates all pages defined. Then loads the gui and sounds. After that the state is changed to READY. At the same time the actual content for the pages is loaded. If not specified otherwise in the constructor, this method is automatically called as soon as the megazine object is added to the stage.

Parameters
xml:XML (default = null) — XML data may be given directly, in which case it won't try to load external data (which might have been specified in the constructor).
nextPage()method 
public function nextPage(instant:Boolean = false):void

Turn to the next page in the book. If there is no next page nothing happens. If there is currently a page turn animation in progress this method does nothing.

Parameters
instant:Boolean (default = false) — No animation, but instantly going to the page.
openZoom()method 
public function openZoom(galleryOrPath:String, page:uint, number:int = -1):void

Open the zoom mode for the image with the given path. The image is then loaded by the zoom container and displayed in full resolution. Pages and navigation / gui is hidden while the zoom is open. Alternatively a gallery name can be passed. In that case it is also necessary to pass a proper page number (of a page with images that are contained in that gallery) and the number of the image on that page. If set up accordingly this opens fullscreen mode. This only works if the call was initially triggered by a user action, such as a mouse click or key press.

Parameters
galleryOrPath:String — The url to the image to load into the zoom frame, or the name of a gallery.
 
page:uint — The number of the page the image object referencing to the gallery image resides in.
 
number:int (default = -1) — Only needed when a gallery name was passed. The number of the image in its containing page (only images in the same gallery count).
prevPage()method 
public function prevPage(instant:Boolean = false):void

Turn to the previous page in the book. If there is no previous page nothing happens. If there is currently a page turn animation in progress this method does nothing.

Parameters
instant:Boolean (default = false) — No animation, but instantly going to the page.
registerGalleryImage()method 
public function registerGalleryImage(gallery:String, page:uint, paths:Dictionary):uint

Allow pages containing images with hires images belonging to a gallery to register those images. In general, it can be used to register gallery images which can then be cycled through when opening a gallery via the openZoom function.

Parameters
gallery:String — The name of the gallery.
 
page:uint — The page on which the image resides.
 
paths:Dictionary — The (localized) urls to the image. Entry format: dict[langID] = pathURL

Returns
uint — The number of the registered image, relative to the page. This is to be understood as a tertiary index, with the gallery as the first one and the page as the second.
slideStart()method 
public function slideStart():void

Start the slideshow mode. If the current page has a delay of more than one second the first page turn is immediate (otherwise the user might get the impression nothing happened). Every next page turn will take place based on the delay stored for the current page. When the end of the book is reached the slideshow is automatically stopped. If slideshow is already active this method does nothing. Fires a MegaZineEvent.SLIDE_START event for this megazine object.

slideStop()method 
public function slideStop():void

Stop slideshow. If the slideshow is already stopped this method does nothing. Fires a MegaZineEvent.SLIDE_STOP event for this megazine object.

zoomIn()method 
public function zoomIn():Boolean

Try to zoom in, if the zoom is open. If it cannot be zoomed in any further, nothing happens.

Returns
Boolean — true if zoom is open, else false.
zoomOut()method 
public function zoomOut():Boolean

Try to zoom out, if the zoom is open. If it cannot be zoomed out any further, nothing happens.

Returns
Boolean — true if zoom is open, else false.
Event detail
flip_status_changeevent 
Event object type: de.mightypirates.megazine.events.MegaZineEvent
MegaZineEvent.type property = de.mightypirates.megazine.events.MegaZineEvent.FLIP_STATUS_CHANGE

Dispatched when the page turning state changes (pages turning <-> no pages turning).

Dispatched when the page turning status changes.

muteevent  
Event object type: de.mightypirates.megazine.events.MegaZineEvent
MegaZineEvent.type property = de.mightypirates.megazine.events.MegaZineEvent.MUTE

Dispatched when the all sounds should be muted.

Dispatched to inform elements to mute themselves.

page_changeevent  
Event object type: de.mightypirates.megazine.events.MegaZineEvent
MegaZineEvent.type property = de.mightypirates.megazine.events.MegaZineEvent.PAGE_CHANGE

Dispatched when the current page changes.

Dispatched when the current page changes.

slide_startevent  
Event object type: de.mightypirates.megazine.events.MegaZineEvent
MegaZineEvent.type property = de.mightypirates.megazine.events.MegaZineEvent.SLIDE_START

Dispatched when the slideshow starts.

Dispatched when slideshow starts.

slide_stopevent  
Event object type: de.mightypirates.megazine.events.MegaZineEvent
MegaZineEvent.type property = de.mightypirates.megazine.events.MegaZineEvent.SLIDE_STOP

Dispatched when the slideshow stops.

Dispatched when slideshow stops.

status_changeevent  
Event object type: de.mightypirates.megazine.events.MegaZineEvent
MegaZineEvent.type property = de.mightypirates.megazine.events.MegaZineEvent.STATUS_CHANGE

Dispatched when the status changes.

Dispatched when the status changes.

unmuteevent  
Event object type: de.mightypirates.megazine.events.MegaZineEvent
MegaZineEvent.type property = de.mightypirates.megazine.events.MegaZineEvent.UNMUTE

Dispatched when all sounds should be unmuted.

Dispatched to inform elements to unmute themselves.

zoom_changedevent  
Event object type: de.mightypirates.megazine.events.MegaZineEvent
MegaZineEvent.type property = de.mightypirates.megazine.events.MegaZineEvent.ZOOM_CHANGED

Dispatched when the gallery image changes.

Navigated to another page via zoom. The page attribute of the event object will be the page of the element that corresponds to the image shown in zoom mode.

zoom_status_changeevent  
Event object type: de.mightypirates.megazine.events.MegaZineEvent
MegaZineEvent.type property = de.mightypirates.megazine.events.MegaZineEvent.ZOOM_STATUS_CHANGE

Dispatched when the zoom mode is opened or closed.

Zoom state changed (between opened or closed). The page attribute of the event object will be the page of the element that corresponds to the image shown in zoom mode when opening the zoom.