Dynamic linkage id in Object.registerClass ? How?

Hi there,

Anybody knows a way of setting the linkage identifier of the movie clip symbol in the Object.registerClass dynamically?

If I write “LinkageId” between " " it works fine…
[COLOR=blue]Object.registerClass(“LinkageId”,MyClass);[/COLOR]

BUT if I don’t use " " and try to set the contents of a variable, it doesn’t work :frowning:

[COLOR=red]
myLinkId = “XXX”;
Object.registerClass(myLinkId ,MyClass);[/COLOR]

I’ve already tried to concatenate " " to myLinkId and it still doesn’t work…

I need to dynamically register lots of MCs to myClass :frowning:
Anybody has a tip on how to do it ?

Thanks in advance,
Spongebob.

Anybody … ? Please help me on this subject…:frowning:
Any tip I can try will be helpful…

Thanks,
Spongebob

Why do you always come up with tough questions like that? :stuck_out_tongue:
I’ve never actually programmed components, so I don’t have your answer, but I’ll try and ask my Chinese master, he may know.

pom :asian:

Sorry :-\
I’ve lately came up with these strange things …, haven’t I ?

I hope this is the last thing I cannot solve by myself :slight_smile:

Thanks for your and your master’s help =)

   Spongebob.

i was unable to get this method to work with anything aside from exported library assets. i’m not sure it that’s the intention or i was just doing it wrong.

are you able to set a particular movie clip’s class with this method?

with library assets though, it worked happily with or without variables. i exported an asset under the name “sqr” from the library and this code worked fine:


function Classy(){
	this.class = "Classy";
	this.onMouseUp = function(){ trace("i'm classy!"); };
};

item = "sqr";

Object.registerClass(item,Classy);

_root.attachMovie("sqr","square",0);

i’m thinking that you’re trying to do something a little different but i’m not sure what.

for a heavy read, you could browse dave yang’s site on oop in flash.
http://www.quantumwave.com/flash/

Great sbeener ! =)

This is exactly what I’m trying to do!, worked marvellous!

I now know what I was doing wrong :*(

I was trying to register the item with the class right after the attachMovie sentence !! I’m such a #?$#"&% !! :frowning:

Thank you very much for your help!
Regards,
Spongebob.