PDA

View Full Version : [AS2] enventListener.completed not trigged?


rotsee
10-31-2008, 01:23 PM
Hello,
I'm playing a FLV-file in my flash-movie, using FLVPlayback (compiled clip). Now I need to execute some code when the movie stops och when the user navigates to another frame using any of a number of buttons. I googled and found a lot of instructions that all looked something like this (my code now):

var enventListener:Object = new Object();
enventListener.completed = function(eventObject:Object):Void{
trace("THIS NEVER HAPPENS!");
}
_root.Kapitel1_film.addEventListener("completed",eventListener);

where Kapitel1_film is my flv-clip. I tried all different events I could come up with (stopped, statusChange, etc), but nothing ever happens.
I can access the clip, though. E.g. _root.Kapitel1_film.height will give a correct value.
Trace(_root.Kapitel1_film.state) used in the same frame gives 'disconnected', otherwise 'undefined'. All code is in the same frame and same scene as the embedded flv. I'm a newbie here, so I'm probably missing something obvious. Thankful for any hint.

rotsee
11-01-2008, 08:38 AM
Hello,
sorry for Cross posting, but no reply in the newbie forum.

I'm playing a FLV-file in my flash-movie, using FLVPlayback (compiled clip). Now I need to execute some code when the movie stops och when the user navigates to another frame using any of a number of buttons. I googled and found a lot of instructions that all looked something like this (my code now):

var enventListener:Object = new Object();
enventListener.completed = function(eventObject:Object):Void{
trace("THIS NEVER HAPPENS!");
}
_root.Kapitel1_film.addEventListener("completed",e ventListener);

where Kapitel1_film is my flv-clip. I tried all different events I could come up with (stopped, statusChange, etc), but nothing ever happens.
I can access the clip, though. E.g. _root.Kapitel1_film.height will give a correct value.
Trace(_root.Kapitel1_film.state) used in the same frame gives 'disconnected', otherwise 'undefined'. All code is in the same frame and same scene as the embedded flv. I'm a newbie here, so I'm probably missing something obvious. Thankful for any hint.

Sly_cardinal
11-01-2008, 01:39 PM
The event name is "complete" not "completed".

rotsee
11-01-2008, 04:56 PM
Right, I typed in wring there. Anyway, that's not the problem, as I wrote I have also tried every other event I can think of, with no result, so something else is wrong....

Sly_cardinal
11-02-2008, 09:08 AM
Are you adding the event listener to the FLV movie or the FLVPlayback component?

rotsee
11-03-2008, 09:56 AM
To the FLV movie

Sly_cardinal
11-04-2008, 04:32 AM
Try adding the event listener to the FLVPlayback component instead.

inhan
11-04-2008, 03:16 PM
It is weird. I have never embedded a flv into my timeline before and I tried it after seeing this thread, but unlike documentation mentions, I got the same result rotsee got, which is: nothing. The 'complete' event handler is never triggered. Weird.

CyanBlue
11-04-2008, 04:02 PM
I think that is a FLVPlayback component bug where the playhead is close enough to the end to end the video, but not close enough to actually call it an end... Or that could happen on some of the FLVs... Not sure what the case is...

The work-around would be basically checking the current playhead location and the length of the video file inside the progress handler to see if they are close enough and you make the complete call when it is...