5 Replies Latest reply on Feb 14, 2012 5:44 PM by kglad

    I need help using the target path tool

    subtlefly72 Level 1

      Hi all,

      I realise that I need to keep all my code on the main timeline, so now I need some serious help with targeting movieclips and buttons, when I use the target path tool (the little gun sight in the action script panel) it lets me navigate to the thing I want, but when I use it's suggestion it very often doesn't work, and I am left using trial and error to work it out.  Ican get stuff to work, but I really have no idea why or how I am doing it, Sorry to be such a N00B, but I really think if I can work this out I am going to get somwhere.

      Cheers

      sub

        • 1. Re: I need help using the target path tool
          kglad Adobe Community Professional & MVP

          there are two ways to target objects, using absolute paths and using relative paths.

           

          if all your code is on the main timeline, there's no major difference between the two:  they'll look about the same.  so, you may as well use relative paths because there's less typing for your situation

           

          anyway, from the main timeline, you can reference any child of that main timeline by using its reference:

           

          mc;

          var1;

          etc

           

          to reference an object that's a child of a movieclip, use dot notation.  so, if var1 is defined on mc's timeline:

           

          mc.var1

           

          if mc is a movieclip with a child movieclip with reference child_mc, you can use:

           

          mc.child_mc;  // to reference that child movieclip and if there's a variable var1 on child_mc's timeline, you can use:

           

          mc.child_mc.var1;  // to reference that variable.

           

          of course, all those objects have to exist at the time your code executes.

          1 person found this helpful
          • 2. Re: I need help using the target path tool
            subtlefly72 Level 1

            Thanks kglad,

            OK that is basically what I have been doing, but its been a bit hit and miss, but maybe now I see why, your last sentence

            of course, all those objects have to exist at the time your code executes.

            So if I am referencing something inside a mc and it doesnt exist on the first frame there will be an error?

             

            also what is the       this.  Object() and Object(parent)  ??

            Do I need to be using these?

             

            And still I want to know why the target tool gives me a path that doesn't work?

            Am I using it for the wrong purpose?

            Thanks for your efforts,

            sub

            • 3. Re: I need help using the target path tool
              kglad Adobe Community Professional & MVP

              subtlefly72 wrote:

               

              Thanks kglad,

              OK that is basically what I have been doing, but its been a bit hit and miss, but maybe now I see why, your last sentence

              of course, all those objects have to exist at the time your code executes.

              So if I am referencing something inside a mc and it doesnt exist on the first frame there will be an error?

              exactly.

               

              also what is the       this.  Object() and Object(parent)  ??

              Do I need to be using these?

              not when using code on the main timeline.  "this" refers to the current scope which for code on the main timeline, is the main timeline.  the following are the same:

               

              this.mc and mc

              this.var1 and var1

               

              And still I want to know why the target tool gives me a path that doesn't work?

              i can't tell you much about the target tool.  i've never used it.  but i tried testing it just now and it seemed to work correctly to target a nested movieclip.  again, you must sure that object exists when your code executes so if you target something on frame 2 (or greater) of a movieclip using code on frame 1 of the main timeline, the reference may be correct but the object won't exist when your code executes.  there are a number of ways to handle that if it's your main problem.
              • 5. Re: I need help using the target path tool
                kglad Adobe Community Professional & MVP

                you're welcome.