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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting the height of a movie clip with ActionScript

Status
Not open for further replies.

myatia

Programmer
Nov 21, 2002
232
Hi,

I'm trying to use setProperty to set the height of a movie clip. I do this by adding a specified number of pixels, heightInterval, to the current height. However, this only works when heightInterval is set to 1 or 5; otherwise, the movie clip's height just says the same. If anyone has any advice, please let me know. The code I'm working on is below, if it helps...

Thanks,

Misty

Code:
// My code only works if I have this set to 1 or 5.
var heightInterval = 5;	

function growBar() {

  // Current height of the rectangle
  var h = getProperty(_root.theMovie, _height);
			
  // Add heightInterval pixels to the rectangle's height
  setProperty(_root.theMovie, _height,  h + heightInterval);
}

_root.frame = 0;

// Add heightInterval pixels to the movie's height
// every 50 milliseconds.
_root.intervalID = setInterval(growBar(), 50);
 
setInterval(growBar(), 50);

i dont know why you have the setinterval like this bvut you may have a good reason. certainly if changed to the more normal
setInterval(growBar, 50);

then heightinterval will take any value
 
Taking the () off growBar made it work. Thanks,

Misty
 
Bah. It actually didn't work; I thought I had reset the heightInterval, but I hadn't. Without the parantheses, it still just sits there when it's set to anything besides 1 or 5. Any other suggestions?

Thanks,

Misty
 
Grr...I think I just need to reboot or something. Thanks for your help...

Misty
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top