Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / General Flash Topics / July 2008



Tip: Looking for answers? Try searching our database.

flv playback button problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
falstaph - 30 Jun 2008 12:59 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.