3 Replies Latest reply on Jun 11, 2009 4:25 AM by Ned Murphy

    making a button visible upon trigger of a function

    PurpleArts

      hi,

       

      i created a button that is set to visible= false upon the load of the swf,

      and this is button should become visible when it the function is triggered.

      but the result to me is that, the button becomes visible and invisible again. you'll just caught a glimpse of the button.

       

      here is my code:

       

      //Instance of the Podcast Button, setting it to invisible
      onload()
      {
      _podcastDownload._visible = false;
      }

       

       

       

       

      _podcastDownload.onPress = function()
      {
          trace("press occured");
          TriggerPodcast();
      }

       

      //Function Podcast Button
      function TriggerPodcast():Void
      {
          trace("downloadPodcast was clicked");
          _podcastDownload._visible = true;
      }

       

      thanks for the help..

        • 1. Re: making a button visible upon trigger of a function
          Ned Murphy Adobe Community Professional & MVP

          Can you explain a little more about what is going on in this scenario?  If the button triggers the function, and the button is invisible, you can't click on the button to trigger the function.  Invisible buttons don't function.

          • 2. Re: making a button visible upon trigger of a function
            PurpleArts Level 1

            what i meant is that at load the button is invisible upon load of the movie. it will only become visible when a certain function is called.

             

             

            this function is actually triggered by a javascript, when this actionscript function is triggered by a button in java , the button should become visible.

             

            i set the button at visible = true within that function, but, you'll only see a glimpse of the button during the event.

             

            here is the function where the button should be visible. i need the button to stay visible and become invisble only after i closed the player.

             

             

            but on load i set the button to invisible.

            //Instance of the Podcast Button, setting it to invisible
            onload()
            {
            _podcastDownload._visible = true;
            }

             

             

             

            ExternalInterface.addCallback("sendAudioPodcastURLToFlash",objectInstance,getAudioPodcastU RLFromJS);
            function getAudioPodcastURLFromJS(AudioPodStr:String,AudioPodStr1:String):Void
                {
                    var audPodcastURL:String = AudioPodStr;
                    var audPodcastDL:String = AudioPodStr1;
                    label_received.text = "The path of the media that was passed to js was: " + audPodcastURL;
                    _flvPlayBack.contentPath = audPodcastURL;
                    _flvPlayBack.load(audPodcastURL);
                    _flvPlayBack.play(audPodcastURL);       
                    TriggerPodcast(audPodcastDL);
                    _podcastDownload._visible = true;
                }//End of Get Audio Podcast URL from JS Function

            • 3. Re: making a button visible upon trigger of a function
              Ned Murphy Adobe Community Professional & MVP

              What you should do is put identifiable traces at each place where the button is made visible and invisible so that you can identify what is toggling thtat property when.