1 Reply Latest reply on May 3, 2006 9:46 AM by kglad

    Passing values (or events) between movie clips.

      Hello all,

      I'm not an AS guru, but I'm working on it. I've got a question that may seem simple to the gurus on this board.

      I've created a SWF which has many graphics and buttons on it. It is more or less a menu of sorts.

      In a new FLA project, I've loaded this SWF as follows:

      this.createEmptyMovieClip("blank_mc", 10);
      with (blank_mc) {
      loadMovie("../../../../flash/toolbar.swf", blank_mc);

      The SWF loads as I expect and "works" as it should. Now onto the "tricky" part.

      In the SWF, each button has some AS on the main timeline setting _root variables when the button is clicked.

      For example:

      _root.menuBookmarks = false;
      btnBookmarksMenu.onRelease = function () {
      _root.menuBookmarks = not(_root.menuBookmarks); //toggle the _root variable value

      In the FLA which loads the SWF, I'm attempting to detect these button clicks by monitoring the appropriate _root variables.

      For example, the AS for a particular frame in my FLA has something like:
      if(_root.menuBookmarks == true) {

      Things aren't working out as I'd expect using this method.

      Should I be using events/listners rather than boolean _root variables?

      My goal is: from within my new FLA project, have the ability to be able to detect which button was clicked in the loaded SWF and handle this situation appropriately (such as goto some place in the timeline in my FLA).

      Thanks much in advance,

        • 1. Re: Passing values (or events) between movie clips.
          kglad Adobe Community Professional & MVP
          _root.menuBookmarks is available to all timelines in your _level0 swf, including the main swf that loads the external swf and the external swf.

          however, if you fail to prefix menuBookmarks with _root, you will probably run into problems (unless you are using that on the main timeline of your main swf).

          if you can't track your problem using the above info, specify the problem(s) you're having.