3 Replies Latest reply on Aug 18, 2007 8:49 AM by Rothrock

    Setting Name of Loaded Movie Clips

    wdrudolph
      I'm getting this error after I use the loader to load in an swf- and then try to rename it to something useful.
      Error #2078: The name property of a Timeline-placed object cannot be modified.

      This is a new one - this means that I cannot rename a loaded file?
      I would like to actually access the loaded file by a reasonable name.. instead of some random "instance#".

      pseudo code -
      var tempAddMC = aFileLoader.getLoadedFile(); // just returns "loader.content"
      tempAddMC.name = "NOTINSTANCE";

      This - generates the error.

      Anyone have different code that would make renaming an loaded MC possible? - without having to make some stupid reference array to match up names with "instance#"s. (I'd like to be able to use the getChildByName function.)

      Thanks
        • 1. Re: Setting Name of Loaded Movie Clips
          Rothrock Level 5
          Well the error tells you that the name of a Timeline-placed object cannot be modified. So it would seem that you should name it on the timeline or you should create it dynamically and give it the name you want that way.
          • 2. Re: Setting Name of Loaded Movie Clips
            wdrudolph Level 1
            From your response - I'm trying to figure out if there is a way to load in a movie clip and it NOT be dynamically created. I believe that using the Loader class to load in a movie is creating the movie dynamically - and that's the problem. After I load it in AS3 auto assigns "a" name - not a name that I can easily use later.

            I know what the error says - obviously I can't rename it on the timeline because it's a loaded swf.
            • 3. Re: Setting Name of Loaded Movie Clips
              Rothrock Level 5
              …that which we call a rose by any other name would smell as sweet.

              With AS3 it seems that we shouldn't get as hung up on names as we have been in the past. From my brief experiments, I don't think it is that the loader is dynamically creating a movie, but that the timeline of the external clip is an instance of MovieClip. And it is "time-line" placed by definition. When I trace the this.name from my external movie it traces "root1" by itself, but when loaded into something else it gets that "instance" name.

              You can name your loader and just access its content property (cast as a MovieClip).