Skip to main content
Known Participant
June 1, 2017
Answered

FLVPlayback component has null properties

  • June 1, 2017
  • 2 replies
  • 774 views

When I try to access the subcomponents of an FLVPlayback component, I just get null properties:

flv = new FLVPlayback();
trace(flv.skin, flv.stopButton, flv.playButton); // null null null

I suppose that just means they're the defaults. But what do I do if I need to access them?

I specifically want to try adding an event listener to the stopButton component. I want to do this because the stop button just seems to be pausing playback rather than resetting the time to zero.

This topic has been closed for replies.
Correct answer Colin Holgate

I meant as a way to help figure out the problem. But it's solvable without needing a stage.

Many of the skins don't have a stop button, but strangely even if it does you can't get a pointer to it from AS3. I can if I use a SWF inside Director, so I know it's really there.

I see that the uiMgr variable is flvplayback_internal, maybe that's why it's hard to get at, though the get stopButton() is a public getter.

There is a stoppedStateEntered event that you can listen for, and do your own unload or seek 0; stopButton on its own doesn't seem to unload the video.

This script (or the one you will write when you adapt it to FlashDevelop) will play an MP4 I had name 'drum.mp4', and it will only trace "stopped" if I click on the stop button:

import fl.video.VideoEvent;

import fl.video.FLVPlayback;

var flv:FLVPlayback = new FLVPlayback();

flv.source = "drum.mp4";

addChild(flv);

flv.skin = "SkinOverAll.swf";

flv.addEventListener(fl.video.VideoEvent.STOPPED_STATE_ENTERED,stopped);

function stopped(e:fl.video.VideoEvent){

  trace("stopped");

}

2 replies

Colin Holgate
Inspiring
June 1, 2017

FLVPlayback can be completely free of UI. You would do new FLVPlayback() if you plan on no controls, or your own non-component controls. Try placing an FLCPlayback component onto the stage, and it will have a UI, and the trace should then work.

Known Participant
June 1, 2017

Not an option. Despite posting in the Animate forums, I'm using FlashDevelop.

And yes, FLVPlayback does have controls and they all work correctly except the stop button.

Colin Holgate
Colin HolgateCorrect answer
Inspiring
June 1, 2017

I meant as a way to help figure out the problem. But it's solvable without needing a stage.

Many of the skins don't have a stop button, but strangely even if it does you can't get a pointer to it from AS3. I can if I use a SWF inside Director, so I know it's really there.

I see that the uiMgr variable is flvplayback_internal, maybe that's why it's hard to get at, though the get stopButton() is a public getter.

There is a stoppedStateEntered event that you can listen for, and do your own unload or seek 0; stopButton on its own doesn't seem to unload the video.

This script (or the one you will write when you adapt it to FlashDevelop) will play an MP4 I had name 'drum.mp4', and it will only trace "stopped" if I click on the stop button:

import fl.video.VideoEvent;

import fl.video.FLVPlayback;

var flv:FLVPlayback = new FLVPlayback();

flv.source = "drum.mp4";

addChild(flv);

flv.skin = "SkinOverAll.swf";

flv.addEventListener(fl.video.VideoEvent.STOPPED_STATE_ENTERED,stopped);

function stopped(e:fl.video.VideoEvent){

  trace("stopped");

}

Legend
June 1, 2017

Do programmatically instantiated FLVPlayback components even have controls by default?