I will try to explain this:

first, apoligizes for my bloody english, :P

i want to build one menu from XML source like this.

<item label="Nuevo" clase = "bm_New"/>

i know the process for linking clases to a symbol in the library, but i
don't wanna to have multiples copys of symbols with different class
linkages.

the type of var className is a String im sure of this.

var className:String


If i make this:


for (var i in lib.botones.menu){
   trace ( i + "-->" + lib.botones.menu[i]);
}

trace outputs all the clases in route /lib/botones/menu/, used by
flash:classes associated on a symbol in the library, attached to the scene
or previous code registered.


I hope this is not the same thing.

lib.botones.menu["bm_Nuevo"];

var clase:String = "bm_Nuevo";
lib.botones.menu[clase];


The only solution i have found is add a previous method"register()" to the
parent class, and use like this.

lib.botones.menu["bm_New"].register();

or make before attach the simbol botonTipo for all the clases i want to use
later.

Object.registerClass ("botonTipo", lib.botones.menu["bm_New"]);


"botonTipo" is the default button i want to attach and apply class.

if i make this previously
Object.registerClass ("botonTipo", lib.botones.menu["bm_New"]);
Object.registerClass ("botonTipo", lib.botones.menu["bm_Close"]);
Object.registerClass ("botonTipo", lib.botones.menu["bm_Open"]);
...

and  trace

for (var i in lib.botones.menu){
   trace ( i + "-->" + lib.botones.menu[i]);
}

y found all the new clases.

nice or not?





2006/11/13, Zárate <[EMAIL PROTECTED]>:

Hi Oskar!

Trace the type of the variable, if you're getting it from an XML, it
could easily be "object" instead of "string".

Cheers!

On 11/13/06, el oskitar <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a problem with Object.registerClass
>
> this works fine!
> //className hardcoded
>
> var myClass = lib.botones.menu["class"];
>                 Object.registerClass    ("obj_ID", myClass );
>                 var   myObj  =   _root..attachMovie ("obj_ID","myObj",
> _root.getNextHighestDepth( ));
>
>
> but extrangely  this won't work!
> //className passed by variable
>
> var className = "class";
> var myClass = lib.botones.menu[className];
>                 Object.registerClass    ("obj_ID", myClass );
>                 var   myObj  =   _root..attachMovie ("obj_ID","myObj",
> _root.getNextHighestDepth( ));
>
>
> Any idea for this extrange behavior?
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>


--
Juan Delgado - Zárate
http://zarate.tv
http://dandolachapa.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to