all groups > flash actionscript > april 2007 >
You're in the

flash actionscript

group:

library symbol in class


library symbol in class Taylor G
4/29/2007 7:55:43 PM
flash actionscript:
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.
Re: library symbol in class dr_ross
4/30/2007 12:00:00 AM
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.
Re: library symbol in class Cor
4/30/2007 1:04:49 AM
I think your "symbol_mc" must exist in your library.
Re: library symbol in class Cor
4/30/2007 1:06:40 AM
[quoted text, click to view]

Does your fla know where to find the class.
Re: library symbol in class Rothrock
4/30/2007 2:59:38 PM
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!

AddThis Social Bookmark Button