3 Replies Latest reply on Oct 1, 2007 11:18 AM by clbeech

    AS Button Click?

      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?
        • 1. Re: AS Button Click?
          clbeech Level 3
          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.
          • 2. AS Button Click?
            MultiMedia13 Level 1
            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.
            • 3. Re: AS Button Click?
              clbeech Level 3
              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 :)