Author Message

Posted: Mon Mar 09, 2009 3:52 am   Post subject: getPlayer() returns undefined

hello,
I am a developer in Boston, MA USA, trying to utilize the API so I can listen for events. I have implemented as directed in the documentation, but, have not been able to see anything but 'undefined' from the getPlayer() call in CPresentationLoader. The presentation loads and plays, but the tryToInitPlayer() in CPresentationLoader only ever gets 'undefined' when it attempts to getPlayer().

My implementation looks like this:

I have a main.fla that compiles:
[code]import fsplayer.api.CPresentationLoader;
import MyPlayerListener;

System.security.allowDomain("*");

trace("main.as");

var playerListener:MyPlayerListener = new MyPlayerListener();
var presentation_mc:MovieClip = this.createEmptyMovieClip("presentation", 1);

var loader:CPresentationLoader = new CPresentationLoader();
loader.setPlayerListener(playerListener);
loader.loadClip("av.swf", presentation_mc);[/code]

MyPlayerListener has:
[code]
function onPlayerInit(player:IPlayer):Void
{
trace("MyPlayerListener.onPlayerInit");
playbackListener = new MyPlaybackListener();
player.getPlaybackController().addListener(playbackListener);
}[/code]

Please let me know what else I can tell you that will help diagnose. Thank you!
Chris


Profile profile test

Posted: Mon Mar 09, 2009 4:22 am   Post subject: more info

I add did some introspection to see what's in the target clip returned to onLoadInit() in CPresentationLoader. I found playerCoreMC which has a getPlayer() function. Should the tryToInitPlayer() function be modified to this?:

[code] private function tryToInitPlayer():Void
{
//trace("CPresentationLoader.tryToInitPlayer");
if (!m_player)
{
//trace("CPresentationLoader.tryToInitPlayer : !m_player : m_target = " + m_target );
m_player = m_target.playerCoreMC.getPlayer();
if (m_player)
{
trace("CPresentationLoader.tryToInitPlayer : m_player");
m_player.addListener(this);
if (m_player.isInitialized())
{
trace("CPresentationLoader.tryToInitPlayer : m_player.isInitialized()");
// the player has already been initialized. we need to call onPlayerInit manually
onPlayerInit(m_player);
}
}
}
}[/code]

I'm not sure if this is the solution because I still don't seem to be getting any initialization events from it. onPlayerInit() never gets called.


Profile profile test
Display posts from previous:  Sort by  

  


Who is online
Who is online In total there are 3 users online :: 2 registered, 0 hidden and 1 guest (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]