A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Please Help!! - Newbie on MX (fade in / out)

  1. #1
    Join Date
    May 2002

    Please Help!! - Newbie on MX (fade in / out)

    OK, lets say I have four buttons that need to trigger different clips or stills (let's say A,B,C, and D). When the user clicks A the A image fades in. When they click B, A fades out and B fades in at the same time...a dissolve. Mainly what will be dissolving are PNG images. This needs to be done for all possible combinations. I've seen the fade in / out component, but have no idea how to use it. I know there may be many ways to do this, I'm looking for something simple, and easy to expand upon.

    So far I have tried to make each PNG into a movie clip that tweens the alpha up then back down with a stop action on the fully opaque frame. I can have the button (A) play its associated clip and I get the fade in. If I click C, its clip can fade up but "A" still remains.

    With a lot a ActionScripting, I may be able to look at the current opaque clip and issue it a play command (to fade it out) at the same time plating the new clip (to fade in)...but I think that is way beyond what I can currently do in MX.

    The other problem with "stacking" all these invisible PNG movie clips, is that the load time will be way too long. If the user clicks the last button, everything will need to be loaded before it can play.

    Sorry to make this so long, but I wanted to fully explain the situation so I could get a proper answer.

    Also, I'm using PNG files because I need to retain transparency...if that helps and or matters...



  2. #2
    Join Date
    Jan 2001
    okay - here's a brief rundown of what i'd do:

    first : i'd only use actionscript to control the alpha of the pics. that way, you can easily go forward/backward with a click, i.e.,

    on (press)
    while (alpha < 100){
    pic.alpha += 10

    and a similar one decreasing the alpha.

    then you have to let the system know which pic is active. create a variable, call it activePic. if you click on the first pic, make activePic = 1. then what you can do is have your code check activePic and decrease the proper alpha through if, else if statements or switch statements (a switch statement would probably be cleaner), e.g.,

    if (activePic == 1) {
    while (alpha > 50) {
    pic1.alpha -= 10;
    else if (activePic == 2) {
    while (alpha > 50) {
    pic2.alphia -=10;

    et cetera

    i'm glossing over some finer details, but that might put you in the right directions.

    let me know if this makes sense or if you want some more examples. good luck.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center