Jump to content


Actionscript setInterval


  • You cannot reply to this topic
1 reply to this topic

#1 Bradlc

    Young Padawan

  • Members
  • Pip
  • 21 posts
  • Gender:Male

Posted 30 July 2007 - 08:44 AM

Hey :biggrin:

I've got this code:

import mx.transitions.Tween;
import mx.transitions.easing.*;

var myTween1:Tween;
var myTween2:Tween;

button.onRelease = setInterval(function(){

	if(square._height == 1 && square._width == 1){
		myTween1 = new Tween(square,"_height",Regular.easeOut,0,150,2,true);
		myTween2 = new Tween(square,"_width",Regular.easeOut,0,150,2,true);
	}
	
},1000);

What I want to do is: When I click the button it will wait 1 second then play the tweens.

What it does do: When I test the movie it just waits 1 second then plays the tweens (I haven't even clicked the button).

So can anyone help me to get it doing what I want it to do please?

Any help is appriciated.

Thanks,
Brad.

#2 Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 02 August 2007 - 03:39 PM

import mx.transitions.Tween;
import mx.transitions.easing.*;

var myTween1:Tween;
var myTween2:Tween;

button.onRelease = function(){

setInterval(function(){

	if(square._height == 1 && square._width == 1){
		myTween1 = new Tween(square,"_height",Regular.easeOut,0,150,2,true);
		myTween2 = new Tween(square,"_width",Regular.easeOut,0,150,2,true);
	}
	
},1000);
}

Try that. It'll keep callin until you clear it tho.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users