Skip to main content
Participant
March 7, 2007
Question

How to fix flickering in actionscript?

  • March 7, 2007
  • 2 replies
  • 501 views
I have a problem making my FLASH working seamlessly. When you put the mouse over the buttons (movie clips) then they are flickering. Do you know how to fix that? I want everything to work smooth and slow, without flickering and flashing in the eyes. I used only this script:

on (rollOver) {
gotoAndPlay ("1");
}



on (rollOut) {
gotoAndPlay ("2");
}

Link to that example

FLA source

If you put the mouse in the middle of the button (there are 4 of them there) it starts flickering. Why? How to fix that?

Thanks in advance,
Alex
This topic has been closed for replies.

2 replies

Inspiring
March 7, 2007
Phil is of course correct in the diagnosis of your problem. I would add that you can gain an even better level of control by using the Tween class, for which there is an excellent tutorial here:

http://www.actionscript.org/resources/articles/170/1/Flash-MX-2004-Undocumented-TweenEasing-Classes-Documented/Page1.html
Inspiring
March 7, 2007
Alex,

It's flcikering because you're trying to use a timeline tween to control it. You can achieve a better result using Actionscript. Bin your timeline for each movieclip and leave just the first frame.

Now replace your code with this

on(rollOver){
onEnterFrame = function()

{
if(this._xscale < 200)
{
this._xscale = this._xscale+10
this._yscale = this._yscale+10
}

}

}

on (rollOut) {
onEnterFrame = function()

{
if(this._xscale > 100)
{
this._xscale = this._xscale-5
this._yscale = this._yscale-5
}

}
}

on (release) {
getURL (" http://www.flashfridge.com", _self);
}

You may need to reposition your buttons on the stage and change their registration points...I think it works best if you place the centre of the top image at 0,0.

The benefit is that it won't "jump" if you re-roll over.

You may want to play with the scaling (I choose 200%) and the rate of growth/decay (10 and 5)

Hope this helps!
Phil