Viewer Facade API

From Agnitio WIKI

Jump to: navigation, search

Executing a presentation from within the Agnitio Planner 4.x invokes the "Viewer Facade"-component within the Planner software. When presentations are assembled and published within the Agnitio Manager, the default functionality of the Viewer is also automatically embedded into the presentation, but the default functionality can be overwritten using the Viewer Facade API, to allow content developers a much greater degree of control over how the presentation executes.

The Agnitio Viewer Façade API, is a set of Actionscript-based properties and methods that may be used by Flash presentations content developers, to establish communication between digital assets and the viewer. For example, if you develop an external navigation for Flash presentation, you can get the presentation slides structure as an XML, dynamically build hierarchical menu and change the selected slide in response to user interaction using the Viewer Façade API.

Contents

ViewerFacade properties and methods, General

  • The viewerFacade property is initialized as soon as the asset is loaded into the viewer.
  • Any individual asset on a slide can also leverage Viewer Facade API.
  • Per default, the external navigation asset renders itself by traversing and rendering the presentation structure available at _viewerFacade.slidesXML, but the Mehtod _viewerFacade.changeSlideById() may be used to change the selected slide in response to the user interaction. Add slideChange event listener to update the state considering that the slide can be changed from another asset.

Initiating the Viewer Facade API

To use viewer facade API you have to declare viewerFacade public property on the root:

 public function get viewerFacade() : Object {
       return _viewerFacade;
 }
 
 public function set viewerFacade(viewerFacade : Object) : void {
      _viewerFacade = viewerFacade;
 }
 
 private var _viewerFacade : Object;

The viewerFacade property is initialized as soon as the asset is loaded into the viewer.


Public Properties

  • slidesXML : XML [read-only]
    • The presentation slides structure as an XML, where each slide is a node with id, name attributes and children representing its nested slides:
 <slides>
   <slide id="50890869-A21B-4DCB-4071-7E504CC01B0E" name="Slide 1">
     <slide id="76AB5786-EF94-2F61-F4C0-7E50B696BB67" name="Slide 1.1"/>
     <slide id="6741181B-2F29-107A-7C94-7E50C02B90EB" name="Slide 1.2"/>
     <slide id="41D7039A-205A-39F9-18E8-7E50D028A9C0" name="Slide 1.3"/>
   </slide>
   <slide id="27E5A4E2-BAE4-B6E4-4E5F-7E50791015AC" name="Slide 2">
     <slide id="AAC82C20-6014-5983-8E50-7E51013BD0E1" name="Slide 2.1"/>
   </slide>
   <slide id="1340E117-F4ED-BE8F-1731-7E50925416A5" name="Slide 3">
     <slide id="8B99A8DD-C676-3208-6527-7E5117C10664" name="Slide 3.1"/>
     <slide id="75A23656-77EB-19F7-1E28-7E5148374AD6" name="Slide 3.2"/>
   </slide>
   <slide id="EBE7DCD9-0D7F-3BA9-EAEE-7E5099B73070" name="Slide 4">
     <slide id="29AC1973-2F72-1243-63C2-7E516DD04A17" name="Slide 4.1"/>
   </slide>
   <slide id="46D12786-754F-67F5-AEA2-7E50A0ACF671" name="Slide 5"/>
   <slide id="BADCED12-DF1F-4CDF-ADD8-7E517C18BEBC" name="Slide 6"/>
   <slide id="5BC6F613-E891-FF71-A742-7E518AAEB73A" name="Slide 7"/>
 </slides>
  • documentsXML : XML [read-only]
    • The presentation documents structure as an XML, where each document is a node with id, name attributes and children representing its nested documents/chapters:
 <documents>
   <chapter id="50890869-A21B-4DCB-4071-7E504CC01B0E" name="Chapter 1">
     <document id="1340E117-F4ED-BE8F-1731-7E50925416A5" name="Document 1" />
     <document id="8B99A8DD-C676-3208-6527-7E5117C10664" name="Document 2" />
     <document id="EBE7DCD9-0D7F-3BA9-EAEE-7E5099B73070" name="Document 3">
       <document id="46D12786-754F-67F5-AEA2-7E50A0ACF671" name="Document 3.1" />
       <document id="5BC6F613-E891-FF71-A742-7E518AAEB73A name="Document 3.2" />
      </document>
   </chapter>
   <chapter name="Chapter 2">
     <document id="1340E117-F4ED-BE8F-1731-7E5092523567" name="Document 5" />
     <document id="8B99A8DD-C676-3208-6527-7E5117C10098" name="Document 6" />
   </chapter>
 </documents>
  • referencesXML : XML [read-only]
    • The presentation documents structure as an XML, which refer to current slide, where each slide is a node with id, name attributes and children representing its nested slides:
 <documents>
   <chapter id="50890869-A21B-4DCB-4071-7E504CC01B0E" name="Chapter 1">
     <document id="1340E117-F4ED-BE8F-1731-7E50925416A5" name="Document 1" />
     <document id="8B99A8DD-C676-3208-6527-7E5117C10664" name="Document 2" />
     <document id="EBE7DCD9-0D7F-3BA9-EAEE-7E5099B73070" name="Document 3">
       <document id="46D12786-754F-67F5-AEA2-7E50A0ACF671" name="Document 3.1" />
       <document id="5BC6F613-E891-FF71-A742-7E518AAEB73A name="Document 3.2" />
     </document>
   </chapter>
   <chapter name="Chapter 2">
     <document id="1340E117-F4ED-BE8F-1731-7E5092523567" name="Document 5" />
     <document id="8B99A8DD-C676-3208-6527-7E5117C10098" name="Document 6" />
   </chapter>
 </documents>
  • presentationWidth : int [read-only]
    • The presentation width in pixels.
  • presentationHeight : int [read-only]
    • The presentation height in pixels.
  • phase : String
    • The presentation current phase:
      • "introPhase"
      • "bodyPhase"
      • "exitPhase"
  • clipboard : Object [read-only]
    • Clipboard as a dynamic object:
 (Object)
   curve = (Array)
     [0] 1
     [1] 2
     [2] 4
     [3] 8
     [4] 16
     [5] 32
     [6] 64
   details = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
   efficacy = 4
   position = (Object)
   x = 117
   y = 38
   potency = 3

