Hi, I'm new to flash & am stumped. I have a graphic (with button) on frame 1&2
that tells about the flv that plays when you click the button. The movie plays
on frame 1, but then stops on frame 2 until you click the button. Click the
button and it goes to frame 5 which has the actionscript3 to load & play the
flv. The flv plays and then when complete the movie goes back to frame 1. It
seems to work well, but once the flv has played and the frame 1 graphic is
back, the button no longer works to load the movie again. Can someone tell me
why?
Frame1 actionscript3
play();
buttonPlay.addEventListener(MouseEvent.MOUSE_UP, onPlayClick);
function onPlayClick(event:MouseEvent):void
{
gotoAndPlay(5);
}
Frame2 actionscript3
stop();
Frame5 actionscript3
//imports the classes to handle video playback and the progress bar
import fl.video.*;
import fl.controls.ProgressBarMode;
stop();
// Set Variables - display is the instance name of the video - link is the
name of the url request
var flvControl = display;
//adds a listener for a click anywhere on the stage, when click on the stage,
go back to frame1
stage.addEventListener(MouseEvent.CLICK,onClick);
function onClick(event:MouseEvent):void
{
gotoAndPlay(1);
}
function onEnd(event:VideoEvent):void
{
gotoAndPlay(1);
}
//the movie that is called to open up
var flvSource = "snowfire1.flv";
// Create event handler functions to control the progressbar
function progressHandler(event:VideoProgressEvent):void
{
var bl = Math.round(event.bytesLoaded/1000);
var bt = Math.round(event.bytesTotal/1000);
// Update progress...
pb.setProgress(bl,bt);
}
function readyHandler(event:VideoEvent):void
{
// Remove progressbar when we start playing...
display.pause();
display.playWhenEnoughDownloaded();
}
display.addEventListener(VideoEvent.READY, readyHandler);
// Add listeners and load the video and when the video ends run onEnd function
flvControl.addEventListener(VideoProgressEvent.PROGRESS, progressHandler);
flvControl.addEventListener(VideoEvent.READY, readyHandler);
flvControl.addEventListener(VideoEvent.COMPLETE, onEnd);
flvControl.source = flvSource;
falstaph - 03 Jul 2008 04:10 GMT
In case anyone's interested I happened upon a solution. Before when my flv
file played I was sending the movie back to play the static graphic on frame 1.
When I changed the actionscript to go back to frame 5, everything worked like
a charm. The frame 1 graphic comes back at the end of the movie (I don't
really know why) and now the button starts the flv file again.