1 2 Previous Next 72 Replies Latest reply on Oct 3, 2006 6:31 PM by Newsgroup_User

    Passing values from mc to mc/instance to instance

    disco-logic
      Ive made a new topic for this cos the last one went wildly off-topic...

      Im trying to use info from the soldier instance to set up bullets he fires.
      Each new bullet wants to be its own instance/mc whatever. Thing is that I cant get the info out of _root.soldier and into _root.bulletX (where X is an arbitary value)

      there is code in the bullet onClipEvent(load) like
      this._rotation = soldier1._rotation;
      Which by the looks of some traces Ive done just gives soldier._rotation as undefined.

      How can I pass a value out of soldier to use here?
        • 1. Re: Passing values from mc to mc/instance to instance
          crazyjoemilan Level 2
          this._rotation = whatever. //defines this._rotation, it does not define "whatever"

          soldier1._rotation = whatever //defines soldier1._rotation.

          X = Y //defines X using Y.

          Y = X //defines Y using X.

          does that help?
          • 2. Re: Passing values from mc to mc/instance to instance
            disco-logic Level 1
            hmm afraid that the kind of code I was using. The problem is you cant take a variable out of one instance and use it in another.

            I know that soldier1._rotation is working cos it work for soldier clip.

            The problem comes when you want to pass soldier1._rotation onto the bullet cos a statement like

            bullet._rotation = soldier1._rotation;

            within the code for the bullet will simply decide that it cant find soldier1._rotation. What I think I need is a way to make the value public
            • 3. Re: Passing values from mc to mc/instance to instance
              Level 7

              "disco-logic" <webforumsuser@macromedia.com> wrote in message
              news:efk7gi$2f1$1@forums.macromedia.com...
              > hmm afraid that the kind of code I was using. The problem is you cant
              > take a
              > variable out of one instance and use it in another.
              >
              > I know that soldier1._rotation is working cos it work for soldier clip.
              >
              > The problem comes when you want to pass soldier1._rotation onto the bullet
              > cos
              > a statement like
              >
              > bullet._rotation = soldier1._rotation;
              >
              > within the code for the bullet will simply decide that it cant find
              > soldier1._rotation. What I think I need is a way to make the value public
              >

              okay, here is what you want to check (for this case and any case when you
              have some issue like this --- unexpected behavior)

              TRACE, TRACE, TRACE.

              Each bullet is coming from an attachMovie or a duplicateMovieClip, right???

              In either case, in your code you have:

              onClipEvent(load) {
              this._rotation = solder1._rotation;
              }

              which is a valid statment. This says, find the rotation value of soldier1
              and assign it to this (the Bullet clip)

              So, TRACE...
              add
              trace(soldier1._rotation);
              to the onClipEvent(load) handler above. You see that soldier1._rotation is
              undefined.

              next add another TRACE...
              add
              trace(this);
              to the handler.

              You will see that 'this' is referring to your bullet. But, soldier1 is not
              in the bullet instance, it is in the _parent instance (most likely - depends
              on your setup) so, you should try

              onClipEvent(load) {
              this._rotation = _parent.soldier1._rotation;
              }

              if that doesn't work, add the following traces and post their output

              trace(this);
              trace(this._parent);






              Ive made a new topic for this cos the last one went wildly off-topic...

              Im trying to use info from the soldier instance to set up bullets he fires.
              Each new bullet wants to be its own instance/mc whatever. Thing is that I
              cant get the info out of _root.soldier and into _root.bulletX (where X is an
              arbitary value)

              there is code in the bullet onClipEvent(load) like
              this._rotation = soldier1._rotation;
              Which by the looks of some traces Ive done just gives soldier._rotation as
              undefined.

              How can I pass a value out of soldier to use here?


              • 4. Re: Passing values from mc to mc/instance to instance
                Level 7

                "disco-logic" <webforumsuser@macromedia.com> wrote in message
                news:efk7gi$2f1$1@forums.macromedia.com...
                > hmm afraid that the kind of code I was using. The problem is you cant
                > take a
                > variable out of one instance and use it in another.
                >
                > I know that soldier1._rotation is working cos it work for soldier clip.
                >
                > The problem comes when you want to pass soldier1._rotation onto the bullet
                > cos
                > a statement like
                >
                > bullet._rotation = soldier1._rotation;
                >
                > within the code for the bullet will simply decide that it cant find
                > soldier1._rotation. What I think I need is a way to make the value public
                >

                okay, here is what you want to check (for this case and any case when you
                have some issue like this --- unexpected behavior)

                TRACE, TRACE, TRACE.

                Each bullet is coming from an attachMovie or a duplicateMovieClip, right???

                In either case, in your code you have:

                onClipEvent(load) {
                this._rotation = solder1._rotation;
                }

                which is a valid statment. This says, find the rotation value of soldier1
                and assign it to this (the Bullet clip)

                So, TRACE...
                add
                trace(soldier1._rotation);
                to the onClipEvent(load) handler above. You see that soldier1._rotation is
                undefined.

                next add another TRACE...
                add
                trace(this);
                to the handler.

                You will see that 'this' is referring to your bullet. But, soldier1 is not
                in the bullet instance, it is in the _parent instance (most likely - depends
                on your setup) so, you should try

                onClipEvent(load) {
                this._rotation = _parent.soldier1._rotation;
                }

                if that doesn't work, add the following traces and post their output

                trace(this);
                trace(this._parent);






                Ive made a new topic for this cos the last one went wildly off-topic...

                Im trying to use info from the soldier instance to set up bullets he fires.
                Each new bullet wants to be its own instance/mc whatever. Thing is that I
                cant get the info out of _root.soldier and into _root.bulletX (where X is an
                arbitary value)

                there is code in the bullet onClipEvent(load) like
                this._rotation = soldier1._rotation;
                Which by the looks of some traces Ive done just gives soldier._rotation as
                undefined.

                How can I pass a value out of soldier to use here?


                • 5. Re: Passing values from mc to mc/instance to instance
                  disco-logic Level 1
                  does _parent refer to the mc that "gave birth" to the new instance?

                  so if duplicateMoveClip(..."bullet"...) is in soldier1 will the _parent of bullet be soldier1? or will it be the original bullet Im duplicating?

                  Also my traces threw up odd results. I got the rotation to work but not the _x and _y positions. Odd.

                  I think I might start using proper .as scripts and define everything as classes cos this is getting too confusing using mc instances with code inside them.
                  • 6. Re: Passing values from mc to mc/instance to instance
                    Level 7

                    "disco-logic" <webforumsuser@macromedia.com> wrote in message
                    news:efkdr8$95f$1@forums.macromedia.com...
                    > does _parent refer to the mc that "gave birth" to the new instance?

                    if you are using duplicateMovieClip, then the _parent is the same for all
                    duplicated bullets... the holder of the original bullet. So, if the bullet
                    instance is inside of your soldier1 MC then the _parent of each duplicated
                    bullet will be the soldier1.

                    > so if duplicateMoveClip(..."bullet"...) is in soldier1 will the _parent of
                    > bullet be soldier1? or will it be the original bullet Im duplicating?
                    >
                    > Also my traces threw up odd results. I got the rotation to work but not
                    > the
                    > _x and _y positions. Odd.

                    What are the outputs of your 'odd results'... if _x and _y don't work, TRACE
                    'em.

                    trace(this._parent._x);
                    trace(this._parent._y);

                    > I think I might start using proper .as scripts and define everything as
                    > classes cos this is getting too confusing using mc instances with code
                    > inside
                    > them.
                    >

                    This is my preferred way to go.



                    • 7. Re: Passing values from mc to mc/instance to instance
                      Level 7

                      "disco-logic" <webforumsuser@macromedia.com> wrote in message
                      news:efk7gi$2f1$1@forums.macromedia.com...
                      > hmm afraid that the kind of code I was using. The problem is you cant
                      > take a
                      > variable out of one instance and use it in another.
                      >
                      > I know that soldier1._rotation is working cos it work for soldier clip.
                      >
                      > The problem comes when you want to pass soldier1._rotation onto the bullet
                      > cos
                      > a statement like
                      >
                      > bullet._rotation = soldier1._rotation;
                      >
                      > within the code for the bullet will simply decide that it cant find
                      > soldier1._rotation. What I think I need is a way to make the value public
                      >

                      okay, here is what you want to check (for this case and any case when you
                      have some issue like this --- unexpected behavior)

                      TRACE, TRACE, TRACE.

                      Each bullet is coming from an attachMovie or a duplicateMovieClip, right???

                      In either case, in your code you have:

                      onClipEvent(load) {
                      this._rotation = solder1._rotation;
                      }

                      which is a valid statment. This says, find the rotation value of soldier1
                      and assign it to this (the Bullet clip)

                      So, TRACE...
                      add
                      trace(soldier1._rotation);
                      to the onClipEvent(load) handler above. You see that soldier1._rotation is
                      undefined.

                      next add another TRACE...
                      add
                      trace(this);
                      to the handler.

                      You will see that 'this' is referring to your bullet. But, soldier1 is not
                      in the bullet instance, it is in the _parent instance (most likely - depends
                      on your setup) so, you should try

                      onClipEvent(load) {
                      this._rotation = _parent.soldier1._rotation;
                      }

                      if that doesn't work, add the following traces and post their output

                      trace(this);
                      trace(this._parent);






                      Ive made a new topic for this cos the last one went wildly off-topic...

                      Im trying to use info from the soldier instance to set up bullets he fires.
                      Each new bullet wants to be its own instance/mc whatever. Thing is that I
                      cant get the info out of _root.soldier and into _root.bulletX (where X is an
                      arbitary value)

                      there is code in the bullet onClipEvent(load) like
                      this._rotation = soldier1._rotation;
                      Which by the looks of some traces Ive done just gives soldier._rotation as
                      undefined.

                      How can I pass a value out of soldier to use here?


                      • 8. Re: Passing values from mc to mc/instance to instance
                        Level 7

                        "disco-logic" <webforumsuser@macromedia.com> wrote in message
                        news:efkdr8$95f$1@forums.macromedia.com...
                        > does _parent refer to the mc that "gave birth" to the new instance?

                        if you are using duplicateMovieClip, then the _parent is the same for all
                        duplicated bullets... the holder of the original bullet. So, if the bullet
                        instance is inside of your soldier1 MC then the _parent of each duplicated
                        bullet will be the soldier1.

                        > so if duplicateMoveClip(..."bullet"...) is in soldier1 will the _parent of
                        > bullet be soldier1? or will it be the original bullet Im duplicating?
                        >
                        > Also my traces threw up odd results. I got the rotation to work but not
                        > the
                        > _x and _y positions. Odd.

                        What are the outputs of your 'odd results'... if _x and _y don't work, TRACE
                        'em.

                        trace(this._parent._x);
                        trace(this._parent._y);

                        > I think I might start using proper .as scripts and define everything as
                        > classes cos this is getting too confusing using mc instances with code
                        > inside
                        > them.
                        >

                        This is my preferred way to go.



                        • 9. Re: Passing values from mc to mc/instance to instance
                          Level 7

                          "disco-logic" <webforumsuser@macromedia.com> wrote in message
                          news:efk7gi$2f1$1@forums.macromedia.com...
                          > hmm afraid that the kind of code I was using. The problem is you cant
                          > take a
                          > variable out of one instance and use it in another.
                          >
                          > I know that soldier1._rotation is working cos it work for soldier clip.
                          >
                          > The problem comes when you want to pass soldier1._rotation onto the bullet
                          > cos
                          > a statement like
                          >
                          > bullet._rotation = soldier1._rotation;
                          >
                          > within the code for the bullet will simply decide that it cant find
                          > soldier1._rotation. What I think I need is a way to make the value public
                          >

                          okay, here is what you want to check (for this case and any case when you
                          have some issue like this --- unexpected behavior)

                          TRACE, TRACE, TRACE.

                          Each bullet is coming from an attachMovie or a duplicateMovieClip, right???

                          In either case, in your code you have:

                          onClipEvent(load) {
                          this._rotation = solder1._rotation;
                          }

                          which is a valid statment. This says, find the rotation value of soldier1
                          and assign it to this (the Bullet clip)

                          So, TRACE...
                          add
                          trace(soldier1._rotation);
                          to the onClipEvent(load) handler above. You see that soldier1._rotation is
                          undefined.

                          next add another TRACE...
                          add
                          trace(this);
                          to the handler.

                          You will see that 'this' is referring to your bullet. But, soldier1 is not
                          in the bullet instance, it is in the _parent instance (most likely - depends
                          on your setup) so, you should try

                          onClipEvent(load) {
                          this._rotation = _parent.soldier1._rotation;
                          }

                          if that doesn't work, add the following traces and post their output

                          trace(this);
                          trace(this._parent);






                          Ive made a new topic for this cos the last one went wildly off-topic...

                          Im trying to use info from the soldier instance to set up bullets he fires.
                          Each new bullet wants to be its own instance/mc whatever. Thing is that I
                          cant get the info out of _root.soldier and into _root.bulletX (where X is an
                          arbitary value)

                          there is code in the bullet onClipEvent(load) like
                          this._rotation = soldier1._rotation;
                          Which by the looks of some traces Ive done just gives soldier._rotation as
                          undefined.

                          How can I pass a value out of soldier to use here?


                          • 10. Re: Passing values from mc to mc/instance to instance
                            Level 7

                            "disco-logic" <webforumsuser@macromedia.com> wrote in message
                            news:efkdr8$95f$1@forums.macromedia.com...
                            > does _parent refer to the mc that "gave birth" to the new instance?

                            if you are using duplicateMovieClip, then the _parent is the same for all
                            duplicated bullets... the holder of the original bullet. So, if the bullet
                            instance is inside of your soldier1 MC then the _parent of each duplicated
                            bullet will be the soldier1.

                            > so if duplicateMoveClip(..."bullet"...) is in soldier1 will the _parent of
                            > bullet be soldier1? or will it be the original bullet Im duplicating?
                            >
                            > Also my traces threw up odd results. I got the rotation to work but not
                            > the
                            > _x and _y positions. Odd.

                            What are the outputs of your 'odd results'... if _x and _y don't work, TRACE
                            'em.

                            trace(this._parent._x);
                            trace(this._parent._y);

                            > I think I might start using proper .as scripts and define everything as
                            > classes cos this is getting too confusing using mc instances with code
                            > inside
                            > them.
                            >

                            This is my preferred way to go.



                            • 11. Re: Passing values from mc to mc/instance to instance
                              Level 7

                              "disco-logic" <webforumsuser@macromedia.com> wrote in message
                              news:efk7gi$2f1$1@forums.macromedia.com...
                              > hmm afraid that the kind of code I was using. The problem is you cant
                              > take a
                              > variable out of one instance and use it in another.
                              >
                              > I know that soldier1._rotation is working cos it work for soldier clip.
                              >
                              > The problem comes when you want to pass soldier1._rotation onto the bullet
                              > cos
                              > a statement like
                              >
                              > bullet._rotation = soldier1._rotation;
                              >
                              > within the code for the bullet will simply decide that it cant find
                              > soldier1._rotation. What I think I need is a way to make the value public
                              >

                              okay, here is what you want to check (for this case and any case when you
                              have some issue like this --- unexpected behavior)

                              TRACE, TRACE, TRACE.

                              Each bullet is coming from an attachMovie or a duplicateMovieClip, right???

                              In either case, in your code you have:

                              onClipEvent(load) {
                              this._rotation = solder1._rotation;
                              }

                              which is a valid statment. This says, find the rotation value of soldier1
                              and assign it to this (the Bullet clip)

                              So, TRACE...
                              add
                              trace(soldier1._rotation);
                              to the onClipEvent(load) handler above. You see that soldier1._rotation is
                              undefined.

                              next add another TRACE...
                              add
                              trace(this);
                              to the handler.

                              You will see that 'this' is referring to your bullet. But, soldier1 is not
                              in the bullet instance, it is in the _parent instance (most likely - depends
                              on your setup) so, you should try

                              onClipEvent(load) {
                              this._rotation = _parent.soldier1._rotation;
                              }

                              if that doesn't work, add the following traces and post their output

                              trace(this);
                              trace(this._parent);






                              Ive made a new topic for this cos the last one went wildly off-topic...

                              Im trying to use info from the soldier instance to set up bullets he fires.
                              Each new bullet wants to be its own instance/mc whatever. Thing is that I
                              cant get the info out of _root.soldier and into _root.bulletX (where X is an
                              arbitary value)

                              there is code in the bullet onClipEvent(load) like
                              this._rotation = soldier1._rotation;
                              Which by the looks of some traces Ive done just gives soldier._rotation as
                              undefined.

                              How can I pass a value out of soldier to use here?


                              • 12. Re: Passing values from mc to mc/instance to instance
                                Level 7

                                "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                news:efkdr8$95f$1@forums.macromedia.com...
                                > does _parent refer to the mc that "gave birth" to the new instance?

                                if you are using duplicateMovieClip, then the _parent is the same for all
                                duplicated bullets... the holder of the original bullet. So, if the bullet
                                instance is inside of your soldier1 MC then the _parent of each duplicated
                                bullet will be the soldier1.

                                > so if duplicateMoveClip(..."bullet"...) is in soldier1 will the _parent of
                                > bullet be soldier1? or will it be the original bullet Im duplicating?
                                >
                                > Also my traces threw up odd results. I got the rotation to work but not
                                > the
                                > _x and _y positions. Odd.

                                What are the outputs of your 'odd results'... if _x and _y don't work, TRACE
                                'em.

                                trace(this._parent._x);
                                trace(this._parent._y);

                                > I think I might start using proper .as scripts and define everything as
                                > classes cos this is getting too confusing using mc instances with code
                                > inside
                                > them.
                                >

                                This is my preferred way to go.



                                • 13. Re: Passing values from mc to mc/instance to instance
                                  Level 7

                                  "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                  news:efk7gi$2f1$1@forums.macromedia.com...
                                  > hmm afraid that the kind of code I was using. The problem is you cant
                                  > take a
                                  > variable out of one instance and use it in another.
                                  >
                                  > I know that soldier1._rotation is working cos it work for soldier clip.
                                  >
                                  > The problem comes when you want to pass soldier1._rotation onto the bullet
                                  > cos
                                  > a statement like
                                  >
                                  > bullet._rotation = soldier1._rotation;
                                  >
                                  > within the code for the bullet will simply decide that it cant find
                                  > soldier1._rotation. What I think I need is a way to make the value public
                                  >

                                  okay, here is what you want to check (for this case and any case when you
                                  have some issue like this --- unexpected behavior)

                                  TRACE, TRACE, TRACE.

                                  Each bullet is coming from an attachMovie or a duplicateMovieClip, right???

                                  In either case, in your code you have:

                                  onClipEvent(load) {
                                  this._rotation = solder1._rotation;
                                  }

                                  which is a valid statment. This says, find the rotation value of soldier1
                                  and assign it to this (the Bullet clip)

                                  So, TRACE...
                                  add
                                  trace(soldier1._rotation);
                                  to the onClipEvent(load) handler above. You see that soldier1._rotation is
                                  undefined.

                                  next add another TRACE...
                                  add
                                  trace(this);
                                  to the handler.

                                  You will see that 'this' is referring to your bullet. But, soldier1 is not
                                  in the bullet instance, it is in the _parent instance (most likely - depends
                                  on your setup) so, you should try

                                  onClipEvent(load) {
                                  this._rotation = _parent.soldier1._rotation;
                                  }

                                  if that doesn't work, add the following traces and post their output

                                  trace(this);
                                  trace(this._parent);






                                  Ive made a new topic for this cos the last one went wildly off-topic...

                                  Im trying to use info from the soldier instance to set up bullets he fires.
                                  Each new bullet wants to be its own instance/mc whatever. Thing is that I
                                  cant get the info out of _root.soldier and into _root.bulletX (where X is an
                                  arbitary value)

                                  there is code in the bullet onClipEvent(load) like
                                  this._rotation = soldier1._rotation;
                                  Which by the looks of some traces Ive done just gives soldier._rotation as
                                  undefined.

                                  How can I pass a value out of soldier to use here?


                                  • 14. Re: Passing values from mc to mc/instance to instance
                                    Level 7

                                    "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                    news:efkdr8$95f$1@forums.macromedia.com...
                                    > does _parent refer to the mc that "gave birth" to the new instance?

                                    if you are using duplicateMovieClip, then the _parent is the same for all
                                    duplicated bullets... the holder of the original bullet. So, if the bullet
                                    instance is inside of your soldier1 MC then the _parent of each duplicated
                                    bullet will be the soldier1.

                                    > so if duplicateMoveClip(..."bullet"...) is in soldier1 will the _parent of
                                    > bullet be soldier1? or will it be the original bullet Im duplicating?
                                    >
                                    > Also my traces threw up odd results. I got the rotation to work but not
                                    > the
                                    > _x and _y positions. Odd.

                                    What are the outputs of your 'odd results'... if _x and _y don't work, TRACE
                                    'em.

                                    trace(this._parent._x);
                                    trace(this._parent._y);

                                    > I think I might start using proper .as scripts and define everything as
                                    > classes cos this is getting too confusing using mc instances with code
                                    > inside
                                    > them.
                                    >

                                    This is my preferred way to go.



                                    • 15. Re: Passing values from mc to mc/instance to instance
                                      Level 7

                                      "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                      news:efk7gi$2f1$1@forums.macromedia.com...
                                      > hmm afraid that the kind of code I was using. The problem is you cant
                                      > take a
                                      > variable out of one instance and use it in another.
                                      >
                                      > I know that soldier1._rotation is working cos it work for soldier clip.
                                      >
                                      > The problem comes when you want to pass soldier1._rotation onto the bullet
                                      > cos
                                      > a statement like
                                      >
                                      > bullet._rotation = soldier1._rotation;
                                      >
                                      > within the code for the bullet will simply decide that it cant find
                                      > soldier1._rotation. What I think I need is a way to make the value public
                                      >

                                      okay, here is what you want to check (for this case and any case when you
                                      have some issue like this --- unexpected behavior)

                                      TRACE, TRACE, TRACE.

                                      Each bullet is coming from an attachMovie or a duplicateMovieClip, right???

                                      In either case, in your code you have:

                                      onClipEvent(load) {
                                      this._rotation = solder1._rotation;
                                      }

                                      which is a valid statment. This says, find the rotation value of soldier1
                                      and assign it to this (the Bullet clip)

                                      So, TRACE...
                                      add
                                      trace(soldier1._rotation);
                                      to the onClipEvent(load) handler above. You see that soldier1._rotation is
                                      undefined.

                                      next add another TRACE...
                                      add
                                      trace(this);
                                      to the handler.

                                      You will see that 'this' is referring to your bullet. But, soldier1 is not
                                      in the bullet instance, it is in the _parent instance (most likely - depends
                                      on your setup) so, you should try

                                      onClipEvent(load) {
                                      this._rotation = _parent.soldier1._rotation;
                                      }

                                      if that doesn't work, add the following traces and post their output

                                      trace(this);
                                      trace(this._parent);






                                      Ive made a new topic for this cos the last one went wildly off-topic...

                                      Im trying to use info from the soldier instance to set up bullets he fires.
                                      Each new bullet wants to be its own instance/mc whatever. Thing is that I
                                      cant get the info out of _root.soldier and into _root.bulletX (where X is an
                                      arbitary value)

                                      there is code in the bullet onClipEvent(load) like
                                      this._rotation = soldier1._rotation;
                                      Which by the looks of some traces Ive done just gives soldier._rotation as
                                      undefined.

                                      How can I pass a value out of soldier to use here?


                                      • 16. Re: Passing values from mc to mc/instance to instance
                                        Level 7

                                        "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                        news:efkdr8$95f$1@forums.macromedia.com...
                                        > does _parent refer to the mc that "gave birth" to the new instance?

                                        if you are using duplicateMovieClip, then the _parent is the same for all
                                        duplicated bullets... the holder of the original bullet. So, if the bullet
                                        instance is inside of your soldier1 MC then the _parent of each duplicated
                                        bullet will be the soldier1.

                                        > so if duplicateMoveClip(..."bullet"...) is in soldier1 will the _parent of
                                        > bullet be soldier1? or will it be the original bullet Im duplicating?
                                        >
                                        > Also my traces threw up odd results. I got the rotation to work but not
                                        > the
                                        > _x and _y positions. Odd.

                                        What are the outputs of your 'odd results'... if _x and _y don't work, TRACE
                                        'em.

                                        trace(this._parent._x);
                                        trace(this._parent._y);

                                        > I think I might start using proper .as scripts and define everything as
                                        > classes cos this is getting too confusing using mc instances with code
                                        > inside
                                        > them.
                                        >

                                        This is my preferred way to go.



                                        • 17. Re: Passing values from mc to mc/instance to instance
                                          Level 7

                                          "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                          news:efk7gi$2f1$1@forums.macromedia.com...
                                          > hmm afraid that the kind of code I was using. The problem is you cant
                                          > take a
                                          > variable out of one instance and use it in another.
                                          >
                                          > I know that soldier1._rotation is working cos it work for soldier clip.
                                          >
                                          > The problem comes when you want to pass soldier1._rotation onto the bullet
                                          > cos
                                          > a statement like
                                          >
                                          > bullet._rotation = soldier1._rotation;
                                          >
                                          > within the code for the bullet will simply decide that it cant find
                                          > soldier1._rotation. What I think I need is a way to make the value public
                                          >

                                          okay, here is what you want to check (for this case and any case when you
                                          have some issue like this --- unexpected behavior)

                                          TRACE, TRACE, TRACE.

                                          Each bullet is coming from an attachMovie or a duplicateMovieClip, right???

                                          In either case, in your code you have:

                                          onClipEvent(load) {
                                          this._rotation = solder1._rotation;
                                          }

                                          which is a valid statment. This says, find the rotation value of soldier1
                                          and assign it to this (the Bullet clip)

                                          So, TRACE...
                                          add
                                          trace(soldier1._rotation);
                                          to the onClipEvent(load) handler above. You see that soldier1._rotation is
                                          undefined.

                                          next add another TRACE...
                                          add
                                          trace(this);
                                          to the handler.

                                          You will see that 'this' is referring to your bullet. But, soldier1 is not
                                          in the bullet instance, it is in the _parent instance (most likely - depends
                                          on your setup) so, you should try

                                          onClipEvent(load) {
                                          this._rotation = _parent.soldier1._rotation;
                                          }

                                          if that doesn't work, add the following traces and post their output

                                          trace(this);
                                          trace(this._parent);






                                          Ive made a new topic for this cos the last one went wildly off-topic...

                                          Im trying to use info from the soldier instance to set up bullets he fires.
                                          Each new bullet wants to be its own instance/mc whatever. Thing is that I
                                          cant get the info out of _root.soldier and into _root.bulletX (where X is an
                                          arbitary value)

                                          there is code in the bullet onClipEvent(load) like
                                          this._rotation = soldier1._rotation;
                                          Which by the looks of some traces Ive done just gives soldier._rotation as
                                          undefined.

                                          How can I pass a value out of soldier to use here?


                                          • 18. Re: Passing values from mc to mc/instance to instance
                                            Level 7

                                            "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                            news:efkdr8$95f$1@forums.macromedia.com...
                                            > does _parent refer to the mc that "gave birth" to the new instance?

                                            if you are using duplicateMovieClip, then the _parent is the same for all
                                            duplicated bullets... the holder of the original bullet. So, if the bullet
                                            instance is inside of your soldier1 MC then the _parent of each duplicated
                                            bullet will be the soldier1.

                                            > so if duplicateMoveClip(..."bullet"...) is in soldier1 will the _parent of
                                            > bullet be soldier1? or will it be the original bullet Im duplicating?
                                            >
                                            > Also my traces threw up odd results. I got the rotation to work but not
                                            > the
                                            > _x and _y positions. Odd.

                                            What are the outputs of your 'odd results'... if _x and _y don't work, TRACE
                                            'em.

                                            trace(this._parent._x);
                                            trace(this._parent._y);

                                            > I think I might start using proper .as scripts and define everything as
                                            > classes cos this is getting too confusing using mc instances with code
                                            > inside
                                            > them.
                                            >

                                            This is my preferred way to go.



                                            • 19. Re: Passing values from mc to mc/instance to instance
                                              Level 7

                                              "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                              news:efk7gi$2f1$1@forums.macromedia.com...
                                              > hmm afraid that the kind of code I was using. The problem is you cant
                                              > take a
                                              > variable out of one instance and use it in another.
                                              >
                                              > I know that soldier1._rotation is working cos it work for soldier clip.
                                              >
                                              > The problem comes when you want to pass soldier1._rotation onto the bullet
                                              > cos
                                              > a statement like
                                              >
                                              > bullet._rotation = soldier1._rotation;
                                              >
                                              > within the code for the bullet will simply decide that it cant find
                                              > soldier1._rotation. What I think I need is a way to make the value public
                                              >

                                              okay, here is what you want to check (for this case and any case when you
                                              have some issue like this --- unexpected behavior)

                                              TRACE, TRACE, TRACE.

                                              Each bullet is coming from an attachMovie or a duplicateMovieClip, right???

                                              In either case, in your code you have:

                                              onClipEvent(load) {
                                              this._rotation = solder1._rotation;
                                              }

                                              which is a valid statment. This says, find the rotation value of soldier1
                                              and assign it to this (the Bullet clip)

                                              So, TRACE...
                                              add
                                              trace(soldier1._rotation);
                                              to the onClipEvent(load) handler above. You see that soldier1._rotation is
                                              undefined.

                                              next add another TRACE...
                                              add
                                              trace(this);
                                              to the handler.

                                              You will see that 'this' is referring to your bullet. But, soldier1 is not
                                              in the bullet instance, it is in the _parent instance (most likely - depends
                                              on your setup) so, you should try

                                              onClipEvent(load) {
                                              this._rotation = _parent.soldier1._rotation;
                                              }

                                              if that doesn't work, add the following traces and post their output

                                              trace(this);
                                              trace(this._parent);






                                              Ive made a new topic for this cos the last one went wildly off-topic...

                                              Im trying to use info from the soldier instance to set up bullets he fires.
                                              Each new bullet wants to be its own instance/mc whatever. Thing is that I
                                              cant get the info out of _root.soldier and into _root.bulletX (where X is an
                                              arbitary value)

                                              there is code in the bullet onClipEvent(load) like
                                              this._rotation = soldier1._rotation;
                                              Which by the looks of some traces Ive done just gives soldier._rotation as
                                              undefined.

                                              How can I pass a value out of soldier to use here?


                                              • 20. Re: Passing values from mc to mc/instance to instance
                                                Level 7

                                                "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                                news:efkdr8$95f$1@forums.macromedia.com...
                                                > does _parent refer to the mc that "gave birth" to the new instance?

                                                if you are using duplicateMovieClip, then the _parent is the same for all
                                                duplicated bullets... the holder of the original bullet. So, if the bullet
                                                instance is inside of your soldier1 MC then the _parent of each duplicated
                                                bullet will be the soldier1.

                                                > so if duplicateMoveClip(..."bullet"...) is in soldier1 will the _parent of
                                                > bullet be soldier1? or will it be the original bullet Im duplicating?
                                                >
                                                > Also my traces threw up odd results. I got the rotation to work but not
                                                > the
                                                > _x and _y positions. Odd.

                                                What are the outputs of your 'odd results'... if _x and _y don't work, TRACE
                                                'em.

                                                trace(this._parent._x);
                                                trace(this._parent._y);

                                                > I think I might start using proper .as scripts and define everything as
                                                > classes cos this is getting too confusing using mc instances with code
                                                > inside
                                                > them.
                                                >

                                                This is my preferred way to go.



                                                • 21. Re: Passing values from mc to mc/instance to instance
                                                  Level 7

                                                  "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                                  news:efk7gi$2f1$1@forums.macromedia.com...
                                                  > hmm afraid that the kind of code I was using. The problem is you cant
                                                  > take a
                                                  > variable out of one instance and use it in another.
                                                  >
                                                  > I know that soldier1._rotation is working cos it work for soldier clip.
                                                  >
                                                  > The problem comes when you want to pass soldier1._rotation onto the bullet
                                                  > cos
                                                  > a statement like
                                                  >
                                                  > bullet._rotation = soldier1._rotation;
                                                  >
                                                  > within the code for the bullet will simply decide that it cant find
                                                  > soldier1._rotation. What I think I need is a way to make the value public
                                                  >

                                                  okay, here is what you want to check (for this case and any case when you
                                                  have some issue like this --- unexpected behavior)

                                                  TRACE, TRACE, TRACE.

                                                  Each bullet is coming from an attachMovie or a duplicateMovieClip, right???

                                                  In either case, in your code you have:

                                                  onClipEvent(load) {
                                                  this._rotation = solder1._rotation;
                                                  }

                                                  which is a valid statment. This says, find the rotation value of soldier1
                                                  and assign it to this (the Bullet clip)

                                                  So, TRACE...
                                                  add
                                                  trace(soldier1._rotation);
                                                  to the onClipEvent(load) handler above. You see that soldier1._rotation is
                                                  undefined.

                                                  next add another TRACE...
                                                  add
                                                  trace(this);
                                                  to the handler.

                                                  You will see that 'this' is referring to your bullet. But, soldier1 is not
                                                  in the bullet instance, it is in the _parent instance (most likely - depends
                                                  on your setup) so, you should try

                                                  onClipEvent(load) {
                                                  this._rotation = _parent.soldier1._rotation;
                                                  }

                                                  if that doesn't work, add the following traces and post their output

                                                  trace(this);
                                                  trace(this._parent);






                                                  Ive made a new topic for this cos the last one went wildly off-topic...

                                                  Im trying to use info from the soldier instance to set up bullets he fires.
                                                  Each new bullet wants to be its own instance/mc whatever. Thing is that I
                                                  cant get the info out of _root.soldier and into _root.bulletX (where X is an
                                                  arbitary value)

                                                  there is code in the bullet onClipEvent(load) like
                                                  this._rotation = soldier1._rotation;
                                                  Which by the looks of some traces Ive done just gives soldier._rotation as
                                                  undefined.

                                                  How can I pass a value out of soldier to use here?


                                                  • 22. Re: Passing values from mc to mc/instance to instance
                                                    Level 7

                                                    "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                                    news:efkdr8$95f$1@forums.macromedia.com...
                                                    > does _parent refer to the mc that "gave birth" to the new instance?

                                                    if you are using duplicateMovieClip, then the _parent is the same for all
                                                    duplicated bullets... the holder of the original bullet. So, if the bullet
                                                    instance is inside of your soldier1 MC then the _parent of each duplicated
                                                    bullet will be the soldier1.

                                                    > so if duplicateMoveClip(..."bullet"...) is in soldier1 will the _parent of
                                                    > bullet be soldier1? or will it be the original bullet Im duplicating?
                                                    >
                                                    > Also my traces threw up odd results. I got the rotation to work but not
                                                    > the
                                                    > _x and _y positions. Odd.

                                                    What are the outputs of your 'odd results'... if _x and _y don't work, TRACE
                                                    'em.

                                                    trace(this._parent._x);
                                                    trace(this._parent._y);

                                                    > I think I might start using proper .as scripts and define everything as
                                                    > classes cos this is getting too confusing using mc instances with code
                                                    > inside
                                                    > them.
                                                    >

                                                    This is my preferred way to go.



                                                    • 23. Re: Passing values from mc to mc/instance to instance
                                                      Level 7

                                                      "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                                      news:efk7gi$2f1$1@forums.macromedia.com...
                                                      > hmm afraid that the kind of code I was using. The problem is you cant
                                                      > take a
                                                      > variable out of one instance and use it in another.
                                                      >
                                                      > I know that soldier1._rotation is working cos it work for soldier clip.
                                                      >
                                                      > The problem comes when you want to pass soldier1._rotation onto the bullet
                                                      > cos
                                                      > a statement like
                                                      >
                                                      > bullet._rotation = soldier1._rotation;
                                                      >
                                                      > within the code for the bullet will simply decide that it cant find
                                                      > soldier1._rotation. What I think I need is a way to make the value public
                                                      >

                                                      okay, here is what you want to check (for this case and any case when you
                                                      have some issue like this --- unexpected behavior)

                                                      TRACE, TRACE, TRACE.

                                                      Each bullet is coming from an attachMovie or a duplicateMovieClip, right???

                                                      In either case, in your code you have:

                                                      onClipEvent(load) {
                                                      this._rotation = solder1._rotation;
                                                      }

                                                      which is a valid statment. This says, find the rotation value of soldier1
                                                      and assign it to this (the Bullet clip)

                                                      So, TRACE...
                                                      add
                                                      trace(soldier1._rotation);
                                                      to the onClipEvent(load) handler above. You see that soldier1._rotation is
                                                      undefined.

                                                      next add another TRACE...
                                                      add
                                                      trace(this);
                                                      to the handler.

                                                      You will see that 'this' is referring to your bullet. But, soldier1 is not
                                                      in the bullet instance, it is in the _parent instance (most likely - depends
                                                      on your setup) so, you should try

                                                      onClipEvent(load) {
                                                      this._rotation = _parent.soldier1._rotation;
                                                      }

                                                      if that doesn't work, add the following traces and post their output

                                                      trace(this);
                                                      trace(this._parent);






                                                      Ive made a new topic for this cos the last one went wildly off-topic...

                                                      Im trying to use info from the soldier instance to set up bullets he fires.
                                                      Each new bullet wants to be its own instance/mc whatever. Thing is that I
                                                      cant get the info out of _root.soldier and into _root.bulletX (where X is an
                                                      arbitary value)

                                                      there is code in the bullet onClipEvent(load) like
                                                      this._rotation = soldier1._rotation;
                                                      Which by the looks of some traces Ive done just gives soldier._rotation as
                                                      undefined.

                                                      How can I pass a value out of soldier to use here?


                                                      • 24. Re: Passing values from mc to mc/instance to instance
                                                        Level 7

                                                        "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                                        news:efkdr8$95f$1@forums.macromedia.com...
                                                        > does _parent refer to the mc that "gave birth" to the new instance?

                                                        if you are using duplicateMovieClip, then the _parent is the same for all
                                                        duplicated bullets... the holder of the original bullet. So, if the bullet
                                                        instance is inside of your soldier1 MC then the _parent of each duplicated
                                                        bullet will be the soldier1.

                                                        > so if duplicateMoveClip(..."bullet"...) is in soldier1 will the _parent of
                                                        > bullet be soldier1? or will it be the original bullet Im duplicating?
                                                        >
                                                        > Also my traces threw up odd results. I got the rotation to work but not
                                                        > the
                                                        > _x and _y positions. Odd.

                                                        What are the outputs of your 'odd results'... if _x and _y don't work, TRACE
                                                        'em.

                                                        trace(this._parent._x);
                                                        trace(this._parent._y);

                                                        > I think I might start using proper .as scripts and define everything as
                                                        > classes cos this is getting too confusing using mc instances with code
                                                        > inside
                                                        > them.
                                                        >

                                                        This is my preferred way to go.



                                                        • 25. Re: Passing values from mc to mc/instance to instance
                                                          Level 7

                                                          "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                                          news:efk7gi$2f1$1@forums.macromedia.com...
                                                          > hmm afraid that the kind of code I was using. The problem is you cant
                                                          > take a
                                                          > variable out of one instance and use it in another.
                                                          >
                                                          > I know that soldier1._rotation is working cos it work for soldier clip.
                                                          >
                                                          > The problem comes when you want to pass soldier1._rotation onto the bullet
                                                          > cos
                                                          > a statement like
                                                          >
                                                          > bullet._rotation = soldier1._rotation;
                                                          >
                                                          > within the code for the bullet will simply decide that it cant find
                                                          > soldier1._rotation. What I think I need is a way to make the value public
                                                          >

                                                          okay, here is what you want to check (for this case and any case when you
                                                          have some issue like this --- unexpected behavior)

                                                          TRACE, TRACE, TRACE.

                                                          Each bullet is coming from an attachMovie or a duplicateMovieClip, right???

                                                          In either case, in your code you have:

                                                          onClipEvent(load) {
                                                          this._rotation = solder1._rotation;
                                                          }

                                                          which is a valid statment. This says, find the rotation value of soldier1
                                                          and assign it to this (the Bullet clip)

                                                          So, TRACE...
                                                          add
                                                          trace(soldier1._rotation);
                                                          to the onClipEvent(load) handler above. You see that soldier1._rotation is
                                                          undefined.

                                                          next add another TRACE...
                                                          add
                                                          trace(this);
                                                          to the handler.

                                                          You will see that 'this' is referring to your bullet. But, soldier1 is not
                                                          in the bullet instance, it is in the _parent instance (most likely - depends
                                                          on your setup) so, you should try

                                                          onClipEvent(load) {
                                                          this._rotation = _parent.soldier1._rotation;
                                                          }

                                                          if that doesn't work, add the following traces and post their output

                                                          trace(this);
                                                          trace(this._parent);






                                                          Ive made a new topic for this cos the last one went wildly off-topic...

                                                          Im trying to use info from the soldier instance to set up bullets he fires.
                                                          Each new bullet wants to be its own instance/mc whatever. Thing is that I
                                                          cant get the info out of _root.soldier and into _root.bulletX (where X is an
                                                          arbitary value)

                                                          there is code in the bullet onClipEvent(load) like
                                                          this._rotation = soldier1._rotation;
                                                          Which by the looks of some traces Ive done just gives soldier._rotation as
                                                          undefined.

                                                          How can I pass a value out of soldier to use here?


                                                          • 26. Re: Passing values from mc to mc/instance to instance
                                                            Level 7

                                                            "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                                            news:efkdr8$95f$1@forums.macromedia.com...
                                                            > does _parent refer to the mc that "gave birth" to the new instance?

                                                            if you are using duplicateMovieClip, then the _parent is the same for all
                                                            duplicated bullets... the holder of the original bullet. So, if the bullet
                                                            instance is inside of your soldier1 MC then the _parent of each duplicated
                                                            bullet will be the soldier1.

                                                            > so if duplicateMoveClip(..."bullet"...) is in soldier1 will the _parent of
                                                            > bullet be soldier1? or will it be the original bullet Im duplicating?
                                                            >
                                                            > Also my traces threw up odd results. I got the rotation to work but not
                                                            > the
                                                            > _x and _y positions. Odd.

                                                            What are the outputs of your 'odd results'... if _x and _y don't work, TRACE
                                                            'em.

                                                            trace(this._parent._x);
                                                            trace(this._parent._y);

                                                            > I think I might start using proper .as scripts and define everything as
                                                            > classes cos this is getting too confusing using mc instances with code
                                                            > inside
                                                            > them.
                                                            >

                                                            This is my preferred way to go.



                                                            • 27. Re: Passing values from mc to mc/instance to instance
                                                              Level 7

                                                              "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                                              news:efk7gi$2f1$1@forums.macromedia.com...
                                                              > hmm afraid that the kind of code I was using. The problem is you cant
                                                              > take a
                                                              > variable out of one instance and use it in another.
                                                              >
                                                              > I know that soldier1._rotation is working cos it work for soldier clip.
                                                              >
                                                              > The problem comes when you want to pass soldier1._rotation onto the bullet
                                                              > cos
                                                              > a statement like
                                                              >
                                                              > bullet._rotation = soldier1._rotation;
                                                              >
                                                              > within the code for the bullet will simply decide that it cant find
                                                              > soldier1._rotation. What I think I need is a way to make the value public
                                                              >

                                                              okay, here is what you want to check (for this case and any case when you
                                                              have some issue like this --- unexpected behavior)

                                                              TRACE, TRACE, TRACE.

                                                              Each bullet is coming from an attachMovie or a duplicateMovieClip, right???

                                                              In either case, in your code you have:

                                                              onClipEvent(load) {
                                                              this._rotation = solder1._rotation;
                                                              }

                                                              which is a valid statment. This says, find the rotation value of soldier1
                                                              and assign it to this (the Bullet clip)

                                                              So, TRACE...
                                                              add
                                                              trace(soldier1._rotation);
                                                              to the onClipEvent(load) handler above. You see that soldier1._rotation is
                                                              undefined.

                                                              next add another TRACE...
                                                              add
                                                              trace(this);
                                                              to the handler.

                                                              You will see that 'this' is referring to your bullet. But, soldier1 is not
                                                              in the bullet instance, it is in the _parent instance (most likely - depends
                                                              on your setup) so, you should try

                                                              onClipEvent(load) {
                                                              this._rotation = _parent.soldier1._rotation;
                                                              }

                                                              if that doesn't work, add the following traces and post their output

                                                              trace(this);
                                                              trace(this._parent);






                                                              Ive made a new topic for this cos the last one went wildly off-topic...

                                                              Im trying to use info from the soldier instance to set up bullets he fires.
                                                              Each new bullet wants to be its own instance/mc whatever. Thing is that I
                                                              cant get the info out of _root.soldier and into _root.bulletX (where X is an
                                                              arbitary value)

                                                              there is code in the bullet onClipEvent(load) like
                                                              this._rotation = soldier1._rotation;
                                                              Which by the looks of some traces Ive done just gives soldier._rotation as
                                                              undefined.

                                                              How can I pass a value out of soldier to use here?


                                                              • 28. Re: Passing values from mc to mc/instance to instance
                                                                Level 7

                                                                "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                                                news:efkdr8$95f$1@forums.macromedia.com...
                                                                > does _parent refer to the mc that "gave birth" to the new instance?

                                                                if you are using duplicateMovieClip, then the _parent is the same for all
                                                                duplicated bullets... the holder of the original bullet. So, if the bullet
                                                                instance is inside of your soldier1 MC then the _parent of each duplicated
                                                                bullet will be the soldier1.

                                                                > so if duplicateMoveClip(..."bullet"...) is in soldier1 will the _parent of
                                                                > bullet be soldier1? or will it be the original bullet Im duplicating?
                                                                >
                                                                > Also my traces threw up odd results. I got the rotation to work but not
                                                                > the
                                                                > _x and _y positions. Odd.

                                                                What are the outputs of your 'odd results'... if _x and _y don't work, TRACE
                                                                'em.

                                                                trace(this._parent._x);
                                                                trace(this._parent._y);

                                                                > I think I might start using proper .as scripts and define everything as
                                                                > classes cos this is getting too confusing using mc instances with code
                                                                > inside
                                                                > them.
                                                                >

                                                                This is my preferred way to go.



                                                                • 29. Re: Passing values from mc to mc/instance to instance
                                                                  Level 7

                                                                  "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                                                  news:efk7gi$2f1$1@forums.macromedia.com...
                                                                  > hmm afraid that the kind of code I was using. The problem is you cant
                                                                  > take a
                                                                  > variable out of one instance and use it in another.
                                                                  >
                                                                  > I know that soldier1._rotation is working cos it work for soldier clip.
                                                                  >
                                                                  > The problem comes when you want to pass soldier1._rotation onto the bullet
                                                                  > cos
                                                                  > a statement like
                                                                  >
                                                                  > bullet._rotation = soldier1._rotation;
                                                                  >
                                                                  > within the code for the bullet will simply decide that it cant find
                                                                  > soldier1._rotation. What I think I need is a way to make the value public
                                                                  >

                                                                  okay, here is what you want to check (for this case and any case when you
                                                                  have some issue like this --- unexpected behavior)

                                                                  TRACE, TRACE, TRACE.

                                                                  Each bullet is coming from an attachMovie or a duplicateMovieClip, right???

                                                                  In either case, in your code you have:

                                                                  onClipEvent(load) {
                                                                  this._rotation = solder1._rotation;
                                                                  }

                                                                  which is a valid statment. This says, find the rotation value of soldier1
                                                                  and assign it to this (the Bullet clip)

                                                                  So, TRACE...
                                                                  add
                                                                  trace(soldier1._rotation);
                                                                  to the onClipEvent(load) handler above. You see that soldier1._rotation is
                                                                  undefined.

                                                                  next add another TRACE...
                                                                  add
                                                                  trace(this);
                                                                  to the handler.

                                                                  You will see that 'this' is referring to your bullet. But, soldier1 is not
                                                                  in the bullet instance, it is in the _parent instance (most likely - depends
                                                                  on your setup) so, you should try

                                                                  onClipEvent(load) {
                                                                  this._rotation = _parent.soldier1._rotation;
                                                                  }

                                                                  if that doesn't work, add the following traces and post their output

                                                                  trace(this);
                                                                  trace(this._parent);






                                                                  Ive made a new topic for this cos the last one went wildly off-topic...

                                                                  Im trying to use info from the soldier instance to set up bullets he fires.
                                                                  Each new bullet wants to be its own instance/mc whatever. Thing is that I
                                                                  cant get the info out of _root.soldier and into _root.bulletX (where X is an
                                                                  arbitary value)

                                                                  there is code in the bullet onClipEvent(load) like
                                                                  this._rotation = soldier1._rotation;
                                                                  Which by the looks of some traces Ive done just gives soldier._rotation as
                                                                  undefined.

                                                                  How can I pass a value out of soldier to use here?


                                                                  • 30. Re: Passing values from mc to mc/instance to instance
                                                                    Level 7

                                                                    "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                                                    news:efkdr8$95f$1@forums.macromedia.com...
                                                                    > does _parent refer to the mc that "gave birth" to the new instance?

                                                                    if you are using duplicateMovieClip, then the _parent is the same for all
                                                                    duplicated bullets... the holder of the original bullet. So, if the bullet
                                                                    instance is inside of your soldier1 MC then the _parent of each duplicated
                                                                    bullet will be the soldier1.

                                                                    > so if duplicateMoveClip(..."bullet"...) is in soldier1 will the _parent of
                                                                    > bullet be soldier1? or will it be the original bullet Im duplicating?
                                                                    >
                                                                    > Also my traces threw up odd results. I got the rotation to work but not
                                                                    > the
                                                                    > _x and _y positions. Odd.

                                                                    What are the outputs of your 'odd results'... if _x and _y don't work, TRACE
                                                                    'em.

                                                                    trace(this._parent._x);
                                                                    trace(this._parent._y);

                                                                    > I think I might start using proper .as scripts and define everything as
                                                                    > classes cos this is getting too confusing using mc instances with code
                                                                    > inside
                                                                    > them.
                                                                    >

                                                                    This is my preferred way to go.



                                                                    • 31. Re: Passing values from mc to mc/instance to instance
                                                                      Level 7

                                                                      "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                                                      news:efk7gi$2f1$1@forums.macromedia.com...
                                                                      > hmm afraid that the kind of code I was using. The problem is you cant
                                                                      > take a
                                                                      > variable out of one instance and use it in another.
                                                                      >
                                                                      > I know that soldier1._rotation is working cos it work for soldier clip.
                                                                      >
                                                                      > The problem comes when you want to pass soldier1._rotation onto the bullet
                                                                      > cos
                                                                      > a statement like
                                                                      >
                                                                      > bullet._rotation = soldier1._rotation;
                                                                      >
                                                                      > within the code for the bullet will simply decide that it cant find
                                                                      > soldier1._rotation. What I think I need is a way to make the value public
                                                                      >

                                                                      okay, here is what you want to check (for this case and any case when you
                                                                      have some issue like this --- unexpected behavior)

                                                                      TRACE, TRACE, TRACE.

                                                                      Each bullet is coming from an attachMovie or a duplicateMovieClip, right???

                                                                      In either case, in your code you have:

                                                                      onClipEvent(load) {
                                                                      this._rotation = solder1._rotation;
                                                                      }

                                                                      which is a valid statment. This says, find the rotation value of soldier1
                                                                      and assign it to this (the Bullet clip)

                                                                      So, TRACE...
                                                                      add
                                                                      trace(soldier1._rotation);
                                                                      to the onClipEvent(load) handler above. You see that soldier1._rotation is
                                                                      undefined.

                                                                      next add another TRACE...
                                                                      add
                                                                      trace(this);
                                                                      to the handler.

                                                                      You will see that 'this' is referring to your bullet. But, soldier1 is not
                                                                      in the bullet instance, it is in the _parent instance (most likely - depends
                                                                      on your setup) so, you should try

                                                                      onClipEvent(load) {
                                                                      this._rotation = _parent.soldier1._rotation;
                                                                      }

                                                                      if that doesn't work, add the following traces and post their output

                                                                      trace(this);
                                                                      trace(this._parent);






                                                                      Ive made a new topic for this cos the last one went wildly off-topic...

                                                                      Im trying to use info from the soldier instance to set up bullets he fires.
                                                                      Each new bullet wants to be its own instance/mc whatever. Thing is that I
                                                                      cant get the info out of _root.soldier and into _root.bulletX (where X is an
                                                                      arbitary value)

                                                                      there is code in the bullet onClipEvent(load) like
                                                                      this._rotation = soldier1._rotation;
                                                                      Which by the looks of some traces Ive done just gives soldier._rotation as
                                                                      undefined.

                                                                      How can I pass a value out of soldier to use here?


                                                                      • 32. Re: Passing values from mc to mc/instance to instance
                                                                        Level 7

                                                                        "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                                                        news:efkdr8$95f$1@forums.macromedia.com...
                                                                        > does _parent refer to the mc that "gave birth" to the new instance?

                                                                        if you are using duplicateMovieClip, then the _parent is the same for all
                                                                        duplicated bullets... the holder of the original bullet. So, if the bullet
                                                                        instance is inside of your soldier1 MC then the _parent of each duplicated
                                                                        bullet will be the soldier1.

                                                                        > so if duplicateMoveClip(..."bullet"...) is in soldier1 will the _parent of
                                                                        > bullet be soldier1? or will it be the original bullet Im duplicating?
                                                                        >
                                                                        > Also my traces threw up odd results. I got the rotation to work but not
                                                                        > the
                                                                        > _x and _y positions. Odd.

                                                                        What are the outputs of your 'odd results'... if _x and _y don't work, TRACE
                                                                        'em.

                                                                        trace(this._parent._x);
                                                                        trace(this._parent._y);

                                                                        > I think I might start using proper .as scripts and define everything as
                                                                        > classes cos this is getting too confusing using mc instances with code
                                                                        > inside
                                                                        > them.
                                                                        >

                                                                        This is my preferred way to go.



                                                                        • 33. Re: Passing values from mc to mc/instance to instance
                                                                          Level 7

                                                                          "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                                                          news:efk7gi$2f1$1@forums.macromedia.com...
                                                                          > hmm afraid that the kind of code I was using. The problem is you cant
                                                                          > take a
                                                                          > variable out of one instance and use it in another.
                                                                          >
                                                                          > I know that soldier1._rotation is working cos it work for soldier clip.
                                                                          >
                                                                          > The problem comes when you want to pass soldier1._rotation onto the bullet
                                                                          > cos
                                                                          > a statement like
                                                                          >
                                                                          > bullet._rotation = soldier1._rotation;
                                                                          >
                                                                          > within the code for the bullet will simply decide that it cant find
                                                                          > soldier1._rotation. What I think I need is a way to make the value public
                                                                          >

                                                                          okay, here is what you want to check (for this case and any case when you
                                                                          have some issue like this --- unexpected behavior)

                                                                          TRACE, TRACE, TRACE.

                                                                          Each bullet is coming from an attachMovie or a duplicateMovieClip, right???

                                                                          In either case, in your code you have:

                                                                          onClipEvent(load) {
                                                                          this._rotation = solder1._rotation;
                                                                          }

                                                                          which is a valid statment. This says, find the rotation value of soldier1
                                                                          and assign it to this (the Bullet clip)

                                                                          So, TRACE...
                                                                          add
                                                                          trace(soldier1._rotation);
                                                                          to the onClipEvent(load) handler above. You see that soldier1._rotation is
                                                                          undefined.

                                                                          next add another TRACE...
                                                                          add
                                                                          trace(this);
                                                                          to the handler.

                                                                          You will see that 'this' is referring to your bullet. But, soldier1 is not
                                                                          in the bullet instance, it is in the _parent instance (most likely - depends
                                                                          on your setup) so, you should try

                                                                          onClipEvent(load) {
                                                                          this._rotation = _parent.soldier1._rotation;
                                                                          }

                                                                          if that doesn't work, add the following traces and post their output

                                                                          trace(this);
                                                                          trace(this._parent);






                                                                          Ive made a new topic for this cos the last one went wildly off-topic...

                                                                          Im trying to use info from the soldier instance to set up bullets he fires.
                                                                          Each new bullet wants to be its own instance/mc whatever. Thing is that I
                                                                          cant get the info out of _root.soldier and into _root.bulletX (where X is an
                                                                          arbitary value)

                                                                          there is code in the bullet onClipEvent(load) like
                                                                          this._rotation = soldier1._rotation;
                                                                          Which by the looks of some traces Ive done just gives soldier._rotation as
                                                                          undefined.

                                                                          How can I pass a value out of soldier to use here?


                                                                          • 34. Re: Passing values from mc to mc/instance to instance
                                                                            Level 7

                                                                            "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                                                            news:efkdr8$95f$1@forums.macromedia.com...
                                                                            > does _parent refer to the mc that "gave birth" to the new instance?

                                                                            if you are using duplicateMovieClip, then the _parent is the same for all
                                                                            duplicated bullets... the holder of the original bullet. So, if the bullet
                                                                            instance is inside of your soldier1 MC then the _parent of each duplicated
                                                                            bullet will be the soldier1.

                                                                            > so if duplicateMoveClip(..."bullet"...) is in soldier1 will the _parent of
                                                                            > bullet be soldier1? or will it be the original bullet Im duplicating?
                                                                            >
                                                                            > Also my traces threw up odd results. I got the rotation to work but not
                                                                            > the
                                                                            > _x and _y positions. Odd.

                                                                            What are the outputs of your 'odd results'... if _x and _y don't work, TRACE
                                                                            'em.

                                                                            trace(this._parent._x);
                                                                            trace(this._parent._y);

                                                                            > I think I might start using proper .as scripts and define everything as
                                                                            > classes cos this is getting too confusing using mc instances with code
                                                                            > inside
                                                                            > them.
                                                                            >

                                                                            This is my preferred way to go.



                                                                            • 35. Re: Passing values from mc to mc/instance to instance
                                                                              Level 7

                                                                              "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                                                              news:efk7gi$2f1$1@forums.macromedia.com...
                                                                              > hmm afraid that the kind of code I was using. The problem is you cant
                                                                              > take a
                                                                              > variable out of one instance and use it in another.
                                                                              >
                                                                              > I know that soldier1._rotation is working cos it work for soldier clip.
                                                                              >
                                                                              > The problem comes when you want to pass soldier1._rotation onto the bullet
                                                                              > cos
                                                                              > a statement like
                                                                              >
                                                                              > bullet._rotation = soldier1._rotation;
                                                                              >
                                                                              > within the code for the bullet will simply decide that it cant find
                                                                              > soldier1._rotation. What I think I need is a way to make the value public
                                                                              >

                                                                              okay, here is what you want to check (for this case and any case when you
                                                                              have some issue like this --- unexpected behavior)

                                                                              TRACE, TRACE, TRACE.

                                                                              Each bullet is coming from an attachMovie or a duplicateMovieClip, right???

                                                                              In either case, in your code you have:

                                                                              onClipEvent(load) {
                                                                              this._rotation = solder1._rotation;
                                                                              }

                                                                              which is a valid statment. This says, find the rotation value of soldier1
                                                                              and assign it to this (the Bullet clip)

                                                                              So, TRACE...
                                                                              add
                                                                              trace(soldier1._rotation);
                                                                              to the onClipEvent(load) handler above. You see that soldier1._rotation is
                                                                              undefined.

                                                                              next add another TRACE...
                                                                              add
                                                                              trace(this);
                                                                              to the handler.

                                                                              You will see that 'this' is referring to your bullet. But, soldier1 is not
                                                                              in the bullet instance, it is in the _parent instance (most likely - depends
                                                                              on your setup) so, you should try

                                                                              onClipEvent(load) {
                                                                              this._rotation = _parent.soldier1._rotation;
                                                                              }

                                                                              if that doesn't work, add the following traces and post their output

                                                                              trace(this);
                                                                              trace(this._parent);






                                                                              Ive made a new topic for this cos the last one went wildly off-topic...

                                                                              Im trying to use info from the soldier instance to set up bullets he fires.
                                                                              Each new bullet wants to be its own instance/mc whatever. Thing is that I
                                                                              cant get the info out of _root.soldier and into _root.bulletX (where X is an
                                                                              arbitary value)

                                                                              there is code in the bullet onClipEvent(load) like
                                                                              this._rotation = soldier1._rotation;
                                                                              Which by the looks of some traces Ive done just gives soldier._rotation as
                                                                              undefined.

                                                                              How can I pass a value out of soldier to use here?


                                                                              • 36. Re: Passing values from mc to mc/instance to instance
                                                                                Level 7

                                                                                "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                                                                news:efkdr8$95f$1@forums.macromedia.com...
                                                                                > does _parent refer to the mc that "gave birth" to the new instance?

                                                                                if you are using duplicateMovieClip, then the _parent is the same for all
                                                                                duplicated bullets... the holder of the original bullet. So, if the bullet
                                                                                instance is inside of your soldier1 MC then the _parent of each duplicated
                                                                                bullet will be the soldier1.

                                                                                > so if duplicateMoveClip(..."bullet"...) is in soldier1 will the _parent of
                                                                                > bullet be soldier1? or will it be the original bullet Im duplicating?
                                                                                >
                                                                                > Also my traces threw up odd results. I got the rotation to work but not
                                                                                > the
                                                                                > _x and _y positions. Odd.

                                                                                What are the outputs of your 'odd results'... if _x and _y don't work, TRACE
                                                                                'em.

                                                                                trace(this._parent._x);
                                                                                trace(this._parent._y);

                                                                                > I think I might start using proper .as scripts and define everything as
                                                                                > classes cos this is getting too confusing using mc instances with code
                                                                                > inside
                                                                                > them.
                                                                                >

                                                                                This is my preferred way to go.



                                                                                • 37. Re: Passing values from mc to mc/instance to instance
                                                                                  Level 7

                                                                                  "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                                                                  news:efk7gi$2f1$1@forums.macromedia.com...
                                                                                  > hmm afraid that the kind of code I was using. The problem is you cant
                                                                                  > take a
                                                                                  > variable out of one instance and use it in another.
                                                                                  >
                                                                                  > I know that soldier1._rotation is working cos it work for soldier clip.
                                                                                  >
                                                                                  > The problem comes when you want to pass soldier1._rotation onto the bullet
                                                                                  > cos
                                                                                  > a statement like
                                                                                  >
                                                                                  > bullet._rotation = soldier1._rotation;
                                                                                  >
                                                                                  > within the code for the bullet will simply decide that it cant find
                                                                                  > soldier1._rotation. What I think I need is a way to make the value public
                                                                                  >

                                                                                  okay, here is what you want to check (for this case and any case when you
                                                                                  have some issue like this --- unexpected behavior)

                                                                                  TRACE, TRACE, TRACE.

                                                                                  Each bullet is coming from an attachMovie or a duplicateMovieClip, right???

                                                                                  In either case, in your code you have:

                                                                                  onClipEvent(load) {
                                                                                  this._rotation = solder1._rotation;
                                                                                  }

                                                                                  which is a valid statment. This says, find the rotation value of soldier1
                                                                                  and assign it to this (the Bullet clip)

                                                                                  So, TRACE...
                                                                                  add
                                                                                  trace(soldier1._rotation);
                                                                                  to the onClipEvent(load) handler above. You see that soldier1._rotation is
                                                                                  undefined.

                                                                                  next add another TRACE...
                                                                                  add
                                                                                  trace(this);
                                                                                  to the handler.

                                                                                  You will see that 'this' is referring to your bullet. But, soldier1 is not
                                                                                  in the bullet instance, it is in the _parent instance (most likely - depends
                                                                                  on your setup) so, you should try

                                                                                  onClipEvent(load) {
                                                                                  this._rotation = _parent.soldier1._rotation;
                                                                                  }

                                                                                  if that doesn't work, add the following traces and post their output

                                                                                  trace(this);
                                                                                  trace(this._parent);






                                                                                  Ive made a new topic for this cos the last one went wildly off-topic...

                                                                                  Im trying to use info from the soldier instance to set up bullets he fires.
                                                                                  Each new bullet wants to be its own instance/mc whatever. Thing is that I
                                                                                  cant get the info out of _root.soldier and into _root.bulletX (where X is an
                                                                                  arbitary value)

                                                                                  there is code in the bullet onClipEvent(load) like
                                                                                  this._rotation = soldier1._rotation;
                                                                                  Which by the looks of some traces Ive done just gives soldier._rotation as
                                                                                  undefined.

                                                                                  How can I pass a value out of soldier to use here?


                                                                                  • 38. Re: Passing values from mc to mc/instance to instance
                                                                                    Level 7

                                                                                    "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                                                                    news:efkdr8$95f$1@forums.macromedia.com...
                                                                                    > does _parent refer to the mc that "gave birth" to the new instance?

                                                                                    if you are using duplicateMovieClip, then the _parent is the same for all
                                                                                    duplicated bullets... the holder of the original bullet. So, if the bullet
                                                                                    instance is inside of your soldier1 MC then the _parent of each duplicated
                                                                                    bullet will be the soldier1.

                                                                                    > so if duplicateMoveClip(..."bullet"...) is in soldier1 will the _parent of
                                                                                    > bullet be soldier1? or will it be the original bullet Im duplicating?
                                                                                    >
                                                                                    > Also my traces threw up odd results. I got the rotation to work but not
                                                                                    > the
                                                                                    > _x and _y positions. Odd.

                                                                                    What are the outputs of your 'odd results'... if _x and _y don't work, TRACE
                                                                                    'em.

                                                                                    trace(this._parent._x);
                                                                                    trace(this._parent._y);

                                                                                    > I think I might start using proper .as scripts and define everything as
                                                                                    > classes cos this is getting too confusing using mc instances with code
                                                                                    > inside
                                                                                    > them.
                                                                                    >

                                                                                    This is my preferred way to go.



                                                                                    • 39. Re: Passing values from mc to mc/instance to instance
                                                                                      Level 7

                                                                                      "disco-logic" <webforumsuser@macromedia.com> wrote in message
                                                                                      news:efk7gi$2f1$1@forums.macromedia.com...
                                                                                      > hmm afraid that the kind of code I was using. The problem is you cant
                                                                                      > take a
                                                                                      > variable out of one instance and use it in another.
                                                                                      >
                                                                                      > I know that soldier1._rotation is working cos it work for soldier clip.
                                                                                      >
                                                                                      > The problem comes when you want to pass soldier1._rotation onto the bullet
                                                                                      > cos
                                                                                      > a statement like
                                                                                      >
                                                                                      > bullet._rotation = soldier1._rotation;
                                                                                      >
                                                                                      > within the code for the bullet will simply decide that it cant find
                                                                                      > soldier1._rotation. What I think I need is a way to make the value public
                                                                                      >

                                                                                      okay, here is what you want to check (for this case and any case when you
                                                                                      have some issue like this --- unexpected behavior)

                                                                                      TRACE, TRACE, TRACE.

                                                                                      Each bullet is coming from an attachMovie or a duplicateMovieClip, right???

                                                                                      In either case, in your code you have:

                                                                                      onClipEvent(load) {
                                                                                      this._rotation = solder1._rotation;
                                                                                      }

                                                                                      which is a valid statment. This says, find the rotation value of soldier1
                                                                                      and assign it to this (the Bullet clip)

                                                                                      So, TRACE...
                                                                                      add
                                                                                      trace(soldier1._rotation);
                                                                                      to the onClipEvent(load) handler above. You see that soldier1._rotation is
                                                                                      undefined.

                                                                                      next add another TRACE...
                                                                                      add
                                                                                      trace(this);
                                                                                      to the handler.

                                                                                      You will see that 'this' is referring to your bullet. But, soldier1 is not
                                                                                      in the bullet instance, it is in the _parent instance (most likely - depends
                                                                                      on your setup) so, you should try

                                                                                      onClipEvent(load) {
                                                                                      this._rotation = _parent.soldier1._rotation;
                                                                                      }

                                                                                      if that doesn't work, add the following traces and post their output

                                                                                      trace(this);
                                                                                      trace(this._parent);






                                                                                      Ive made a new topic for this cos the last one went wildly off-topic...

                                                                                      Im trying to use info from the soldier instance to set up bullets he fires.
                                                                                      Each new bullet wants to be its own instance/mc whatever. Thing is that I
                                                                                      cant get the info out of _root.soldier and into _root.bulletX (where X is an
                                                                                      arbitary value)

                                                                                      there is code in the bullet onClipEvent(load) like
                                                                                      this._rotation = soldier1._rotation;
                                                                                      Which by the looks of some traces Ive done just gives soldier._rotation as
                                                                                      undefined.

                                                                                      How can I pass a value out of soldier to use here?


                                                                                      1 2 Previous Next