0 Replies Latest reply on Mar 12, 2008 8:29 AM by charner

    Referencing Loaded SWF?

    charner
      I have made a website (see http://www.polysteelsoutheast.com , if you want t get an idea of it) where the menu is a swf file. Currently, its a different menu on each separate swf - each page has its own swf, which is an awful way to do the menu because whenever you need to update the menu its a ton of work). Therefore, I am simply trying to make a menu that looks almost exactly the same with a little square that goes over whichever menu item corresponds to the currently opened swf file and then have the correct location for that square in the "menu" swf file rather than in the individual swfs for each page. I loaded the menu into one of the pages, and I can see that its working partially (when I add a trace after the "current frame" code in the menu swf, it shows up in the actual swf) , but it will not take the x,y,h, and w information I have.

      Here is what is on the menu swf:

      //mb (mb stands for menu block, which is the small square I want over the particular menu item that reflects the file that this menu is currently located into)//

      this.mb_btn.onEnterFrame = function() {
      cX = this._x;
      cY = this._y;
      cW = this._width;
      cH = this._height;
      difY = cY-targY;
      difX = cX-targX;
      difW = cW-targW;
      difH = cH-targH;
      setProperty(this, _x, cX-(difX/5));
      setProperty(this, _y, cY-(difY/5));
      setProperty(this, _width, cW-(difW/5));
      setProperty(this, _height, cH-(difH/5));
      }

      //------------when the current file is building green--------------//
      if (_root.currentFrame=="buildinggreen"){
      //change position of mb//
      targX = 653.1;
      targY = 125;
      targW = 21.9;
      targH = 24.1;
      trace("building green page")


      }

      //------------when the current file is financing--------------//
      if (_root.currentFrame=="financing"){
      //change position of mb//
      targX = 582.1;
      targY = 125;
      targW = 70;
      targH = 24.1;

      }

      HERE IS THE CODE I HAVE ON THE ACTUAL SWF THAT THE MENU IS LOADED INTO:

      _root.currentFrame="buildinggreen";
      loadMovie("polysteelmenu.swf", "menuloader_mc");

      But whenever I actually try it out, the only thing that works is the trace. The mb_btn just stays wherever I've placed it originally in the menu file.

      All I need to know is what I am referencing incorrectly! Does anyone know?

      Thanks!
      Christy