PDA

View Full Version : eventListener issue


polemios
10-01-2008, 12:39 AM
Hi,

I haven't done this sort of thing before, so I am completely lost.

I have a SWF with an FLVplayer component, name "flvplayer". I'm using a predefined ADOBE skin to control it.

there's a "poster image", aka an image on it's own layer, named "cover".

When the flvplayer starts playing, I want the cover to disappear.

Here's the code:
stop();

var listenerObject:Object = new Object();
listenerObject.play = function() {
cover._visible = false;
};
flvplayer.addListener(listenerObject);

I have tried "start", "onStart", "play", "onPLay", "playing", etc for the state of the listenerObject.

"Cover" never disappears.

Is there a simple error here, I don't see?

Also, just as an extra question, does anyone know how to stop the FLVPlayer from loading the content before someone hits play?

Thanks alot.

Sicontis
10-01-2008, 05:59 AM
Hi,

Assuming your poster image is a movieclip with an instance name of cover, then try it this way. This is from the Flash help files.


var listener:Object = new Object();
listener.playing = function(event:Object):Void {
cover._visible = false;
}
flvplayer.addEventListener("playing", listenerObject);


As for your other question - are you talking about stopping the movie from playing automatically? The default method for the FLVPlayback component is to play the movie once it's loaded, but you can stop that by setting the autoPlay property to false.

flvplayer.autoPlay = false;

Which will load the FLV but wait until the play button is pushed.

polemios
10-03-2008, 04:10 AM
Thanks Sicontis for your reply. Unfortunately "cover" still won't disappear when the flvplayer is playing. I checked, and the instrance names are correctly named (cover and flvplayer) and they aren't nested, they are just on the stage.

As for what I meant about the stopping the video, I meant to ask how to stop the video from loading before one clicks play, not from playing. I currently have it so that autoplay is false, but I also want it not to load until play has been clicked.

Seeing that I'm using the pre-packaged Adobe skins, I don't know how to write actionscript to affect the way the pre-packaged skins behave.