PDA

View Full Version : Dynamic linkage id in Object.registerClass ? How?



Spongebob
August 13th, 2002, 12:14 PM
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...
Object.registerClass("LinkageId",MyClass);

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


myLinkId = "XXX";
Object.registerClass(myLinkId ,MyClass);

I've already tried to concatenate " " to myLinkId and it still doesn't work...

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

Thanks in advance,
Spongebob.

Spongebob
August 14th, 2002, 12:35 PM
Anybody ..... ? Please help me on this subject...:(
Any tip I can try will be helpful...

Thanks,
Spongebob

pom
August 14th, 2002, 01:09 PM
Why do you always come up with tough questions like that? :P
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:

Spongebob
August 14th, 2002, 01:27 PM
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 :)

Thanks for your and your master's help =)

Spongebob.

sbeener
August 14th, 2002, 08:37 PM
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/

Spongebob
August 15th, 2002, 09:40 AM
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 #?$#"&% !! :(

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