# Scope & ENTER\_FRAME questions

**URL:** <https://forum.kirupa.com/t/scope-enter-frame-questions/287543>\
**Category:** Uncategorized\
**Created:** [May 3, 2009, 10:55am UTC](https://forum.kirupa.com/t/scope-enter-frame-questions/287543 "2009-05-03T10:55:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SonOfChaos](https://avatars.discourse-cdn.com/v4/letter/s/7c8e57/32.png) [@SonOfChaos](https://forum.kirupa.com/u/SonOfChaos)\
**Post date:** [May 3, 2009, 10:55am UTC](https://forum.kirupa.com/t/scope-enter-frame-questions/287543/1 "2009-05-03T10:55:05Z")

</div>

Okay, a LOT of the problems I’ve been having resulted from me not understanding scope, so now I’ve got some scope questions for ya to help clarify.

HOW can I have a value shared between multiple classes? For example.

```auto
 public var test:int = 3; 

```

This works fine for the “main” class, but in the “animal” class, it can’t access this variable. So if I wanted to set a rate of movement for an object, say animal, and I want to change it later in a different function, well, how? Any good guides to passing variables between functions and classes that are easy to understand?

HOW can I pass values to ENTER\_FRAME events, err…any events really. Example.

```auto

     public class animal extends MovieClip{
         public function animal(){
                trace('crazy stuff happening');
                this.addEventListener(Event.ENTER_FRAME, aniMove)
         }
         public function aniMove(evt:Event){
                trace('moving')
                this.y ++;
         
         }
     }

}

```

Lets say I wanted to pass the Y value from the main class and not from within the animal function.
