Skip navigation
Bertifer
Currently Being Moderated

Automatically close flash animation once finished?

Nov 26, 2012 10:31 AM

Tags: #automatically #flash #script #pro #3.0 #actionscript #close #disappear #cs6 #unclickable

Hi there,

 

So I'm pretty new to flash.  I have made a quick fade-in, fade-out animation that I wish to put over an interactive menu.  So when people load the home page, the quick animation plays, then disappears showing the interactive menu behind it. 

 

Problem I'm having is that the animation fades away completely (by using tweening and alpha 0), but once it "disappears", I still can't click anything in the menu.  I am guessing that even though the animation seems to fade away, it's really only invisible and still present, making it impossible to click what's behind it. 

 

So I am wondering if there is any script/code I can use that not only makes it fade away invisible, but also completely closes that animation out once it is finished running.

 

 

Any help is appreciated.

-Mike

 
Replies
  • Currently Being Moderated
    Nov 26, 2012 11:42 AM   in reply to Bertifer

    Just setting the alpha to 0 doesn't remove it from the display. Is this a timeline tween or a code tween?

     

    If it's a timeline tween simply make sure the final frame of the timeline tween is either an empty or blank frame. You want to make sure that faded in graphic is completely gone so it doesn't cover the menu.

     

    If it's a code based tween, tell me which library you're using and I'll give you some code to remove the object on that libraries "tween complete" function.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 26, 2012 12:57 PM   in reply to Bertifer

    You probably have the element on that frame. In your picture the frame looks darker gray which indicates it has an element in it. Here's a screenshot of what I mean:

     

    emptyframe.JPG

     

    Notice 2 things.

     

    1, The layer with ActionScript on it is a blank keyframe. If your keyframe was blank it would be colored white like mine. So I think your objects are still on the timeline in that layer.

     

    2, Notice the picture tween (I see you're using Classic Tweens). The last frame is on frame #29. The stop script is at frame 30 where there is nothing in the layer below, not even a blank frame. It's perfectly fine to put a "blank keyframe" there but if it's truely empty it will be white like my blank keyframe on frame 30 in the ActionScript layer.

     

    To assure there's nothing in your frames just go on one of your picture layers, click on the final frame with the stop() script in the timeline and edit->select all to see if anything gets selected. If it does, delete it. Nothing should be on your final frame except a single stop() script.

     

    After that verifies that it was just covering your menu I'd rather continue and tell you how to remove that clip overall, unless you know you'll need that image to fade in and out again at some point.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 26, 2012 1:41 PM   in reply to Bertifer

    What you posted above looks good. As long as the playhead stops at the last frame you can be sure whatever is over your menu is not the graphic that is fading in and out.

     

    Yes you can have it request to have itself removed. "How" to do it is a question of how you have your overall project set up.

     

    If you have a main timeline that has this splash screen fade in/out animation directly on it then I'll suggest one way. If this animations is loaded externally with code or from a SWC, etc then it will be removed a different way. You'll have to let me know the setup of your project.

     

    In the meantime I've already answered this question previously. If you scroll down to the bottom of this thread and look at the code I give plenty of code samples and files to illustrate how to have a display object that is a child request to be removed from the parent:

     

    http://forums.adobe.com/message/4855804#4855804

     

    Note: These are code-versions of doing this. The timeline version is simply to stop the playhead where the layer that contains this animation has no frames or blank frames. It is effectively removed at that point.

     

    There's a lot to read there but the absolute last bit of code I posted is the easiest of all the methods. Nonetheless there's several to choose from. See if one of those works for you.

     

    The specific bit of code would be placed on the last frame under the stop():

     

    MovieClip(this.parent).removeChild(this);

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 27, 2012 10:19 AM   in reply to Bertifer

    You're welcome and please mark any correct answers so we can filter unanswered questions. Good luck!

     
    |
    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