Author Message

Posted: Thu Aug 19, 2010 8:50 pm   Post subject: control Standalone & Soild output from same player

I'm testing the trial version of iSpring Presenter to see if I can successfully integrate the converted SWFs for use in my own custom Flash player.

Using the iSpring Presenter ActionScript API I can control ether Standalone slides or a Solid Presentation, but not both from within the same player. In other words, I can either use code to control Standalone slides, or Solid Presentations.

When I try to import the fsplayer.api and slideplayer.api classes I get the following compile error:

Quote:
The class 'slideplayer.api.IAnimationStep' cannot be imported because its leaf name is alredy being resolved to imported class 'fsplayer.api.IAnimationStep'.

I have to load both types of iSpring output into my player and need to receive an end of slide event for Standalone slides, or end of presentation event for Solid Presentations.

How can this be done?

I have two different FLA test files where I managed to do this separately for Standalone slides and for a Solid Presentation; how would I combine such code so I can tell when both a Standalone slide or a Solid Presentation has reached the end?

Test code used for Standalone slides:
Code:
import slideplayer.api.*;

System.security.allowDomain("*");

var g_slideController:ISlideController;
var g_playbackController:IPlaybackController;

//--------------------------- loader -----------------------------
var mcLoader:MovieClipLoader = new MovieClipLoader();
var loadListener:Object = new Object();
mcLoader.addListener(loadListener);

loadListener.onLoadInit = function(target:MovieClip) {
    // now we can get ISlideController interface and access its methods
    g_slideController = target.getSlideController();
   g_playbackController = g_slideController.getPlaybackController();
   g_playbackController.addListener(this);
}

loadListener.onLoadComplete = function(targetMC:MovieClip) {
   setTimeout(checkSWF, 100)
};

loadListener.onSlidePlaybackFinished = function(targetMC:MovieClip) {
   navStatus = "normal" // return parent player's navigation to its defualt - i.e: non iSpring content
   trace("I am a Single Slide iSpring convert, and I am done")
}

function checkSWF() { // check if iSpring Standalone slide & disable defualt player's navigation if iSpring content
   if (g_playbackController.getCurrentStepIndex() == 0) {
      //trace("iSpringContent")
      navStatus = "iSpring"
      navListenerNEW = new Object();    
      navListenerNEW.onKeyUp = function() {
         if (Key.getCode() == Key.RIGHT || Key.getCode() == Key.PGDN) {
            g_playbackController.gotoNextStep();
          }
      }
Key.addListener(navListenerNEW)
   }
}

_root.mcLoader.loadClip("iSpring_SingleSlide.swf", "holderMC");


Test code for Solid Presentation:
Code:
import fsplayer.api.*
System.security.allowDomain("*");

var g_playerAPI:IPlayer;
var g_controller:IPresentationPlaybackController;
var g_presentationInfo:IPresentationInfo;

var mcLoader:CPresentationLoader = new CPresentationLoader();
mcLoader.setPlayerListener(this);
var loadListener:Object = new Object();
mcLoader.addListener(loadListener);
mcLoader.loadClip("Solid_Presentation.swf", holderMC);

function onPlayerInit(playerAPI:IPlayer):Void{
   g_playerAPI = playerAPI;
   g_controller = playerAPI.getPlaybackController();
   g_presentationInfo = playerAPI.getPresentationInfo();
   // this movie clip will listen to events of playback controller
   g_controller.addListener(this);
}

loadListener.onLoadComplete = function(targetMC:MovieClip) {
   setTimeout(checkSWF, 100)
}

function checkSWF() { // if iSpring content - disable defualt nav
   if (g_controller.getCurrentSlideIndex() == 0) {
      navStatus = "iSpring"
      //trace("iSpringContent")
    }
}

function onPresentationPlaybackComplete():Void {
   navStatus = "normal"
   //trace (navStatus)
}


How can I combine the two?


Profile profile test

Posted: Fri Aug 20, 2010 8:23 am   Post subject: Re: control Standalone & Soild output from same player

import directive in ActionScript 2 is used only to resolve class/interface names by their short names without specifying full class name.

When two or more classes/interfaces have the same name but are located in different namespaces only one of them can be accessed by its short name. The rest should be accessed by full name.

For example:

Code:
import fsplayer.api.IAnimationSteps;

var presentationSlideSteps:[b]IAnimationSteps [/b]= null;
var standaloneSlideSteps:[b]slideplayer.api.IAnimationSteps[/b] = null;


More effective solution is to split the code of your custom Flash player into classes. Some classes would use definitions fsplayer.api packge while the other would use definitions from slideplayer.api package. This will let you use short names of iSpring interfaces without disambiguation.

You will have 2 classes in your application. One of them will handle slide playback:
Code:
import slideplayer.api.*

class MyStandaloneSlidePlayer
{
   private var m_slideController:ISlideController;
   ...
   function doSomethingWithAnimationSteps():Void
   {
      // slideplayer.api.IAnimationSteps are used
      var steps:IAnimationSteps = m_slideController.getAnimationSteps();
   }
}

The other class will handle the presentation playback.
Code:
import fsplayer.api.*

class MyPresentationPlayer
{
   private var m_playbackController:IPresentationPlaybackController;
   private var m_presentation:IPresentationInfo;
   ...
   function doSomethingWithAnimationSteps():Void
   {
      var currentSlideIndex:Number = m_playbackController.getCurrentSlideIndex();
      var currentSlide:ISlideInfo = m_presentation.getSlides().getSlideInfo(currentSlideIndex);
      // fsplayer.api.IAnimationSteps are used
      var steps:IAnimationSteps = currentSlide.getAnimationSteps();
   }
}


It is similar to having a simultaneous conversation with 2 people with the same names but different surnames. You can't address them by name only. You either have to use their full names, or address one person using its name while the other person is addressed by his full name.


Profile profile test WWW www ICQ ICQ
Display posts from previous:  Sort by  

  


Who is online
Who is online In total there are 6 users online :: 2 registered, 0 hidden and 4 guests (based on users active over the past 5 minutes)
Most users ever online was 108 on Thu Nov 21, 2013 3:41 pm

Registered users: Bing [Bot], Google [Bot]