Copy link to clipboard
Copied
Hi,
within a drawing app I have an inventory of graphic symbols (all button mc's). On click the user can place an instance of a symbol with same shape on the drawing board.
Calls should use the same procedures for all present symbols.
Naming of these buttons is such (i.e. circle_but) that I can extract the name of the corresponding symbol mc (circle) via event.currentTarget.name. All fine so far.
How do I get with this string information (circle) the symbol mc (circle) now on stage?
Regards
Thomas
Copy link to clipboard
Copied
assign classes to your objects and use the 'new' constuctor to create instances.
use addChild() to add to the display.
assign instance names to suit your needs.
eg,
var circle_0:Circle=new Circle();
circle_0.name='circle_0''
or more generally,
var circle_0:Circle=Circle(createObject("CircleClass"));
circle_0.name="circle_0";
function createObject('className:String):*{
var C:Class=Class(getDefinitionByName(className));
return new C();
}
Copy link to clipboard
Copied
thank you. that was helpful!
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now