3 Replies Latest reply on Aug 2, 2006 6:03 AM by Craig Grummitt

    onPress attachMovie help

    jarrodmoreels
      hey im trying to load a movie from the library onPress from a button, problem is when i include the x and y in the movieclip, it turn the mc into a button aswell. can you have a look at this for me and tell me what im doing wrong.

      butt = button (obviously)
      BOXlink = linkage

      butt.onPress = function():Void {
      this.attachMovie("BOXlink", "box", Box1, 2);
      this.box._x = -200;
      this.box._x = -200;
      }

      any help would be great,

      thanks.

      jarrod
        • 1. onPress attachMovie help
          Craig Grummitt Level 3
          a few problems with your script - your attachMovie statement first:
          Box1 - this should be a variable contain a number representing the depth to attach the movie. Does it?
          '2' is meaningless. the fourth parameter in attachMovie is initObject which contains properties and values.
          you set this.box_x twice to the same thing. what's that about?

          but anyway, to resolve your issue of why the movieclip you attach turns into "a button as well" - this is because you attach BOXlink inside the movieclip with an onPress handler. ('this' in the onPress handler refers to butt). how to resolve this depends on where you intended this to appear. assuming you wanted 'box' to appear at the same level as 'butt', your code could read something like:
          • 2. Re: onPress attachMovie help
            jarrodmoreels Level 1
            hey thanks for that ive implemented it in my flash page, but still one little problem. hopefully the last one. When i click on the mc_home button, the button moves to the coordinates of the attached movie. im sure its something simple i just cant see it.

            kind regards,

            jarrod ;)
            • 3. Re: onPress attachMovie help
              Craig Grummitt Level 3
              do you realise that the following line of code:

              this._parent.hpage._x = this._x=39.0
              this._parent.hpage._y = this._y=121.0

              actually means

              this._parent.hpage._x =39.0
              this._parent.hpage._y =121.0
              this._x=39.0
              this._y=121.0