2 Replies Latest reply on Apr 30, 2007 7:59 AM by Rothrock

    library symbol in class

    Taylor_G
      I am attempting to attach a symbol in my library to a movie clip in a class. The code looks like this:

      __movieClip.attachMovie("symbol", "symbol_mc", __movieClip.getNextHighestDepth, {_x:0, _y:0});

      When I test the movie, I get a type mismatch error. I'm sure '__movieClip' is a MovieClip but I think the problem is with 'symbol'. When I take the above code out of the class and simply put it on the main timeline of my .fla file, it works.

      Please help.
        • 1. Re: library symbol in class
          dr_ross Level 1
          getNextHighestDepth should be getNextHighestDepth() as its a method.

          other than that seems fine.

          "symbol" should be fine, if theres no movievlip linked with name "symbol" in the library it just won't attach not kick up a compile time error.
          • 2. Re: library symbol in class
            Rothrock Level 5
            dr_ross is correct. Instead of using a hardcoded string of "symbol" you might want to consider something more like:

            private var _linkage:String="symbol"

            and then later have getter/setter methods for providing a linkage id to the class. Or perhaps provide the linkage in the constructor. Of course the above would default to symbol, but you might want to have it default to null so that if it isn't set it doesn't just mysteriously work!