Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

custom background for flv playback 1

Status
Not open for further replies.

thompom

Technical User
Dec 4, 2006
395
0
0
GB
Hi,

Im new to flash so bear with me - im using the flvplayback component to play some flv videos, but when a video has finished there is nothing in the box but the black background - i would like to have a picture there so when the movie has stopped the user is not left with a big black square - can someone help me with this please

thanks MG
 
I can think of several ways. Does "big black square" mean your video's final frame is black blank frame? If so you can set your picture as the final frame of the video. But the way I would do is set the alpha of FLVPlayback to zero when the video is finished so that the picture underneath becomes visible, or load one frame FLV when the video is finished.

Kenneth Kawamoto
 
hi ken - thanks for your reply
do i have to use a listener object? - can you give me an example

thanks again
 
hi ken put a background behind the flvplayback component on a new layer but the last frame is not transparent so
when the movie finishes you cant see the image, can you give me an example of an alternative

thanks agin MG
 
hi - i have flash pro 8 - but i can only see references to AS2 in the actions list
 
Code:
import mx.video.FLVPlayback;

var listenerObject:Object = new Object();
listenerObject.complete = function(eventObject:Object):Void  {
	eventObject.target._alpha = 0;
};
flv.addEventListener("complete",listenerObject);

Kenneth Kawamoto
 
hi ken, i have the following on buttons to play various movies

Code:
on(release){

	import mx.video.*;
my_FLVPlybk.contentPath = "outsidevxrcorsa.flv";
var listenerObject:Object = new Object();
// listen for complete event; play new FLV
listenerObject.complete = function(eventObject:Object):Void {
    if (my_FLVPlybk.contentPath == "outsidevxrcorsa.flv") {
        my_FLVPlybk.play("outsidevxrvectra.flv");
    }
};
my_FLVPlybk.addEventListener("complete", listenerObject);

}

how do i put your code into my existing actionscript?
 
sorry that was premature - this code does the job - thanks again

Code:
on(release){

	import mx.video.*;
my_FLVPlybk.contentPath = "outsidevxr8.flv";
var listenerObject:Object = new Object();
// listen for complete event; play new FLV
listenerObject.complete = function(eventObject:Object):Void {
    if (my_FLVPlybk.contentPath == "outsidevxr8.flv") {
        my_FLVPlybk.play("outsidevxrastra.flv");
    }
};
 
sorry - this is the code [am excited!]

Code:
on(release){

	import mx.video.*;
my_FLVPlybk.contentPath = "outsidevxr8.flv";
var listenerObject:Object = new Object();
// listen for complete event; play new FLV
listenerObject.complete = function(eventObject:Object):Void {
    if (my_FLVPlybk.contentPath == "outsidevxr8.flv") {
        my_FLVPlybk.play("outsidevxrastra.flv");
    }
};
var listenerObject:Object = new Object();
listenerObject.complete = function(eventObject:Object):Void  {
    eventObject.target._alpha = 0;
};
my_FLVPlybk.addEventListener("complete", listenerObject);

}
 
hi ken - my buttons work until the movie has finished can you tell me why - my actionscript look like

Code:
on(release){

	import mx.video.*;
var listenerObject:Object = new Object();
my_FLVPlybk.play("outsidevxr8.flv");
// listen for complete event; play new FLV
listenerObject.complete = function(eventObject:Object):Void {
       eventObject.target._alpha = 0;
};
my_FLVPlybk.addEventListener("complete", listenerObject);
}
 
also the player has a default movie that plays on load of the page which is set in the components parameters and i want the movie to become transparent when that finishes, but when i put the code on the first frame of the component
it says i need an event handler to run the code - how would i get your code to run when the initial movie finishes?

thanks again MG
 
hi,

have a button that i want to play an flv file, then when the movie is complete the opacity of the flvplayback component is set to 0.
have tried but cant get this actionscript to work

thanks MG

Code:
on(release)
{
flv.addEventListener("complete",listenerObject);
import mx.video.*;
my_FLVPlybk.contentPath = "outsidevxrastra.flv";
var listenerObject:Object = new Object();
// listen for complete event; play new FLV
listenerObject.complete = function(eventObject:Object):Void {
eventObject.target._alpha = 0;
};
 
You cannot just put all the codes in the button. In fact, do not put any code in your button, but put all in the main timeline.
Code:
// Main timeline
import mx.video.FLVPlayback;

my_FLVPlybk.autoPlay = false;
my_FLVPlybk.contentPath = "outsidevxrastra.flv";

var listenerObject:Object = new Object();

listenerObject.complete = function(eventObject:Object):Void  {
	eventObject.target._alpha = 0;
};

my_FLVPlybk.addEventListener("complete",listenerObject);

yourButton.onRelease = function():Void  {
	my_FLVPlybk.play();
};

Kenneth Kawamoto
 
Yes that's how I would do it. Otherwise you have to write 4 scripts for 4 buttons. If you want to change something you have to change 4 times. Imagine if you have 100 buttons, or if you do not know how many buttons will be (i.e. buttons are dynamically generated)

Kenneth Kawamoto
 
this is guna sound like a stupid question but how do you select the timeline for adding actionscript?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top