Public Methods

  • changeSlideById(slideId : String) : void
    • Changes the selected slide to the slide with the id provided:
 changeSlideById("1340E117-F4ED-BE8F-1731-7E50925416A5"); // Slide 3 is selected.
  • changeSlideByName(slideName : String) : void
    • Changes the selected slide to the slide with the name provided:
 changeSlideByName("Slide 5"); // Slide 5 is selected.
  • changeSlideByOffset(offset : Array) : void
    • Changes the selected slide to the slide with the offsets provided:
 changeSlideByOffset([0, 2]); // Slide 1.3 is selected (Slide 1 has 0 index on the root, Slide 1.3 has 2 index among Slide 1 children).
  • hasDocuments() : Boolean
    • Returns true if the presentation use documents and false otherwise.
  • openDocuments(chapterName : String = null, documentName : String = null, page : Number = 1, zoom : Object = "width") : void
    • Opens documents window. Documents window contains all visible documents. Optional parameters allows to open the specific document, select the page and set the zoom level.
  • hasReferences(slideId : String = null) : Boolean
    • Returns true if the slide with the corresponding slide id has references or false otherwise. If slideId is not provided or equals null, the method returns value for the selected slide.
  • openReferences(chapterName : String = null, documentName : String = null, page : Number = 1, zoom : Object = "width") : void
    • Opens references window. References window contains all documents associated with the selected slide. Optional parameters allows to open the specific document, select the page and set the zoom level.
  • startScreensaver() : void
    • Starts screensaver. Screensaver is a semitransparent solid color layer. While screensaver is on, slide monitoring is paused.
  • hasDraw() : Boolean
    • Returns true if the presentation use draw tool option is checked and false otherwise.
  • startDraw() : void
    • Pops up drawing palette and activates drawing mode.
  • hasSignature() : Boolean
    • Returns true if the presentation use signature capture and false otherwise.
  • startSignature() : void
    • Pops up signature capture panel.
  • forward() : void
    • Go to the next slide.
  • backward() : void
    • Go to the previous slide.
  • intro() : void
    • Go to the first intro slide or to the first body slide if there are no intro slides in the presentation.
  • body() : void
    • Go to the first body slide.
  • exit() : void
    • Go to the first exit slide or closes the viewer if there are no exit slides in the presentation.
  • close() : void
    • Closes the viewer.
  • setClipboardProperty(propertyName : String, propertyValue : Object) : void
    • Add the property to the clipboard object or updates the existing one.
  • getClipboardProperty(propertyName : String) : Object
    • Returns the property value from the clipboard object.
  • clearClipboard() : void
    • Cleans the clipboard object.
  • notify(eventKind : String, eventData : Object) : void
    • Dispatches the notify event from the viewerFacade object.
  • loadPresentation(presentationId : String) : void
    • Loads another presentation if the presentation with the id provided is available.
  • loadPresentationById(presentationId : String) : void
    • Loads another presentation if the presentation with the specified id is available.
  • loadPresentationByName(presentationName : String) : void
    • Loads another presentation if the presentation with the specified name is available (supported by Planner 4+ only).

Events

  • slideChange
    • Fired when the selected slide changes.
      • bubbles = false.
      • cancelable = false.
      • kind = "viewerEvent".
      • property = "slideId".
      • oldValue = previous slide id.
      • newValue = new slide id.
  • slideLoad
    • Fired when the slide is loaded.
      • bubbles = false.
      • cancelable = false.
      • kind = "viewerEvent".
      • property = "slideId".
      • oldValue = previous slide id.
      • newValue = new slide id.
  • slideUnload
    • Fired when the slide is unloaded.
      • bubbles = false.
      • cancelable = false.
      • kind = "viewerEvent".
      • property = "slideId".
      • oldValue = previous slide id.
      • newValue = new slide id.
  • notify
    • Fired when notify() method is called.
      • bubbles = false.
      • cancelable = false.
      • kind = eventKind passed as a parameter to notify() method.
      • property = null.
      • oldValue = null.
      • newValue = eventData passed as a parameter to notify() method.
  • presentationLoadComplete
    • Fired when the nested presentation is loaded.
      • bubbles = false.
      • cancelable = false.
      • kind = "viewerEvent".
      • property = null.
      • oldValue = null.
      • newValue = null.
  • presentationLoadError
    • Fired when the nested presentation loading fails.
      • bubbles = false.
      • cancelable = false.
      • kind = "viewerEvent".
      • property = null.
      • oldValue = null.
      • newValue = null.

See also

Personal tools