Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple resize movieclip problem 1

Status
Not open for further replies.

carmenMiranda

Programmer
May 22, 2003
47
GB
Well I think it should be simple, but I just can't get it to work.

I have a movie clip that needs to contract in height and then expand back to it's original size repeatedly. The code I have looks like this:

Code:
high01_mc.onEnterFrame = highScroll;

function highScroll(){
	if(this._height > 100){
	  this._height--;
	}
	if(this._height < 120){
	  this._height++;
	}
}

As I'm sure you can immediately see, this just causes the height to oscillate between 99px and 101px. I'm having a complete mental block on how to get it to change smoothly from 120px high, down to 100px high and then back to 120px high, over and over.

Can anyone help? Thanks.

 
Something like this, works...

Code:
var max:Boolean = false;
high01_mc.onEnterFrame = highScroll;

function highScroll(){
	if(this._height < 120 && !max){
      	this._height++;
	}
	if(this._height == 120){
	    max = true;
	}
	if(this._height > 100 && max){
      	this._height--;
    }
	if(this._height == 100){
	    max = false;
	}
}

Regards. FLASH HELP - OPENED FOR BUSINESS!
TO GET YOUR OWN FREE WEBSITE HOSTING
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top