2 Replies Latest reply on Sep 5, 2006 11:16 AM by yogi bear

    Trouble passing variable

    yogi bear Level 1
      I have looped item and window to use the same photo in two different places. I can't get the unique Id for the window loop clicked into the last line of code to control the alpha: "_root.project["window" + Id].pix._alpha = 100;" Is there a way to do? Any help is appreciated.
      thanks
      yogi b

      for(i=0; i < gOverview.itemCount; i++){
      _root.project["item"+i]._visible = true;
      _root.project["item"+i].description = "<b>" + gOverview["proName"+i] + "</b>: " + gOverview["proDescription"+i];
      _root.project["item"+i].Id = gOverview["proId"+i];
      _root.project["item"+i].imageHolder.loadMovie(gOverview["proImage"+i]);
      _root.project["window"+i].pix.loadMovie(gOverview["proImage"+i]);


      _root.project["item"+i].item_btn.onPress = function () {
      itemClicked (this._parent.Id);
      for (var i = 0; i < gOverview.itemCount; ++i) {
      _root.project["item"+i].imageHolder._alpha = 100;
      _root.project["window"+i].pix._alpha = 0;

      }
      this._parent.imageHolder._alpha = 50;
      _root.project["window" + Id].pix._alpha = 100;


      }

      }
        • 1. Re: Trouble passing variable
          fdarweesh Level 1
          try this

          for (i=0; i<gOverview.itemCount; i++) {
          _root.project["item"+i]._visible = true;
          _root.project["item"+i].description = "<b>"+gOverview["proName"+i]+"</b>: "+gOverview["proDescription"+i];
          _root.project["item"+i].Id = gOverview["proId"+i];
          _root.project["item"+i].imageHolder.loadMovie(gOverview["proImage"+i]);
          _root.project["window"+i].pix.loadMovie(gOverview["proImage"+i]);
          _root.project["item"+i].item_btn.onPress = function() {
          itemClicked(this._parent.Id);
          for (var j = 0; j<gOverview.itemCount; ++j) {
          _root.project["item"+j].imageHolder._alpha = 100;
          _root.project["window"+j].pix._alpha = 0;
          }
          this._parent.imageHolder._alpha = 50;
          _root.project["window"+this._parent.Id].pix._alpha = 100;
          };
          }


          Firas Darweesh
          • 2. Re: Trouble passing variable
            yogi bear Level 1
            Firas,

            That was a good idea but didn't work. I changed:

            _root.project["item"+i].Id = gOverview["proId"+i];

            to

            _root.project["item"+i].Id = i;

            and everthing worked.

            Thanks,
            Yogi b