# Help! Scope issue within package

**URL:** <https://forum.kirupa.com/t/help-scope-issue-within-package/299914>\
**Category:** flash\
**Created:** [November 12, 2009, 3:42pm UTC](https://forum.kirupa.com/t/help-scope-issue-within-package/299914 "2009-11-12T15:42:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alan\_moore](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@alan\_moore](https://forum.kirupa.com/u/alan_moore)\
**Post date:** [November 12, 2009, 3:42pm UTC](https://forum.kirupa.com/t/help-scope-issue-within-package/299914/1 "2009-11-12T15:42:23Z")

</div>

I have a class in which I have declared an array. The functions in that class are designed to make changes to the array, but it’s not working:

```auto

package {
    import flash.net.*;
    import flash.xml.*;
    import flash.events.*;
    
    public class Checklogic extends EventDispatcher {
        
        private var customerCheck:Array = new Array();
        
        public function resetCheck():void {
            trace("called reset check");
            // clear all chars on check
            for(var i:int=0; i<customerCheck.length; i++) {
                customerCheck.pop();
            }
            trace(customerCheck);
        }
        
        public function getNumberOfCheckItems() {
            return customerCheck.length;
        }
        
        public function getCustomerCheckArray() {
            return customerCheck;
        }
        
        public function addCharToCheck(sentObject) {
            trace("Sent Object: "+sentObject.body);
            trace("before push: ");
            trace(customerCheck);
            customerCheck.push(sentObject);
            trace("after push: ");
            trace(customerCheck);
        }
    }
}

```

Anything I do to customerCheck treats it as if it were a new array. This is especially obvious when using customerCheck.push in addCharToCheck() – the trace always shows a blank array before push and an array with one object in it after the push… then next time it does the same.

I know I’m making some sort of fundamental error regarding the scope of the array within the class but I just cannot find any good information on how to fix it!

Any help is greatly appreciated. Moving to AS3 (been coding it for all of about 3 weeks) is a nightmare so far, and it seems to be the ‘easy’ stuff that causes me problems 🙂
