# Beginner doesn't get this actionscript concept

**URL:** https://forum.kirupa.com/t/beginner-doesnt-get-this-actionscript-concept/56196
**Category:** flash
**Created:** [July 1, 2004, 2:14pm UTC](https://forum.kirupa.com/t/beginner-doesnt-get-this-actionscript-concept/56196 "2004-07-01T14:14:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![libman](https://avatars.discourse-cdn.com/v4/letter/l/50afbb/32.png) [@libman](https://forum.kirupa.com/u/libman)
#### Post date: [July 1, 2004, 2:14pm UTC](https://forum.kirupa.com/t/beginner-doesnt-get-this-actionscript-concept/56196/1 "2004-07-01T14:14:07Z")

</div>

Hi Folks,

I am attempting to learn the basics(very basic!) of flash programming and global variables.  
Here’s the scenario:

* * *

Frame one contains this actionscript:  
var length=0;

Frame two contains this actionscript:  
length=length+1;  
trace(“length in second frame is”);  
trace(length);  
bar.\_xscale=length;

Frame three contains this actionscript:  
length=length+1;  
trace(“length in third frame is”);  
trace(length);  
bar.\_xscale=length;  
if (length == 100) {  
stop()  
}  
gotoAndPlay(2);

* * *

Irrelevant of what I am trying to do, in frame three I expected the movie to stop once the global variable “length” reached 100 but this is not the case, the movie continues on.

Now if I make the following in frame 3:

* * *

if (length == 100) {  
stop()  
}  
else{  
gotoAndPlay(2);  
}

* * *

instead of:

* * *

if (length == 100) {  
stop()  
}  
gotoAndPlay(2);

* * *

all works properly.

Can someone explain to me what I am not understanding in regards to how actionscripting works? Obviously I am missing what seems to be a VERY IMPORTANT concept in actionscripting.

Thanks,  
Greg  
[gpl@maine.rr.com](mailto:gpl@maine.rr.com)
