A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: Quick Question about youtube video in flahs website not stoping.

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    10

    Quick Question about youtube video in flahs website not stoping.

    Here is my code I am working with.

    Code:
    Security.allowDomain("www.youtube.com");
    
    var my_player1:Object;
    
    var my_loader1:Loader = new Loader();
    my_loader1.load(new URLRequest("http://www.youtube.com/apiplayer?version=3")); 
    my_loader1.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);
    
    function onLoaderInit(e:Event):void{
    addChild(my_loader1);
    my_player1 = my_loader1.content;
    my_player1.addEventListener("onReady", onPlayerReady); 
    } 
    
    function onPlayerReady(e:Event):void{
    my_player1.setSize(410,410);
    my_player1.cueVideoById("_OBlgSz8sSM",0);
    }
    
    pause_btn1.addEventListener(MouseEvent.CLICK, pauseVid); 
    function pauseVid(e:MouseEvent):void { 
    my_player1.pauseVideo();
    }
    It seems to be working fine, But my problem is when i change scenes the audio dosent stop, and when I go back to the scene the video is stoped and can be restarted, ( the old sound from the video still playing)

    Just not sure how to stop the sound once you leave the page.

    Any help is awesome, Thanks!


    Edit: Also, I have a external Pause button to stop the video...

    But I was wondering if it is possible to make the youtube default bar at the bottom appear?
    With the Loader bar, pause play, sound, full screen etc.
    Last edited by Phame; 01-09-2013 at 08:47 PM.

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