all groups > flash actionscript > may 2005 >
You're in the

flash actionscript

group:

Elastic Frames


Elastic Frames icarusdown
5/16/2005 12:00:00 AM
flash actionscript: Help please!

Three buttons. Three elastic frame sizes. One size for each button.
I figure how to increase sizes but not how to decrease...

Is there easyer method for doing this...
I am using ActionScript 2.0 only.

http://www.galahala.com/elastika.zip
Re: Elastic Frames kglad
5/16/2005 12:00:00 AM
there's an easier way: define one function that resizes mcElastika using a
parameter that defines the new _width of mcElastika. have each menu button
initiate a setInterval() loop calling that function and sending the correct
parameter (corresponding to that button).
Re: Elastic Frames icarusdown
5/16/2005 12:00:00 AM
Re: Elastic Frames kglad
5/16/2005 12:00:00 AM
set speed between 0 and 1, depending how quickly you want that width to
ease-into its final width:

speed=.9;
mcWidthA = [300, 50, 240];
btnA = [mcMenu.mcPortfolio, mcMenu.mcReferences, mcMenu.mcInfo];
for (var ivar = 0; ivar<btnA.length; ivar++) {
btnA[ivar].jvar = ivar;
btnA[ivar].onRelease = function() {
clearInterval(nWidthInterval);
nWidthInterval = setInterval(mcElastikaWidth, 1, mcWidthA[this.jvar]);
};
}
function mcElastikaWidth(w):Void {
mcElastika._width = speed*mcElastika._width+(1-speed)*w;
mcLineRight._x = mcElastika._x+mcElastika._width/2;
mcLineLeft._x = mcElastika._x-mcElastika._width/2;
mcLineUp._y = mcElastika._y-mcElastika._height/2;
mcLineDown._y = mcElastika._y+mcElastika._height/2;
mcGumb._y = mcElastika._y-mcElastika._height/2;
mcGumb._x = mcElastika._x-mcElastika._width/2;
mcMenu._y = mcElastika._y+mcElastika._height/2;
mcMenu._x = mcElastika._x-mcElastika._width/2;
mcLogo._x = mcElastika._x+mcElastika._width/2;
mcLogo._y = mcElastika._y+mcElastika._height/2;
if (Math.abs(mcElastika._width-w)<1) {
clearInterval(nWidthInterval);
}
updateAfterEvent();
}
Re: Elastic Frames kglad
5/16/2005 12:00:00 AM
Re: Elastic Frames icarusdown
5/16/2005 12:00:00 AM
Re: Elastic Frames kglad
5/16/2005 12:00:00 AM
Re: Elastic Frames icarusdown
5/16/2005 12:00:00 AM
I made a modification so now it scales horizontaly and verticaly.
Nice ABS system :-)

Re: Elastic Frames kglad
5/16/2005 12:00:00 AM
in that for-loop: for example, if you want those buttons to load swfs use:

swfA=["portfolio.swf","references.swf","info.swf"]


for (var ivar = 0; ivar<btnA.length; ivar++) {
btnA[ivar].jvar = ivar;
btnA[ivar].onRelease = function() {
clearInterval(nWidthInterval);
nWidthInterval = setInterval(mcElastikaWidth, 1, mcWidthA[this.jvar]);
targetMC.loadMovie(swfA[this.jvar]);
};
Re: Elastic Frames Travis
5/16/2005 7:36:10 AM
[quoted text, click to view]

Go to flash.com and download the tween extention. It allows you to do
exactly what you are looking for. It is easy to use, free, and adds
very little weight to your final swf.

--
-=tn=-
Re: Elastic Frames kglad
5/17/2005 12:00:00 AM
Re: Elastic Frames icarusdown
5/17/2005 6:46:39 AM
AddThis Social Bookmark Button