A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Stop file download in progress

  1. #1
    Junior Member
    Join Date
    Aug 2008
    Posts
    15

    Stop file download in progress

    Good afternoon,

    I've built an online magazine, that has several links to videos. One page has four of them. They all work great except under one specific circumstance. If the user quickly opens a video, and closes it, moving on the to next, and doing the same, the 3rd or 4th video may appear unresponsive. I've narrowed this down to being a bandwith issue. If I look at my activiyt in Safari, the FLV files continue to download even if the user closes my player.

    Is there anyway to kill this download if the user closes a player?

    Here's my code calling a specific player and video:
    Code:
    function p6l1goto(e:MouseEvent):void  //  functioned called by my button
    {
    	var videoPlayer_mc:introVideoMC = new introVideoMC; //  MC in my library using the FLVplayback component 
    	videoPlayer_mc.x = (stage.stageWidth /2) - 350;
    	videoPlayer_mc.y = (stage.stageHeight /2) - 225;
    	addChild(videoPlayer_mc);
    	videoPlayer_mc.theVideo.play();  //  plays the actual FLV defined in the MC
    	p67links_mc.p6l1_btn.removeEventListener(MouseEvent.CLICK, p6l1goto);
    	videoPlayer_mc.closePlayer_btn.addEventListener(MouseEvent.CLICK, closeVideo);
    
    	function closeVideo(e:MouseEvent):void
    	{
    videoPlayer_mc.closePlayer_btn.removeEventListener(MouseEvent.CLICK, closeVideo);
    		p67links_mc.p6l1_btn.addEventListener(MouseEvent.CLICK, p6l1goto);
    		videoPlayer_mc.theVideo.stop();
    		videoPlayer_mc.theVideo.autoRewind = true;
    		removeChild(videoPlayer_mc);
    	}
    }
    Works great unless you open/close in rapid successsion.

    Thanks for looking!

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    You should be able to call .close() on the videoPlayer (or if it's an flvPlayback component it's closeVideoPlayer()) to sever the net stream.
    Please use [php] or [code] tags, and mark your threads resolved 8)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center