1 Reply Latest reply on Jul 28, 2006 6:02 AM by Newsgroup_User

    need help with listeners...

    koomisan
      hi everyone
      i am doing a thumbnail gallery
      i use a listener to make sure that the thumbs have been loaded before i set any function to them, but the problem i seem to have is that the listener is set for each thumb individually, and i would like to wait untill all the thumbs have been loaded before i set an action to them
      does anyone know how to do it?
      thanks
        • 1. Re: need help with listeners...
          Level 7
          Create:
          1. A counter variable.
          2. An expected count variable.
          3. A function to compare increment the counter variable and compare to the
          expected count variable. If they match then have the function reveal the
          thumbnails.

          Each listener will call the function you create in #3 above.

          Be sure that the scop of the function can be seen by the listeners and the
          variables and the thumbnail objects are seen inside the function.

          var loadCount:Number = 0;
          var LOADCOUNTMAX:Number = 3;
          function showThumbNailsOnceAllAreLoaded()
          {
          loadCount++;
          if (loadCount == LOADCOUNTMAX)
          {
          // Place code to show thumnails here or call a function.

          }


          }

          --
          Lon Hosford
          www.lonhosford.com
          Flash, Actionscript and Flash Media Server examples:
          http://flashexamples.hosfordusa.com
          May many happy bits flow your way!
          "koomisan" <webforumsuser@macromedia.com> wrote in message
          news:eacmpb$cub$1@forums.macromedia.com...
          > hi everyone
          > i am doing a thumbnail gallery
          > i use a listener to make sure that the thumbs have been loaded before i
          > set
          > any function to them, but the problem i seem to have is that the listener
          > is
          > set for each thumb individually, and i would like to wait untill all the
          > thumbs
          > have been loaded before i set an action to them
          > does anyone know how to do it?
          > thanks
          >