PDA

View Full Version : {MX} Help with functions



flow14
June 24th, 2003, 05:08 PM
I having a problem with a function that resizes movie clips.

I want the function to resize the clips individually (on rollover), but on the first rollover, the targeted clip behaves normally and all the other clips disappear.

Here's an illustration:
http://www.flow14.com/FunctionHelp/index.html

Here's the code I'm using--
In the first frame at _root:


_root.press = false;
function jumbo (whichClip, Size) {
xsize = Size - _root[whichClip]._xscale;
speed += xsize / 3;
speed *= .5;
_root[whichClip]._xscale += speed;

ysize = Size - _root[whichClip]._yscale;
speed += ysize / 3;
speed *= .5;
_root[whichClip]._yscale += speed;
}

Actions assigned to the button(s):


on (rollOver) {
_root.catW.targetSize = 100;
_root.press = true;
}
on (rollOut) {
_root.catW.targetSize = 5;
_root.press = true;
}

Actions assigned to the targeted clips:


onClipEvent (enterFrame) {
if (_root.press == true) {
// The next line calls the Function in frame 1
_root.jumbo(_root.catW.targetSize, this._name);
}
}

I would be happy to send the source file to anyone who can help.

whet15
June 25th, 2003, 03:21 AM
well for a start your sending the variable to the function around the wrong way.... it should be...

_root.jumbo(this._name, _root.catW.targetSize);

flow14
June 25th, 2003, 10:37 AM
Alright, I tried fixing the variable, but it didn't seem to make any difference.

Here's the new code (the function hasn't changed)..

Actions assigned to button(s):


on (rollOver) {
_root.press = true;
_root.catW.targetSize = 100;
}
on (rollOut) {
_root.press = true;
_root.catW.targetSize = 20;
}


Actions assigned to the targeted clip(s):


onClipEvent (enterFrame) {
if (_root.press == true) {
_root.jumbo(this._name, _root.catW.targetSize);
}
}


I think the problem could be with

_root.press == true;
Is there another condition I could use to activate the function?

( I've posted the source file to http://www.flow14.com/FunctionHelp/index.html )

flow14
June 25th, 2003, 11:14 AM
Fixing that condition fixed the problem--almost.

Here's the (almost) working code:
function (1st frame @ root):

_root[whichClip].press = false;
function jumbo (whichClip, Size) {
xsize = Size - _root[whichClip]._xscale;
speed += xsize / 3;
speed *= .5;
_root[whichClip]._xscale += speed;

ysize = Size - _root[whichClip]._yscale;
speed += ysize / 3;
speed *= .5;
_root[whichClip]._yscale += speed;
}

Actions assigned to button(s):

on (rollOver) {
_root.catW.press = true;
_root.catW.targetSize = 100;
}
on (rollOut) {
_root.catW.targetSize = 20;
}

Actions assigned to the targeted clip(s):

onClipEvent (enterFrame) {
if (_root.catW.press == true) {
_root.jumbo(this._name, _root.catW.targetSize);
}
}

The problem now is that I don't know how to set the condition back to false. All the clips move a little after the initial rollover. Updated example/source file at:
http://www.flow14.com/FunctionHelp/index.html