School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,419 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,508 people online right now. Registration is fast and FREE... Join Now!




Hide Movieclip initially in Flash

 

Hide Movieclip initially in Flash, Hide Movieclip initially in Flash

bronya

18 Jun, 2007 - 01:52 PM
Post #1

New D.I.C Head
*

Joined: 18 Jun, 2007
Posts: 3


My Contributions
Hi,

Can anyone tell me please how to do the following using actionscript:

I want a movie clip to be initially invisiable, then at the click of a button appear. I know how to program the button to make it appear, but dont know how to make the clip invisible beforehand!! I would also like to know how to control alpha fade through actionscript.

Any help welcome!

Thanks!!

User is offlineProfile CardPM
+Quote Post


DilutedImage

RE: Hide Movieclip Initially In Flash

18 Jun, 2007 - 07:27 PM
Post #2

D.I.C Addict
Group Icon

Joined: 20 Nov, 2006
Posts: 644



Thanked: 12 times
Dream Kudos: 25
My Contributions
AS2: movieClipName._visibility = false;
AS3: movieClipName.visibility = false;

AS2: movieClipName._alpha = 92; // value between 0 and 100
AS3: movieClipName.alpha = .92; // value between 0 and 1
User is offlineProfile CardPM
+Quote Post

DigitalMonk

RE: Hide Movieclip Initially In Flash

16 Jun, 2009 - 02:05 PM
Post #3

New D.I.C Head
*

Joined: 16 Jun, 2009
Posts: 5


My Contributions
Working on a similar quest...

The fading works for me (NUMPAD_5) is my trigger in the code below... easily converted to a mouse event. Note that I do not use the easing parameter in the TransitionManager code line.

Let me know if you find the trick to hiding a movieclip when the movie starts. If you manually set the alpha to 0% it overrides the transition code. The transition still works, but the movieclip is hidden.

CODE

Mouse.hide();
var a:int = 0;


import fl.transitions.*;
import fl.transitions.easing.*;



function fadeIn() {
    TransitionManager.start(br_mc, {type:Fade, direction:Transition.IN, duration: 2});
    trace("fadeIn");
}

function fadeOut() {

    TransitionManager.start(br_mc, {type:Fade, direction:Transition.OUT, duration: 2});
    trace("fadeOut");
}

stage.addEventListener(KeyboardEvent.KEY_DOWN, keyStroke);

function keyStroke(event:KeyboardEvent):void {
    if (event.keyCode == Keyboard.NUMPAD_5 && a == 0) {
        trace("5 press in");
        fadeIn();
        a = 10;
    } else if (event.keyCode == Keyboard.NUMPAD_5 && a == 10) {
        trace("5 press out");
        fadeOut();
        a = 0;
    }
}


Good luck
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 11:49PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month