4 Replies Latest reply on Jun 20, 2007 5:32 PM by kglad

    Parent in Cs3 ?

    Hope1983
      Hi there

      in Flash Cs3 i cant get the variables of the parent movieclip??
      In flash 8 it was no problem with
      _root.variable = ....;
      oder parent.variable....

      and now in CS3 it doesnt work? Cann anyone say me if there is another way to get the variables of the parent movieclip?
        • 1. Re: Parent in Cs3 ?
          Level 7
          Hope1983,

          > in Flash Cs3 i cant get the variables of the parent movieclip??

          Almost certainly, this is not a Flash CS3 issue, but an ActionScript 3.0
          issue. The language has changed quite a bit!

          > In flash 8 it was no problem with
          > _root.variable = ....;
          > oder parent.variable....

          There is not _root in AS3, and movie clips no longer have _parent
          properties (they're now simple parent, without the underscore).

          > and now in CS3 it doesnt work?

          It does work! :) Change your Publish Settings to ActionScript 2.0 and
          you'll be in familiar territory. Otherwise, make sure to search the
          Adobe.com site for AS2-to-AS3 migration articles, and familiarize yourself,
          piece by piece, with the ActionScript 3.0 Language and Components Reference.


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: Parent in Cs3 ?
            Hope1983 Level 1
            Im scripting in Actionscript 3! And it does not work so i only want to know how i can get variables from a Movieclip in a higher ( parent) directory.
            For example in

            chatmovie.variable = "hi";
            and when i go in to a movieclip which is in the chatmoviemovieclip forexample "userprofile"movieclip
            i can get this variable from chatmoviemovieclip. in Actionscript 2 or Flash 8 it was no problem with parent.
            And also in the Actionscriptmigration there is no such help. Now i've write in the chatmoviemovieclip this
            variabel = "HI";
            userprofile.variable = variabel;

            But this does not function every time. There are some times where i have to give the variable to the parent movieclip..........

            Hard to say all this in english -.-
            • 3. Re: Parent in Cs3 ?
              Level 7
              Hope1983,

              > Im scripting in Actionscript 3!

              Okay. :)

              > And it does not work so i only want to know how
              > i can get variables from a Movieclip in a higher
              > ( parent) directory.

              Do you mean looking from the current movie clip to its parent movie
              clip? If so, use the MovieClip.parent property. The only difference
              between AS3 and AS2 in the regard is the underscore (AS2: _parent; AS3:
              parent).

              > For example in
              >
              > chatmovie.variable = "hi";

              Yes ...

              > and when i go in to a movieclip which is in the chatmoviemovieclip
              > forexample "userprofile"movieclip i can get this variable from
              > chatmoviemovieclip.

              From the point of view of chatmovieclip, you could "reach down" into
              userprofile simply by referencing its name. If the point of view is in
              userprofiel, you could "reach up" into the parent chatmovieclip by
              referencing this.parent.

              > in Actionscript 2 or Flash 8 it was no problem with parent.
              > And also in the Actionscriptmigration there is no such help.

              We might have to keep going for a while, because I'm not sure either of
              us understands the other yet. :)

              > Now i've write in the chatmoviemovieclip this
              > variabel = "HI";
              > userprofile.variable = variabel;

              Okay.

              > But this does not function every time. There are some times where
              > i have to give the variable to the parent movieclip..........
              >
              > Hard to say all this in english -.-

              Based on your "oder" earlier, do you speak German? We could try that.


              David Stiller
              Adobe Community Expert
              Dev blog, http://www.quip.net/blog/
              "Luck is the residue of good design."


              • 4. Re: Parent in Cs3 ?
                kglad Adobe Community Professional & MVP
                variables defined on movieclip timelines are referenced in as3 the same as they were in as2. there is, however, a big difference WHEN those variables are available

                in as2, you could put a movieclip on stage and in that frame reference any variable defined on the movieclip's first frame. in as3, that variable won't be available until just before the movieclip is about to be rendered:

                so, if you have a movieclip (that contains a variable var1 defined on its first frame, var var1:String="hi") with instance name mc on stage in a frame that contains the below actionscript you'll find: