How to write this in AS3?

Hello i’m not starting to use AS3 and i need some help.

I used a lot this script on as2 but i don’t know how to write it in AS3.

This is very simple. It’s just seta variable and then write a goto that variable that i set before.

Example:

on (release) {
_root.target_home.gotoAndPlay(50);
_global.xx = 2;
}

(here i set variable _global.xx to the number 2 (could be anything else)

Then i have on other movie this if and else statment:

if(xx == 1) {
_root.bt1.loadMovie(“ecra1.swf”);
} else if(xx == 2) {
_root.bt1.loadMovie(“ecra2.swf”);
}

Anyone can help me with this in AS3?

Thanks