How do a call a button’s on release behavior via actionscript? i.e. without the user pressing the button, I want to call the code that is within the onrelease function of that button.
function pressthebutton(){
//do something
}
button.onPress = function(){
pressthebutton();
}
//then you could later say for example:
pressthebutton();
//or
loadmovieorsomething.onLoad = function(){
pressthebutton();
}
function pressthebutton(){
//do something
}
button.onPress = function(){
pressthebutton();
}
//then you could later say for example:
pressthebutton();
//or
loadmovieorsomething.onLoad = function(){
pressthebutton();
}
How have you applied the onRelease on your button? If it’s a plain “on(release)” you cannot call it as “button.onRelease”. You must have set the eventhandler as a callback like this:
button.onRelease = function()
{
trace("Yeah! You clicked me!")
}