creating object according to the switch case value

Posted by vincent on Stack Overflow See other posts from Stack Overflow or by vincent
Published on 2011-01-02T06:17:03Z Indexed on 2011/01/02 6:54 UTC
Read the original article Hit count: 165

Filed under:

hello,

i have the following switch case:

    switch (appModel.currentPage){
                case "Programma":
                case "Winkelwagen":
                case "Films":
                case "Contact":
                    if (page){
                        removeChild(page);
                    }
    //here i would like to create a new object page that has the type of the switch.
i mean this: var page: getDefinitionByName(appModel.currentPage+"Page");

this doesnt work thou but it should be something like: "FilmsPage or ContactPage or ...".
                    addChild(page);
                    break;

Does anyone know how to do this?

© Stack Overflow or respective owner

Related posts about actionscript-3