alpha = 0 is not the same as visible = false

February 13th, 2008 . by polyGeek

I’m working on an image browser to go along with a video player. I noticed that after browsing to the 12th image the loading slowed down considerably.

When an image is replaced it fades to 0 and the image that gets loaded fades to 100. Nothing I haven’t done countless times before.

To fix the slow loading after the 12th image I tested a few things. First I made sure that my reference to the imageLoader was cleaned up. It was. Yeah me. :-)

Then I tried removeMovieClip on the image that faded to 0. That fixed it. Problem is that now I have to load each image every time instead of just fading it back to 100 if it’s already been loaded.

Then I tried setting the visible = false  after the image had faded out. That worked. Everything runs smooth.

I would have thought that an alpha = 0 would take that object out of the rendering list but I suppose it doesn’t. If you don’t want the Flash player to be rendering an object set it’s visibility to  false.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Digg
  • Facebook

5 Responses to “alpha = 0 is not the same as visible = false”

  1. comment number 1 by: Quentin

    I think an object with alpha set to 0 still receives mouse events, but one with with visible=false doesn’t…

  2. comment number 2 by: henrique matias

    happiness would not be the same if flash developers had a perfect player :P

  3. comment number 3 by: polyGeek

    @Quentin, correct. visible=false removes the Mouse interaction.

  4. comment number 4 by: Quentin

    Yep!
    That’s why alpha=0 is slower than visible=false…

  5. comment number 5 by: Freddy

    hehehe, it’s been like that since _alpha=0 exists

    another thing to notice: even if out of stage, visible objects slow down the player

Leave a Reply

Name

Mail (never published)

Website

- Why ask? This confirms you are a human user!

   




© Copyright 2008 polyGeek.com / Dan Florio, All Rights Reserved Except Where Explicitly Stated
Web Developement Blogs - Blog Catalog Blog Directory
M2 Websites