Skip to main content
Participant
September 10, 2007
Question

Please help me with FLV Playback

  • September 10, 2007
  • 5 replies
  • 345 views
I have set a FLV player in my flash document. It loads external videos. Over the FLV Player screen I have a MovieClip called "Videoclick" which says "Press here to start video" and disappears when you press the play button. Here is the code:

//Setting the FLV Player Component//

var cfp:mx.video.FLVPlayback;
var cppb:MovieClip;
var cpsb:MovieClip;
var cpvb:MovieClip;
var cpmb:MovieClip;
player_mc.cfp.playPauseButton = player_mc.cppb;
player_mc.cfp.stopButton = player_mc.cpsb;
player_mc.cfp.volumeBar = player_mc.cpvb;
player_mc.cfp.muteButton = player_mc.cpmb;

//the code to make Videoclick disappear and start playback//

player_mc.cppb.onPress = function() {
if (_root.VideoClick._alpha=100) {
_root.VideoClick._alpha = 0;
_root.player_mc.cfp.play();
} else if (FLVPlayback.playing=true) {
_root.player_mc.cfp.pause();
} else if (FLVPlayback.playing=false) {
_root.player_mc.cfp.play();
}
};
player_mc.cpsb.onPress = function() {
_root.VideoClick._alpha = 100;
_root.player_mc.cfp.stop();
};
player_mc.cfp.contentPath = ("videos/"+Teaser[_root._currentframe-FrameDifMarketing]);


The problem I'm having is that the "Videoclick" movieclip disappears and the video starts playing (as I want) but after that, the pause button doesn't work anymore.

I haven't many actionscrip experience and any help would be appreciated.

Thanks

Alberto
This topic has been closed for replies.

5 replies

Damon Edwards
Inspiring
September 10, 2007
what is the instance name of your component on stage?
Participant
September 10, 2007
Sorry dzedward, I didn't see your post before posting my last one. I have tested it wit the double "==" and now it starts playing, but the button doesn't pause the video, so I'm back to where I started.
Any other ideas?

Alberto
Damon Edwards
Inspiring
September 10, 2007
as I said, when testing for equality, you need to use the double '=' operator (==).

player_mc.cppb.onPress = function() {
if (_root.VideoClick._alpha==100) {
_root.VideoClick._alpha = 0;
}
if (FLVPlayback.playing==true) {
_root.player_mc.cfp.pause();
} else {
_root.player_mc.cfp.play();
}
};
Damon Edwards
Inspiring
September 10, 2007
you need to use == to test for equality.
Inspiring
September 10, 2007
You're logic is off:

player_mc.cppb.onPress = function() {
if (_root.VideoClick._alpha=100) {
_root.VideoClick._alpha = 0;
_root.player_mc.cfp.play();
} else if (FLVPlayback.playing=true) {
_root.player_mc.cfp.pause();
} else if (FLVPlayback.playing=false) {
_root.player_mc.cfp.play();
}
};

playing will always be true or false, so an 'else if playing is true or
false' doesn't make sense. I think you want this:

player_mc.cppb.onPress = function() {
if (_root.VideoClick._alpha=100) {
_root.VideoClick._alpha = 0;
}
if (FLVPlayback.playing=true) {
_root.player_mc.cfp.pause();
} else {
_root.player_mc.cfp.play();
}
};


And I'd suggest you change onPress to onRelease, it is the standard for a
button to work on release, not on press.

--
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/


Participant
September 10, 2007
Thank you Dave. I can see my mistake using "else if". I tried your code and the video just doesn't start playing after fading the alpha of "VideoClick" to 0. The problem seems to be using a play/pause button and attaching a function to it. As I'm running out of time for this project, I have decided to go for a play and a pause buttons separated. I works fine. I still would appreciate some ideas on where the problem with this script could be!!!

Thank you

Alberto Corredor
Video editor / AfterFX compositor
BVS Training
London, UK