0 Replies Latest reply on Apr 20, 2007 2:32 AM by absurd29

    Hotspots in a loaded movie not referencing correctly

    absurd29 Level 1
      My main movie uses an onResize function to reposition movie clips relative to stage H & W, a movie loaded into level 1 contains the hotspots that aren't registering properly.

      CODE IN MAIN MOVIE:
      Stage.scaleMode = "noScale";
      Stage.align = "TL";
      ///////////REPOSITION ELEMENTS WHEN STAGE IS RESIZED////////////
      this.onResize();
      function onResize() {
      newPosition();
      }
      Stage.addListener(this);
      function newPosition() {
      stageH = Stage.height;
      stageW = Stage.width;
      bkgrnd_mc._width = stageW;
      bkgrnd_mc._height = stageH;
      main_mc._x = (stageW- main_mc._width)/2;
      main_mc._y = (stageH- main_mc._height)/2;
      //loaded movie- all hotspots are inside this MC:
      _level1.temp_mc._x = (stageW-_level1.temp_mc._width)/2;
      _level1.temp_mc._y = ((stageH-_level1.temp_mc._height)/2);
      }


      on loading a movie into level 1 – I can see that the hotspots contained within it are visually repositioned when browser resized (hotspots all inside ‘_level1.temp_mc’) but the x & y coordinates referenced during hitTest remain those of the original loaded movie – ignoring the fact it looks as though it has been physically repositioned!
      Hit test code placed inside the loaded movie (in ‘temp_mc’) uses shapeflag method to test hits, eg:

      //display readings:
      _level1.temp_mc.reader_mc.onPress = function() {
      this.startDrag();
      };
      _level1.temp_mc.reader_mc.onRelease = function() {
      this.stopDrag();
      if (_level1.temp_mc.hotspot1_mc.hitTest(_level1.temp_mc.reader_mc._x, _level1.temp_mc.reader_mc._y, true) {
      _level1.temp_mc.temp_txt.text = " hotspot1";
      }
      else {
      _level1.temp_mc.temp_txt.text = "Nothing detected";
      }
      };

      Resize function also called in first frame pf loaded movie: _level0.onResize();

      Any help gratefully received, thanks in advance.