Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

FLVPlayback component has null properties

Explorer ,
May 31, 2017 May 31, 2017

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.

644
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jun 01, 2017 Jun 01, 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 s

...
Translate
LEGEND ,
May 31, 2017 May 31, 2017

Do programmatically instantiated FLVPlayback components even have controls by default?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 31, 2017 May 31, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 01, 2017 Jun 01, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 01, 2017 Jun 01, 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");

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 01, 2017 Jun 01, 2017

Of course, after posting that it occurred to me to test what happens at the end of the video. "stopped" is also traced then, and you might not want to unload the video when it completes. There is a complete event if you want to tell the difference between a stopButton click and the playback completing. Or compare playheadTime against totalTime to see if the stopped event happened at the end of the video.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 01, 2017 Jun 01, 2017

Okay, I think this is satisfactory. I did try what you said by testing it with a component I added to the stage in Animate, and the stopButton property was still null.

I think I'm just going to use a skin that doesn't have a stop button.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 01, 2017 Jun 01, 2017

I think that's good anyway, because many people would innocently use the stop button thinking that it will pause the video (like it does), and if you unload the video it might come as a surprise.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 01, 2017 Jun 01, 2017

You misunderstand. If there's a stop button alongside a pause button, why would people expect them to do the same thing? I'm not saying the stop button should unload the video. The stop button is supposed to stop the video, which is to say it stops playback just like the pause button but also resets the playhead to the beginning.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 01, 2017 Jun 01, 2017

A video tape player may have a stop and a pause. Pause gives a freeze frame, stop shuts off the video. That's expected behavior. A person might be surprised if the tape rewound.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 01, 2017 Jun 01, 2017

But as soon as you get into CD players then "rewinding" doesn't actually take any time. I would expect pause to remember my position and stop to not remember my position.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 01, 2017 Jun 01, 2017
LATEST

Metaphors are tricky things.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines