Copy link to clipboard
Copied
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.
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
...Copy link to clipboard
Copied
Do programmatically instantiated FLVPlayback components even have controls by default?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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");
}
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Metaphors are tricky things.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now