# How to write this in AS3?

**URL:** <https://forum.kirupa.com/t/how-to-write-this-in-as3/309759>\
**Category:** flash\
**Created:** [May 24, 2010, 9:44am UTC](https://forum.kirupa.com/t/how-to-write-this-in-as3/309759 "2010-05-24T09:44:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alapimba](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@alapimba](https://forum.kirupa.com/u/alapimba)\
**Post date:** [May 24, 2010, 9:44am UTC](https://forum.kirupa.com/t/how-to-write-this-in-as3/309759/1 "2010-05-24T09:44:00Z")

</div>

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
