Calling functions within mouse event functions?

Hi! having this small dillema,

Is it not possible to call other functions from generic mouse event functions? Surely it is !!??

ie…



_root.myButton.onPress = function(){
     hide();
}

function hide(){
   _root.myMc._visible = false;
}


It is possible… but doesn’t it call it as if it’s calling from the button. ie, wouldn’t it need to be “_root.hide();” as the call?

just taking a guess at this point. :slight_smile:

It is possible… but doesn’t it call it as if it’s calling from the button. ie, wouldn’t it need to be “_root.hide();” as the call?

since the function has the absolute addressing to the movie clip … it shouln’t be a problem :slight_smile:

and if you call only one function you can use

_root.myButton.onPress = hide;

Yeah thanks guys, but I know that you can call a function straight from the handler

 this.onPress = hide();

But this isnt exactly what Im looking for, should have made my post more clear… Say there are 2 different functions, (both seperate functions as they do completely different things), and I want call both at the time the mouse handler has picked up a mouse event? EG, I want to hide something with function hide(), and at the same time duplicate something else with function dupeIt().

:-\

this.onPress = function() {
	hide();
	dupeIt();
}

:slight_smile:

_root.myButton.onPress = function(){
     doThis();
     doThat();
}

??? I must be missing something… :trout:

:stuck_out_tongue: :wink:

You… you’re too fast… [size=1]said like Neo after Morpheus kicked his *** in the dojo[/size]

:stuck_out_tongue: :stuck_out_tongue: :stuck_out_tongue:

yes i am :slight_smile: [size=1]said like morpheus after kicking neo’s ***[/size]

[size=1]ps. who’s morpheus? who’s neo? :stuck_out_tongue: ;)[/size]

ive tried this, i figured that it should be that easy - a straight function call within the handler function. Maybe somewhere, or somehow something is interfearing but I cant figure it out for the life of me.

And in regard to Neo and Morpheus , havent u ever seen the movie The Matrix??
:scream:

maybe if you post all your code or attach the fla :slight_smile:

And in regard to Neo and Morpheus , havent u ever seen the movie The Matrix??

being honest … no :stuck_out_tongue:
it’s been like 6 years since the last time i saw a movie :stuck_out_tongue:

but i do know who’s morpheus and who’s neo :wink:

:+) …here we go…


var i=1;
...
...
...

createNodeButt.onPress = function(){

createNodeButt._alpha=100;
createEdgeButt._alpha=50;

dupeNode();//go to another function to duplicate the node (a circle shape)

}


function dupeNode()
{
  i++;
 newName = "node" + i;
 tempNode.duplicateMovieClip(newName, i);
 this._parent[newName]._xscale = 175;
 this._parent[newName]._yscale = 175;
 this._parent[newName]._x = xpos;
 this._parent[newName]._y = ypos;
}

There’s a snippet of my code Kax (-:

Hope is make sense. In the onPress handler function I use the _alpha to show user that the button is selected, then I call dupeCircle function to carry out the rest of the actions.