Author Message

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

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;"*");


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

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

MyPlayerListener has:
function onPlayerInit(player:IPlayer):Void
playbackListener = new MyPlaybackListener();

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

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
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");
if (m_player.isInitialized())
trace("CPresentationLoader.tryToInitPlayer : m_player.isInitialized()");
// the player has already been initialized. we need to call onPlayerInit manually

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 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]