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

Fading everything at once to black

New Here ,
May 27, 2015 May 27, 2015

Copy link to clipboard

Copied

Hi folks, I'm working on a flash program I've cobbled together mostly myself over a couple of years. Never took an actual class on actionscript or Flash, but I have had years of lessons in other programming languages, so reading online tutorials on the bits I need as they come up and a bit of intuition here and there has worked out so far. However, I've come to something that I can't quite find an answer for.

I'm trying to set it up so that a single button press will fade everything in the scene to black all at the same time, without having to add extra frames for the fade out. Most everything I'm finding is just ways to fade single images or objects out, or to do things over the course of a number of frames. The program is set up in such a way that every two frames is a different possible outcome based on criteria in the first frame, and I'd like to set it up such that a button in each of those two frames fades out the entire thing. I did find this little snippet of code to fade a movie clip instance named img1_mc:

import fl.transitions.*;

import fl.transitions.easing.*;

TransitionManager.start(img1_mc, {type:Fade, direction:Transition.IN, duration:9, easing:Strong.easeOut});

I'm a bit uncertain, however, about the specifics of it, wasn't certain what to put instead of img1_mc to fade out everything in the scene for that frame, or if that's even the best way to go about it. Any tips here would be very much appreciated.

TOPICS
ActionScript

Views

533

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

correct answers 1 Correct answer

LEGEND , May 27, 2015 May 27, 2015

If you want to fade to black then create  a black overlay that you fade in from transparent to full view (alpha from 0 to 1).

Look into using one of the tweening classes for the tranisition.  There is the built-in Tween class and then there are the better performing third party tweening engines such as TweenLite

Votes

Translate

Translate
LEGEND ,
May 27, 2015 May 27, 2015

Copy link to clipboard

Copied

If you want to fade to black then create  a black overlay that you fade in from transparent to full view (alpha from 0 to 1).

Look into using one of the tweening classes for the tranisition.  There is the built-in Tween class and then there are the better performing third party tweening engines such as TweenLite

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
New Here ,
May 29, 2015 May 29, 2015

Copy link to clipboard

Copied

Alright, I have that part down, thanks for that. Next part, however, has me a bit thrown. How do I have that overlay on top of everything in an editable format that can be done with actionscript (a movie clip or symbol or the like), yet still be able to click the buttons underneath it to trigger the fade? I tested it out a bit, and nothing underneath it can be clicked on the frame it's in.

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
LEGEND ,
May 29, 2015 May 29, 2015

Copy link to clipboard

Copied

Use actionscript to set the visible property of the overlay to false.  When the click is done set it to be true just before you start the fade-in.

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
New Here ,
May 31, 2015 May 31, 2015

Copy link to clipboard

Copied

Thanks much! Got it working fine now.

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
LEGEND ,
May 31, 2015 May 31, 2015

Copy link to clipboard

Copied

LATEST

You're welcome

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