# Function Scope Question

**URL:** <https://forum.kirupa.com/t/function-scope-question/215822>\
**Category:** flash\
**Created:** [February 10, 2007, 9:56pm UTC](https://forum.kirupa.com/t/function-scope-question/215822 "2007-02-10T21:56:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![W84me](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/w84me/32/1257_2.png) [@W84me](https://forum.kirupa.com/u/W84me)\
**Post date:** [February 10, 2007, 9:56pm UTC](https://forum.kirupa.com/t/function-scope-question/215822/1 "2007-02-10T21:56:36Z")

</div>

Hello people!

I am trying to advance in actionscript and i have a question…

I 've wrote this

```auto
function galleryFetcher() {

   galName = [];

 var galXml:XML = new XML();

 galXml.ignoreWhite = true;
 
 galXml.load("gallery.xml");
 
 galXml.onLoad = function(success:Boolean) {
     if(success) {
         
         var galleries = this.firstChild.childNodes;
         
         for(var i:Number = 0;i<galleries.length;i++) {
             
             var gallery = galleries*;
             
             galName.push(galleries*.attributes.name);
             
            
         }
         
         
         
         
     } 
     
     
     galleryButtons();
 }
 

}

function galleryButtons() {
    
    for(var k:Number = 0;k<galName.length;k++) {
        trace(k);
    }
    

}

galleryFetcher();

```

If i write

```auto
galName = [];

```

it works fine BUT if i write

```auto
var galName:Array = [];

```

it doesnt…Can anyone tell me why?

I think it is so simple and basic but i dont have the knowledge.

Thanks in advance!
