# How to apply the get / set statements

**URL:** <https://forum.kirupa.com/t/how-to-apply-the-get-set-statements/295083>\
**Category:** flash\
**Created:** [August 25, 2009, 8:13am UTC](https://forum.kirupa.com/t/how-to-apply-the-get-set-statements/295083 "2009-08-25T08:13:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![GWick](https://avatars.discourse-cdn.com/v4/letter/g/aeb1de/32.png) [@GWick](https://forum.kirupa.com/u/GWick)\
**Post date:** [August 25, 2009, 8:13am UTC](https://forum.kirupa.com/t/how-to-apply-the-get-set-statements/295083/1 "2009-08-25T08:13:51Z")

</div>

Hello!  
My problem is about using variables between class definitions. After searching for how to do this i discovered the Get/Set functions of as.3. The only problem is that i am not experienced enough with this kind of statement to get it working, so i have come here to seek help from the wise and masterful members of [Kirupa.com](http://Kirupa.com).

Here is some more info:

Inside a fla called “Main” i have 2 MovieClips. The first is called Main and has a class linking to the com/Main.as file which has this code:

```
 [LEFT]

```

```auto
package com{

import flash.display.MovieClip

    public class Main extends MovieClip {
        //The definition of myVar.
        public var myVar = 0
        public function Main() {
            
        }
    }
}

```

[/LEFT]

The other movieclip is called block and links to com/Block.as which is this:

```
 [LEFT]

```

```auto
package com{

import flash.display.MovieClip

    public class Block extends MovieClip {
        public function Block() {
            //Here is where i want to trace and change my variable. 
            //Because it is not defined in this file it will not work.
            trace(myVar)
            myVar+=1
        }
    }
}

```

[/LEFT]

I think that i can apply this method here, but if any better ons exist please post them too!

Extra details:  
Both movieclips are on the stage, in the same layer and on the same frame. The movieclip called Main has instance name “ **main** ”, class “ **m** ” and base class “ **com.Main** ”. Block has no instance name and no class, but a base class of “ **com.Block** ”.

Thanks,  
GWick
