Does it work for you? For me it doesn't...
Place the above code to Stage -> CreationComplete
and the element button1 must be created in the Stage.
Otherwise, on click action of the button1 element place just the code:
Sorry but I need a solution outside the EDGE-file...