A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Alpha Fade with Actionscript - Flash 8

  1. #1
    Junior Member
    Join Date
    May 2004
    Posts
    21

    Alpha Fade with Actionscript - Flash 8

    Hi,

    I'm using Flash 8, and I have an FLV Playback Component in a movieclip called logo_mc. The Playback Component is loading a movie from an external source. I want this movieclip to fade out when I click a movie clip called green_mc.

    I closest I have been to getting the right code is...

    Code:
    green_mc.onRelease = function(){
         speed=4;
         targetAlpha=0;
         logo_mc.onEnterFrame = function(){
              alphaDifference=Math.abs(logo_mc._alpha-targetAlpha);
              if(logo_mc._alpha>targetAlpha){
                   logo_mc._alpha-= alphaDifference/speed;
              } else if (logo_mc._alpha<targetAlpha){
                   logo_mc._alpha+=alphaDifference/speed;
              } else if (logo_mc._alpha == targetAlpha){
                   delete logo_mc.onEnterFrame
              }
         }
    }
    Is the problem that I'm trying to fade a movie clip with a component inside?

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    I created a simple example with the code in the livedocs and the code you posted, and it works as expected.

    Just drag the FLV Component into the library.
    Attached Files Attached Files

  3. #3
    \\___unPossible
    Join Date
    Jul 2004
    Posts
    188
    nunomira,

    you would be a life saver if you could reverse this code to a fade in!
    the movie i'm trying to fade in, i created with createEmptyMovieClip and the drawing api, i can get it to fade in but, i can't get it to stop at a certain alpha. it goes all the way to 100 then dissappears.
    Cause that's just who I am this week.

  4. #4
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    I don't have flash now, but I guess it's this:
    code:

    green_mc.onRelease = function(){
    speed=4;
    targetAlpha=60;
    logo_mc.onEnterFrame = function(){
    alphaDifference=Math.abs(logo_mc._alpha-targetAlpha);
    if(logo_mc._alpha<targetAlpha){
    logo_mc._alpha+= alphaDifference/speed;
    } else {
    logo_mc._alpha=targetAlpha;
    delete logo_mc.onEnterFrame
    }
    }
    }


  5. #5
    Junior Member
    Join Date
    May 2004
    Posts
    21
    Unbelieveably great help. Thank you very much!

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