View Full Version : Multiple Function Calls
Kovax
August 21st, 2003, 01:49 PM
I have some code that calls multiple functions for a single movie clip during a single event. For example:
portfolioButton.onPress = function()
{
redClip.easeX(180, speed);
redClip.easeHeight(194, speed);
}
The problem is only the first function call works (redClip.easeX(180, speed)). Is there a way for both function calls to execute? Perhaps delay the second one?
Thanks!
:mario:
thoriphes
August 21st, 2003, 04:53 PM
can you provide your function declarations for these functions?
Kovax
August 21st, 2003, 04:58 PM
They are both simple functions used to ease a property of the movie clip.
function easeX(endX, speed)
{
//trace("easeX function reached.");
this.onEnterFrame = function()
{
this._x += (endX-this._x)/speed;
}
}
function easeHeight(endHeight, speed)
{
// trace("easeHeight function reached.");
this.onEnterFrame = function()
{
this._height += (endHeight-this._height)/speed;
}
}
thoriphes
August 21st, 2003, 04:59 PM
ah, just as i thought you are trying to assign two onEnterFrames to the same clip. You can't do that. Why don't you just include the code of both functions in one big one? you can use as many parameters as you need.
Kovax
August 21st, 2003, 05:18 PM
That makes sense....didn't even think of that. Thanks!
Kovax
August 21st, 2003, 05:33 PM
Is there a way to control when the function calls execute? Can I ease the height and THEN the _x in that order? I am trying to avoid tweened animation.
:block:
thoriphes
August 21st, 2003, 05:50 PM
um, you can tell the _x to move once the height gets past a certain point. like
if (_height > 50) {
_x += 5;
} or something to that effect.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.