0 Replies Latest reply on Oct 4, 2007 2:49 AM by Camus Miu

    Some question about fade in // fade out by hideEffect and showEffect in Actionscript

    Camus Miu Level 1
      Some question about fade in // fade out by hideEffect and showEffect in Actionscript

      Please kindly take a look at the following page:
      http://camusmiu.no-ip.com/HounganQuestion/PictureHolderTest.html
      (can view source)
      I tried to make an image preloaded and scale the image to it's preferred size.
      When I came to consolidate the stuff into a component, I found the application goes weird as I implementation the show/hide effect.
      The third trial which just hide and show the images directly, instead of using viewstack, fail to bring the second image onto screen.
      It just used fadeOut instead of fadeIn(you see there is a flash of the second image)

      After some study of showEffect and hideEffect behaviour, seems the mechanism of hide/show a component works in this way:

      this._fadeIn:Fade = new Fade();
      this._fadeIn.alphaFrom = 0;
      this._fadeIn.alphaTo = 1;
      this._fadeIn.duration = 1000;

      this._fadeOut:Fade = new Fade();
      this._fadeOut.alphaFrom = 1;
      this._fadeOut.alphaTo = 0;
      this._fadeOut.duration = 1000;

      Component_A.visible = true;
      Component_A.setStyle("showEffect", this._fadeIn);
      Component_A.setStyle("hideEffect", this._fadeOut);

      then when I set Component_A.visible = false, the sequence works like following:
      Component_A.visible = true
      Component_A.visible = true, alpha = 100;
      Component_A.visible = true, alpha = 50;
      Component_A.visible = true, alpha = 0;
      Component_A.visible = false;
      The above sequence works visa versa as:
      Component_A.visible = false;
      Component_A.visible = true, alpha = 0;
      Component_A.visible = true, alpha = 50;
      Component_A.visible = true, alpha = 100;
      Component_A.visible = true;
      (Correct me if i am wrong)

      ========================================================================================== ====

      From what I observe from the application, I have two question.

      1) When more than one component using the this._fadeIn, this_fadeOut as the hide/show effects, the component in instance of this._fadeIn? will it mess out if more than one component using the fadeIn instance in the same time?

      2) from the third component, i.e. PictureHolder3, when I load other the picture , it fade out the new image instead of fading in... Seems there is problem if I hide show too frequent. I think when I hide then show right the way, the component only do the hide part...
      Can someone pls look into it and tell me what I did wrong? Cuz in normal practice I don't think appropriate to use ViewStack in Actionscript...