Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Flash Development
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 10-09-2009, 07:58 PM
  #1
miccheckone
Novice (Level 1)
 
Join Date: Jul 2008
Location: Los Angeles, California, USA
Posts: 8
iTrader: (0)
miccheckone is an unknown quantity at this point
Actionscript 3.0 - Stop FLVPlayback when it's not on stage

I've been searching for an answer to this one for a few days. No one seems to know a definitive solution, just a lot of half-guesses dating back through several years of forum discussions and several versions of ActionScript.

Basically, on the same frame of my main timeline I have a MovieClip containing my navigation buttons, and a MovieClip containing site content -- on Frame 1 resides the synopsis of a film, and on Frame 2 resides the film trailer. I am using Flash CS4's FLVPlayback component as my media player, and it loads my external FLV video file dynamically.

Here's the hierarchy:

MAIN TIMELINE
  • Navigation Bar (MovieClip)
    Button 1
    Button 2
  • Content Pages (MovieClip)
    Frame 1: Synopsis (Text & Graphics)
    Frame 2: Trailer (FLVPlayback Component)
    External FLV File

And the ActionScript 3.0 code on the first frame of the Navigation Bar MovieClip is as follows:

PHP Code:
btn1.addEventListener(MouseEvent.CLICKbtn1Click);
btn2.addEventListener(MouseEvent.CLICKbtn2Click);

function 
btn1Click(event:MouseEvent):void {
    
MovieClip(parent).contentPages.gotoAndPlay("synopsis");
}
function 
btn2Click(event:MouseEvent):void {
    
MovieClip(parent).contentPages.gotoAndPlay("trailer");

When you press Button 1, it plays the Content Pages MovieClip and takes you to the frame labeled "synopsis," and you can read the synopsis.

When you press Button 2, it also plays the Content Pages MovieClip and takes you to the frame labeled "trailer," where the FLVPlayback Component starts playing the film trailer FLV file automatically. That's all fine and dandy.

However, the problem occurs when you try to navigate away from the "trailer" frame. Let's say you press Button 1 again, it takes you back to the "synopsis" frame like it should, but at the same time, the FLVPlayback Component on the "trailer" frame continues playing in the background -- you can still hear the audio of the FLV file playing, even though the video is off the stage and you can't see it anymore.

To make matters even worse, let's say you press Button 2 again. It will take you back to the "trailer" frame and begin playing the FLV file again from the beginning, yet the first occurrence of the FLV file is still playing in the background, so now there's an "echo" effect from the two layers of audio.

So, my question is, Why does the FLVPlayback Component continue playing even when it is no longer on the stage? And more importantly, what ActionScript 3.0 code can I implement to tell FLVPlayback to stop playback when it is no longer on stage? I tried coding an EXIT_FRAME event above the "trailer" frame so it would stop playing when not on that frame, but that didn't work. I also tried adding this code to the functions of my navigation buttons to try to stop the FLVPlayback when you click a navigation button, with no luck:

PHP Code:
btn1.addEventListener(MouseEvent.CLICKbtn1Click);

function 
btn1Click(event:MouseEvent):void {
    
MovieClip(parent).contentPages.gotoAndPlay("synopsis");
    
MovieClip(parent).contentPages.trailerPlayback.stop();
// "trailerPlayback" is the instance name of my FLVPlayback Component

This problem is driving me batty. If anyone has a solution, please send it this way!
miccheckone is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart
 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 11:10 PM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.