Skip navigation
rogerxzxz
Currently Being Moderated

Help with simple script

Aug 8, 2012 2:58 PM

I was wondering if someone could help me with a simple bit of action script 3. I need to make a movie clip (single_mc) disappear when the user clicks on the mouse (stop_btn). Here’s what I have so far.

function setProperty(event:MouseEvent):void

 


   {          

single_mc.alpha=0;

}

stop_btn.addEventListener(MouseEvent.CLICK, setProperty);

Also I was wonder if you could recommend an Action script 3 book for me. I would like one that is not a training book, but has situations and then the script written out. For example: I click a button and a movie symbol disappears from the stage. I am a graphic artist, that from time to time, needs simple interaction in flash, but cant justify the time to learn the script.

Thanks for your time

 
Replies
  • Currently Being Moderated
    Aug 8, 2012 3:05 PM   in reply to rogerxzxz

    Your code looks fine.  IF it is not working for you, are you getting error messages?  HAve you assigned those instance names to those objects on the stage?

     
    |
    Mark as:
  • kglad
    72,260 posts
    Jul 21, 2002
    Currently Being Moderated
    Aug 8, 2012 3:06 PM   in reply to rogerxzxz

    use the snippets panel to help with you with sample code for basic tasks.

     

     

    function setProperty(event:MouseEvent):void


       {          

    single_mc.visible=false;

    }

    stop_btn.addEventListener(MouseEvent.CLICK, setProperty);

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 8, 2012 9:27 PM   in reply to rogerxzxz

    refer the below sample code.

     

    show_btn.addEventListener(MouseEvent.CLICK, showme);

    hide_btn.addEventListener(MouseEvent.CLICK, hideme);

     

    function showme(Event:MouseEvent):void

    {

         your_mc.visible = true;

    }

     

    function hideme(Event:MouseEvent):void

    {

         your_mc.visible = false;

    }

     

    or you can hide and show your movieclip using one button also. for this refer the below code.

     

    your_btn.addEventListener(MouseEvent.CLICK, hideshow);

     

    function hideshow(Event:MouseEvent):void

    {

         if(your_mc.visible == true)

         {

              your_mc.visible = false;

         }

         else

         {

              your_mc.visible = true;

         }

    }

     

    hope...this will help you

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points