• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Help with simple script

Guest
Aug 08, 2012 Aug 08, 2012

Copy link to clipboard

Copied

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

TOPICS
ActionScript

Views

850

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 08, 2012 Aug 08, 2012

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2012 Aug 08, 2012

Copy link to clipboard

Copied

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);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 08, 2012 Aug 08, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 09, 2012 Aug 09, 2012

Copy link to clipboard

Copied

Thank you very much the second script did just what I wanted.

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: How to  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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 09, 2012 Aug 09, 2012

Copy link to clipboard

Copied

LATEST

Though you might like to see the finished product

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines