[LEFT]
Hi people!
I have a set of buttons that dispatch an event when clicked on. One thing im kind of struggling with is to create a new object based on button clicked.
If i click on contact us, i need to load up the contact us module. However im not really sure how to do this without hard coding the values.
an example of hard coding the issue i mean:
private var menuArray:Array = (“option1”, “option2”, option3");
… on the buttons when clicked i dispatch a custom event
private function onClick(c:CustomEvent): Void
{
switch (c.id);
case 0:
currentSection = new Option1();
break;
// and so on and so forth
}
Is there a better way to go about this?
Thanks
[/LEFT]