3 Replies Latest reply on Jan 3, 2009 9:25 AM by kglad

    Please help me understand AsBroadcaster

    combustion007 Level 1
      Hello,

      I would highly appreciate it if someone can help me understand the functionality behind asBroadcaster. I have been trying to understand this example at:
      http://www.kirupa.com/developer/actionscript/asbroadcaster2.htm

      But it hardly serves the practicality for me. Can I use a AsBroadcaster for such purpose as:

      Lets say if I had a movie clip "btn" on the stage, and there are four more movie clips on stage as well. Can I make the four movie clips as listeners? And the "btn" as the broadcaster, so when I press the "btn" clip, I can fire a function that would bring "_alpha" down to 50 for all the listener clips?

      Thank you.
        • 1. Re: Please help me understand AsBroadcaster
          kglad Adobe Community Professional & MVP
          there's no reason to use the asbroadcaster for events that are already broadcast. specifically, mouse events (like onPress) are already broadcast by buttons and movieclips:

          btn.onPress=function(){
          mc1._alpha = 50;
          mc2._alpha = 50;
          // etc
          }
          • 2. Re: Please help me understand AsBroadcaster
            combustion007 Level 1
            Hello kglad,

            Thank you for that. The reason, I am exploring AsBroadcaster, because I would like to move things around when one particular movie is loaded. So if this movie gets loaded, all the other movies shift their_x, and _y and this only happens when one particular movie is loaded.

            I thought about making and function and then passing an array of the movies as argument. This function will only be executed when this particular movie clip is loaded.

            Am I on right path?

            Thanks a lot.
            • 3. Re: Please help me understand AsBroadcaster
              kglad Adobe Community Professional & MVP
              probably not.

              you would use the asbroadcaster for an event that flash doesn't detect with its standard listeners. flash already has an onLoadComplete() method for the moviecliploader class - but you'll probably want to use onLoadInit().

              it makes no more sense to create a custom onloadcomplete listener than it would to make a custom movieclip class that does nothing different than the standard flash movieclip class.