4 Replies Latest reply on Mar 7, 2007 11:49 PM by ggshow

    dot notation

      I am new to action script, but as of now I am creating a site where an intro plays out and then returns to a movie clip that is two levels above it. So I can easily write _parent._parent.gotoAndPlay("site"); which works out fine and plays perfectly. But I know there is a way to define something like site_mc.gotoAndPlay("site"); to go directly to the movie clip that this is in, rather than saying _parent._parent. I think one has to give it an instance name, and also declare a var site_mc:MovieClip; but for some reason that doesn't seem to work. Am I not defining these variables in the right place, or am I missing something more important? Any ideas would help.

      Thanks a ton for any advice!
        • 1. Re: dot notation
          ggshow Level 2
          // if you have this

          site_mc = _parent._parent;

          // then you can use this

          • 2. Re: dot notation
            laphlegm Level 1
            Ah, I see. Is there no other way to call movie clips directly? or am I getting confused, when you call something like site_mc.gotoAndPlay() along is site_mc reffering to the instance name I gave it, or the actual title of the Movie Clip? I am guessing that when you call it, it is reffering to the instance name, no?
            • 3. Re: dot notation
              All you have to do my friend is to declare a global variable........and store the movie you want to access......

              _global.site = site_mc

              but keep it in mind that you need to declare this var on the same timeline where your site_mc resides......or you need to assign it with its proper target path......in your case your target movie resides two level up so the relative path is _parent._parent.....

              there are two ways to target a movie either by its relative path......from the movie you are triggering your script......or absolute in respect to _root. or level0 which is your root timline......

              and all the instaces are called by their instance name.....actionscript has nothing to do with the name which you see in the libraby....
              • 4. Re: dot notation
                ggshow Level 2
                dont confuse about the instance name,
                it has different path if you call it from different place (level).

                lets say, your grandpa calling your grandma as "darling",
                "darling" is the instance name of your grandma which works only for your grandpa,

                but your father cannot call her "darling", your father have to call her as "mother", mother = father.darling;

                while you have to call her "grandma",
                grandma = father.father.darling;

                if you have already define this:
                grandpa = father.father;

                then you can call your grandma via

                remember, you can never call your grandma as "darling"...

                complicated? no...