# MX ActionScript - gotoAndStop within an if statement

**URL:** <https://forum.kirupa.com/t/mx-actionscript-gotoandstop-within-an-if-statement/136420>\
**Category:** Uncategorized\
**Created:** [February 4, 2005, 6:03pm UTC](https://forum.kirupa.com/t/mx-actionscript-gotoandstop-within-an-if-statement/136420 "2005-02-04T18:03:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![infamous](https://avatars.discourse-cdn.com/v4/letter/i/df705f/32.png) [@infamous](https://forum.kirupa.com/u/infamous)\
**Post date:** [February 4, 2005, 6:03pm UTC](https://forum.kirupa.com/t/mx-actionscript-gotoandstop-within-an-if-statement/136420/1 "2005-02-04T18:03:27Z")

</div>

Hello everyone!

I have 2 keyframes, both containing buttons and then i load a variable from another document, “messages.txt”. This document only contains one line atm, which is:

messages=1

When messages are more then 0, i want to go to my second keyframe.  
This is the code I’m using in keyframe 1:

stop();  
loadText = new LoadVars();  
loadText.load(“messages.txt”);  
loadText.onLoad = function() {  
if (messages\>0) {  
gotoAndStop(2);  
}  
}

The problem is, it won’t go to keyframe 2, it stops at keyframe 1 even though my var messages is set to 1.

The messages.fla, messages.html/swf and messages.txt are located at [http://213.113.144.74/flash/](http://213.113.144.74/flash/) (One of the above must be put in too, or my webserver will say forbidden.)

Would be very grateful if someone could come up with an answer for this.

Thanks.  
/infamous
