View Full Version : Need help with using Button component

04-07-2004, 02:22 PM
I brought over a button form Flash mx to 2004 pro. This button has a click handler of culculat that triggers a script fuction. I would like to replace it with a 2004 button componant, but there is no click handler in the properties so how do I do this? Here is this script I want to trigger upon clicking the calculatebutton.

function calculate() {
totalX = 0;
totalY = 0;
averageX = 0;
averageY = 0;
totalZ = 0;
averageZ = 0;
for (i=0; i<_level0.XYArray["X"].length; i++) {

totalZ = totalZ + _level0.XYArray["X"] + _level0.XYArray["Y"];

averageZ = totalZ/_level0.XYArray["X"].length;

_root.amountZ.text = averageZ;
_level0.XYArray = new Array();
_level0.XYArray["X"] = new Array();
_level0.XYArray["Y"] = new Array();
_level0.XYArray["Z"] = new Array();
_level0.counter = 0;

04-07-2004, 02:49 PM
Can you upload the component? What does the button do when clicked? What are the parameters?

04-07-2004, 03:09 PM
Attached is what I am working on its simple, If you test movie click on the blue image several time and hit the end button, you will see a result.

but you will also notice my component button (end) has changed...... All I wanto do right now is to get the 2004 button component to do the same thing.

The properties of the end button has a Click Handler Pram. The 2004 com/butt does not.

I assume you have to add script now to get it to do the same thing.

Thanks ,

04-07-2004, 08:35 PM
this was an easy fix. Just put the function call in the event handler.
Place this code in the actions panel after you select the button on the stage.

Note that anything in here is refering to the button_btn button
So you have to use an absolute path to the function
or _root.calculate();


04-08-2004, 09:19 AM
Thank you yorkeylady, I am a novice at actionscripting and appriciate your Help. I know what I want to do and know it can be done but don't have the actionscript knowledge. Would you mind helping me out a little more with this?


04-08-2004, 10:32 AM
Sure, I can help through the ruff spots. If you email me at [email protected] or [email protected] I'll get your message. I don't check in the forums but a couple times a month lately.