Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

actionscript to command a button to be 'hit'

Status
Not open for further replies.

adamr1001

MIS
Jul 25, 2001
166
CA

is there a command to internally (in actionscript) to 'click' a button? (without the user doing it?)

thanks,

adam
 
for me just simply put the source code in frame one.

for example:
need a button to stop the movie
then you'll need to create a button first.
add in stop(); into that certain button (not the frame)

so if you want to initiate the stop movie sequence without click on the button. just add the stop() command into the frame.

i hope u will understand my explaination
 
thanks for your reply, although thats not thats not what i meant.

i have a button that executes a certain script when released. i'd like to be able to trigger the 'release' of the button (running its script) without having to code it again. this would be more efficicient for my purposes.
 
Best way to do that would be to have the code you need in a function on the main timeline:

function exampleFunction(){
trace ('button clicked!);
}

You can trigger the code by calling the function from the button like this:

on(release){
exampleFunction();
}

but you can also trigger it from anywhere in the movie like this:

exampleFunction();

This way you only have the code in the movie once but you can trigger it from different sources.
 
Typo:

function exampleFunction(){
trace ('button clicked!');
}

 
or you could use for mx only
after giving the button an instance name

myButton.enabled = false;
 
doesn't "myButton.enabled = false;" just turn off the button's ability to work?
 
it gives you a variable to test for and if false you can run your sript.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top