Skip to main content
Inspiring
October 1, 2007
Question

AS Button Click?

  • October 1, 2007
  • 3 replies
  • 402 views
Is it possible to write actionscript to make a button on the stage think it's been clicked? So, if it's setting there is there a way to tell it it has been clicked with out the user having to click it?
This topic has been closed for replies.

3 replies

clbeech
Inspiring
October 1, 2007
OK, no sweat, everyone has to start at the beginning at some point :)

If you're loading into the MC named 'mp3_mc', just set that to be invisible previous to the load, by assigning the _visible property to false:

mp3_mc._visible = false;
mp3_mc.loadMovie('myPlayer.swf', 0);

...then change the property assignment when the button is clicked:

player_btn.onRelease = function() {
mp3_mc._visible = true;
}

...there you go, that should do it :)
Inspiring
October 1, 2007
Well here's what I guess I was thinking. I have a simple button named player_btn with the ascript as:

mp3_mc.loadMovie("myPlayer.swf", 0);


player_btn.onRelease = function() {
mp3_mc._visible = !mp3_mc._visible;
}

As simple as it is it works great for me. But I want the player_mc not to be seen until a user clicks the player_btn. But I can seem to have it not visible without it not loading the myplayer.swf.
I know this is simple but bear with me I am still learning Flash.

I just want the myplayer.swf to load and play without being seen until you click the player_btn. I know to AS the button to think it had been clicked is a long round about way but that's the only thing I could think of at the moment.
clbeech
Inspiring
October 1, 2007
do you mean, that the button 'clicks' itself or activates, after a certain amount of time has passed or something? And yeah I suppose there are some ways to do this, but it will depend on how you want to initiate the event.