Dynamically changing instance variables

I’m new to flash and I’m sure there must be a simple way of doing this but I’ve been trawling forums and books for a week now and it’s still evading me. In the following code I would like to be able to change which object the code affects depending on which parameter name is passed to it:

EventCentral.getInstance().addEventListener(ProjectEvent.SOME_EVENT, handleSomeEvent);

function handleSomeEvent($event:ProjectEvent):void

    if ($event.params.name == "pop_window", "jazz_window", "classical_window", "mast_window") {
        jazz_window.visible = true;
        jazz_window.y = stage.stageHeight + 404.5;
        jazz_window.x = stage.stageWidth / 2;
        Tweener.addTween(jazz_window, {y: stage.stageHeight / 2, time: 1, transition:"easeOutExpo"});


For example if pop_window is passed, at runtime it would read:

pop_window.visible = true;
pop_window.y = stage.stageHeight + 404.5;
pop_window.x = stage.stageWidth / 2;
Tweener.addTween(pop_window, {y: stage.stageHeight / 2, time: 1, transition:"easeOutExpo"});

I could write it all out with ifs and else ifs for each parameter but this code is already part of quite a large structure and it would be more elegant to be able to do it with re-usable code.

Cheers for any help on this, I’m not sure if the way I’m trying to do it is particularly idiomatic to actionscript anyway, so if anyone can point me towards an easier way to do the same thing that would be awesome too :slight_smile: