2 Replies Latest reply on Sep 1, 2006 3:44 AM by thewhitewood

    Fade effect: how to do with "onEnterFrame"?

      I have a map with each city represented as a dot (MC). When you mouse over the dot, another MC with more city details/text quickly fades in, and fades out when you roll out. But I can't get the full fade effect working. Need your advice...

      In the dot MC, I put:

      on (rollOver) {
      on (rollOut) {

      In the root, showCity() and hideCity() are functions to fade in and out the city details MC (city_sanfrancisco). I figured they should be at the root level so they can be used by other city dots (city_sandiego, city_boston, etc.) as well:

      //this lets me change the speed for fading in and another speed for fading out
      var speedIn;
      speedIn = 20;
      var speedOut;
      speedOut = 20;

      //hard-coded city for now; set city to invisible when movie starts
      var city = city_sanfrancisco;
      city._alpha = 0;

      //this shows the city details by fading in
      function showCity(){
      city._alpha += _root.speedIn;
      if (city._alpha > 100){
      city._alpha = 100;
      function hideCity(){
      city._alpha -= _root.speedOut;
      if (city._alpha < 0){
      city._alpha = 0;

      What this doesn't do is the full fade effect, because the function only executes once, so city._alpha doesn't reach 100 when it fades in. I've seen in other fade effect scripts, that they use the enterFrame event, but I don't now how to use it here... or what is the right syntax to make the city details MC fade in to 100% on rollOver, and fade out to 0 on rollOut... and still be able to apply a speed setting.

      Any help would be appreciated.