View Full Version : Calling functions within mouse event functions?
mindfriction
March 16th, 2003, 07:20 PM
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;
}
upuaut
March 16th, 2003, 10:45 PM
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. :)
kode
March 16th, 2003, 10:52 PM
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 :)
and if you call only one function you can use
_root.myButton.onPress = hide;
mindfriction
March 17th, 2003, 06:20 PM
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().
:-\
kode
March 17th, 2003, 06:48 PM
this.onPress = function() {
hide();
dupeIt();
}
:)
pom
March 17th, 2003, 06:49 PM
_root.myButton.onPress = function(){
doThis();
doThat();
}??? I must be missing something... :trout:
kode
March 17th, 2003, 06:56 PM
:P ;)
pom
March 17th, 2003, 06:59 PM
You... you're too fast... said like Neo after Morpheus kicked his *** in the dojo
kode
March 17th, 2003, 07:04 PM
:P :P :P
yes i am :) said like morpheus after kicking neo's ***
ps. who's morpheus? who's neo? :P ;)
mindfriction
March 18th, 2003, 01:13 AM
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:
kode
March 18th, 2003, 02:01 AM
maybe if you post all your code or attach the fla :)
And in regard to Neo and Morpheus , havent u ever seen the movie The Matrix??
being honest .. no :P
it's been like 6 years since the last time i saw a movie :P
but i do know who's morpheus and who's neo ;)
mindfriction
March 18th, 2003, 04:17 AM
:+) ..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.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.