[Flashcoders] String to object

2007-01-09 Thread Bart Albrecht
Hi,

 

I'm migrating some stuff from AS2 to AS3

 

In AS2 I can do this:

function doSomething(btnName:String)

{

_root[btnName]visible = false;

}

doSomething(exit_btn);

 

In AS3

I want to do the same:

public function doSomething(btnName:String)

{

//XXX here I don't know what I should do 

}

 

I hope someone can help me

 

Bart

 

 

___
Flashcoders@chattyfig.figleaf.com
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


Re: [Flashcoders] String to object

2007-01-09 Thread eka

Hello :)

in AS3 you must use the DisplayObjectContainer methods to manipulate the
childs in a DisplayObject (MovieClip, Sprite, etc...)

http://livedocs.macromedia.com/flex/2/langref/flash/display/DisplayObjectContainer.html

You can read in the documentation the method
getChildByNamehttp://livedocs.macromedia.com/flex/2/langref/flash/display/DisplayObjectContainer.html#getChildByName%28%29
(name:String http://livedocs.macromedia.com/flex/2/langref/String.html):
DisplayObjecthttp://livedocs.macromedia.com/flex/2/langref/flash/display/DisplayObject.html

You can now get the reference of your display with this method.


EKA+ :)

2007/1/9, Bart Albrecht [EMAIL PROTECTED]:


Hi,



I'm migrating some stuff from AS2 to AS3



In AS2 I can do this:

function doSomething(btnName:String)

{

_root[btnName]visible = false;

}

doSomething(exit_btn);



In AS3

I want to do the same:

public function doSomething(btnName:String)

{

//XXX here I don't know what I should do

}



I hope someone can help me



Bart





___
Flashcoders@chattyfig.figleaf.com
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


___
Flashcoders@chattyfig.figleaf.com
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


Re: [Flashcoders] String to object

2007-01-09 Thread R�kos Attila

You can do that similarly to AS2, the array notation works in AS3 as
well and referring to a variable by its name is possible (as far as it is
an object instance's field/property, and not a local variable).
However since _root doesn't exist, you have to rethink this part a bit.

  Attila

BA Hi,
BA 
BA  
BA 
BA I'm migrating some stuff from AS2 to AS3
BA 
BA
BA In AS2 I can do this:
BA 
BA function doSomething(btnName:String)
BA 
BA {
BA 
BA _root[btnName]visible = false;
BA 
BA }
BA 
BA doSomething(exit_btn);
BA 
BA  
BA 
BA In AS3
BA 
BA I want to do the same:
BA 
BA public function doSomething(btnName:String)
BA 
BA {
BA 
BA //XXX here I don't know what I should do 
BA 
BA }
BA 
BA
BA I hope someone can help me


___
Flashcoders@chattyfig.figleaf.com
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