all groups > flash actionscript > march 2007 >
You're in the

flash actionscript

group:

simulate button click



simulate button click IwannaFlashU
3/1/2007 9:51:50 PM
flash actionscript: Hi,

I'm making a game that pits the user against two other computer players (think
jeopardy). I had made this game years ago in other software, and when I first
made it in flash, I made it a "single player" version....now I want my bot
players in there!

Anyhow, I already have the code in the buttons (that represent category and
question value) to do what needs to be done and I need to write code to CALL
the button's onRelease function.

Can this be done? If so, how.......I played with the CALL command and can't
get it to work.

If this can't be done, I know I can fall back on making the code inside of the
buttons, regular functions and having the buttons' onRelease function call
those, as well as my bot players' code that I'm working on now.

But I've always wanted to be able to do this in other applications and will in
future ones, so can someone help me out here? It IS a function
(mybutton.onRelease();) so you SHOULD be able to call it just like any other
established function. right?

thanks
Re: simulate button click Mr Helpy mcHelpson
3/2/2007 11:46:13 PM
function ButtonOneFunction() {
//whatever you would put on your button
}

button1.onRelease = function() {
ButtonOneFunction();
}

The first would just be your defined function to do your bidding. (which you
could then call anytime you want as your bot player.

The second assigns that function to that button.
Re: simulate button click IwannaFlashU
3/3/2007 12:28:24 AM
Yeah, I know how to write a function and also know I can then call that
function from a button click............What I'm asking is, is there a way you
can call the built in functions of a button?

ie, using your example, how can i call button1.onRelease? this function is
called when the user clicks on that button..........but I want my CODE to call
that same function.

I'm guessing the answer is no, which is stupid because these are functions and
you should be able to call them.
Re: simulate button click willrose
3/3/2007 1:21:50 AM
If I remember correctly you can do this:

btn1.onRelease = function():Void
{
//function here
}

//invoke the event
AddThis Social Bookmark Button