Jump to content
Search Community

How to get a button to "pulsate"

laxbuddha test
Moderator Tag

Recommended Posts

Hey there,

I am trying to get a button to glow with a pulsating effect on ROLL_OVER.  I tried to link it back onComplete and have the 2 functions go back and forth, simply adjusting the alpha of the glow, but it throws an error.  Any ideas how to make this work?  Thanks

Link to comment
Share on other sites

This is the most seamless way I could think of.

 

place a clip with instance name mc on the stage.

 

add this code:

 

 

import com.greensock.*;
import com.greensock.easing.*;
import flash.events.MouseEvent;


var pulse:TweenMax = TweenMax.to(mc, 1, {glowFilter:{color:0x91e600, alpha:1, blurX:30, blurY:30}, repeat:-1, yoyo:true, paused:true});


mc.addEventListener(MouseEvent.ROLL_OVER, over);


function over(e:MouseEvent):void{
pulse.play(); 
}




mc.addEventListener(MouseEvent.ROLL_OUT, out);


function out(e:MouseEvent):void{
pulse.pause();
//tween the progress of the pulse tween back to 0
TweenLite.to(pulse, 0.8, {progress:0});
}

Tweening the progress of the pulse tween to 0 ensures that every time you ROLL_OUT the glow reverses smoothly. 

 

Give it a try, let us know if it works for you.

Link to comment
Share on other sites

ReferenceError: Error #1069: Property progress not found on com.greensock.TweenMax and there is no default value.

 

 

I get this error on rolling out.  One my sample fla, I got it to work by making sure I was up to date with my green sock versions.  I saved my file in the same folder as my sample fla, and I am getting this error.  Any help is much appreciated as always.  Thanks!

Link to comment
Share on other sites

Sorry, I thought this was resolved.

 

It sounds like you are using the old version of the animation platform v11 where TweenMax had 

a currentProgress property. 

 

2 options

 

GREAT

1: Upgrade to v12 (many new features and enhancements) http://www.greensock.com/?download=GSAP-AS3

 

LESS THAN GREAT

2: Stick with v11 and use currentProgress instead of progress in your tween

 

Let us know if this fixes it.

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...