# {MX} Help with functions

**URL:** <https://forum.kirupa.com/t/mx-help-with-functions/23972>\
**Category:** flash\
**Created:** [June 24, 2003, 9:08pm UTC](https://forum.kirupa.com/t/mx-help-with-functions/23972 "2003-06-24T21:08:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![flow14](https://avatars.discourse-cdn.com/v4/letter/f/ec9cab/32.png) [@flow14](https://forum.kirupa.com/u/flow14)\
**Post date:** [June 24, 2003, 9:08pm UTC](https://forum.kirupa.com/t/mx-help-with-functions/23972/1 "2003-06-24T21:08:32Z")

</div>

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](http://www.flow14.com/FunctionHelp/index.html)

Here’s the code I’m using–  
In the first frame at \_root:

```auto

_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):

```auto

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

```

Actions assigned to the targeted clips:

```auto

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 25, 2003, 7:21am UTC](https://forum.kirupa.com/t/mx-help-with-functions/23972/2 "2003-06-25T07:21:32Z")

</div>

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);

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 25, 2003, 2:37pm UTC](https://forum.kirupa.com/t/mx-help-with-functions/23972/3 "2003-06-25T14:37:44Z")

</div>

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):

```auto

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):

```auto

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

```

I think the problem could be with

```auto
 _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](http://www.flow14.com/FunctionHelp/index.html) )

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 25, 2003, 3:14pm UTC](https://forum.kirupa.com/t/mx-help-with-functions/23972/4 "2003-06-25T15:14:16Z")

</div>

Fixing that condition fixed the problem–almost.

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

```auto

_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):

```auto

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

```

Actions assigned to the targeted clip(s):

```auto

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](http://www.flow14.com/FunctionHelp/index.html)
