Jump to content
Search Community

Fading IN/OUT Play control button (special thnx to Carl S.)

ngrinchenko test
Moderator Tag

Recommended Posts

To my surprise I find myself at the point where I can create my own tweens, vars and functions.

Special thanx to Carl Schoof and his tutorials I did not have this mind set and ability a few weeks ago.

 

So here is where I came to a halt. I have a video which plays through FLV component (I know GreenSock has its own, but with all the coding it seems way over my head for now)

So I end up using FLV because of its presets.

 

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 my code:

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");
	 }     

Link to comment
Share on other sites

Hi ngrinchenko,

 

Glad to hear you are making such good progress with your coding endeavors.

 

Due to the amount of time and resources that we have, the support provided by this forum needs to be focused specifically on the GreenSock products.

The adobe flash forum would be a better place for help with the flvplayback component.

http://forums.adobe.com/community/flash ... ns&start=0

 

 

Most of what you need to do revolves around responding to various events that are fired by the FLVPlayback component. For instance, you can listen for a

PLAYING_STATE_ENTERED event and then fade out your play button.

http://help.adobe.com/en_US/FlashPlatfo ... ateEntered

 

you can find a summary of all the events here:

http://help.adobe.com/en_US/FlashPlatfo ... entSummary

 

Unfortunately we simply do not have the time to explain how it all works and the concepts are not trivial.

I think if you search for "flash video tutorial" you are bound to find some tutorials that explain the events and most likely contain the functionality you which to code.

 

----

 

As for your button still being clickable even when its alpha is set to 0, you also need to set the visible property to false so that the button doesn't get in the way of other elements. The GreenSock autoAlpha plugin will handle this for you. it will tween the alpha to 0 and automatically set the visible property to false.

 

you can learn how to use it here: http://www.snorkl.tv/2011/02/five-hidde ... tweenlite/

 

I wish I could be of more help.

 

best

 

c

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...