1 Reply Latest reply: Feb 3, 2012 1:33 PM by Ned Murphy RSS

    Creating a huge PLAY button (YouTube style) for an FLV component

    nikolaig Community Member

      I have an FLV component and I wanted to create a huge PLAY button in the middle of the screen so if the video doesn't start automatically a user can click on it and it fades out. If the video stalls a user can click on it again and start the video.

      I would like it to be arranged as follows:

       

      1.play_btn fades in on the start.

      MY PROBLEM: I did it it works, but not sure if it is an optimal solution. I did not assign any function as this way tween starts automatically. Or it is better to assign something like ON_START or ON_LOAD and not sure what is the proper function.

       

      2.If the video starts to play on its own without a user clicking a play button it should dissapear and if the video stops it should appear.

      MY PROBLEM: Presently I achieved it to fade out on the click, but it stays on the screen unless I am to click on it. If I make background of the button to the size of the video then when a video stops and a user just clicks somewhere around on the screen he hits an invisible play button and video resumes. The button does not come up if the video stops.

       

      3.Extra special desire. If a user clicks on the video then it is paused and a button changes to a pause symbol

      MY PROBLEM: This third option may be too complicated for me with all "if" statements, but if not too much to ask would like to see how it can be done.

       

      here is the code I was able to come up with:

       

      var  play_btn_Tween:TweenMax = TweenMax.from(play_btn, .5, {alpha:0});

       

      play_btn.addEventListener(MouseEvent.CLICK, onClick_Play);

       

         function onClick_Play(event:MouseEvent) :void {

            SWF_flv2.play();

            play_btn_Tween.reverse();

              trace("you rolled off me");

             }    

        • 1. Re: Creating a huge PLAY button (YouTube style) for an FLV component
          Ned Murphy CommunityMVP

          What you should do is look up the FLVPlayback com ponent in the help documentation and read thru all of the Events that it is supported by.  What you will want to do is write event listeners for the various events of the FLVPlayback that are of interest to you, much the same way you wriote the event listener for the button.

           

          If you do not want the button to be clickable after it fades out, then you either need to disable it or just set its visible property to be false.