# Passing variable from one class to another

**URL:** <https://forum.kirupa.com/t/passing-variable-from-one-class-to-another/237423>\
**Category:** Uncategorized\
**Created:** [August 30, 2007, 8:13am UTC](https://forum.kirupa.com/t/passing-variable-from-one-class-to-another/237423 "2007-08-30T08:13:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![30equals](https://avatars.discourse-cdn.com/v4/letter/3/f08c70/32.png) [@30equals](https://forum.kirupa.com/u/30equals)\
**Post date:** [August 30, 2007, 8:13am UTC](https://forum.kirupa.com/t/passing-variable-from-one-class-to-another/237423/1 "2007-08-30T08:13:33Z")

</div>

hi everyone. i’ve been reading the kirupa tuts for a while now, but recently just signed up for the forum as well.

well, i’m getting into flash classes, and i’m working on my first project using self written classes. but i got a question about variables.

i’ve got a MC rad\_container with the class Rad linked to it. By using class instances i can now send the variable from the MC to the class, and get it returned.

but i want to use the same variable in another MC ball\_container with it’s own class Ball.

how do i do that exactly ?

here’s my class Rad

```auto

class Rad extends MovieClip {
    
    
    
    public var ballKleur:String;
    public var radKleur:String;

    
        // constructor 
        
        public function Rad(radKleur:String) {
    
            
            ballKleur = radKleur;
            //trace (ballKleur);
                    
        }
        
            
    
        public function get dezeKleur():String {
            
            return ballKleur;
            
            
            
    
        }
        
        
        public function set dezeKleur(radKleur:String):Void {
    
            ballKleur = radKleur;
            
    
        }
    
        
    
}

```

and here’s the code i’m using in my MC rad

```auto
var myRad:Rad = new Rad("groen");

```

thanx!
