# Using classes to add your code instead of adding it directly in your FLA file

**URL:** <https://forum.kirupa.com/t/using-classes-to-add-your-code-instead-of-adding-it-directly-in-your-fla-file/305784>\
**Category:** flash\
**Created:** [March 3, 2010, 1:45pm UTC](https://forum.kirupa.com/t/using-classes-to-add-your-code-instead-of-adding-it-directly-in-your-fla-file/305784 "2010-03-03T13:45:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fs\_tigre](https://avatars.discourse-cdn.com/v4/letter/f/edb3f5/32.png) [@fs\_tigre](https://forum.kirupa.com/u/fs_tigre)\
**Post date:** [March 3, 2010, 1:45pm UTC](https://forum.kirupa.com/t/using-classes-to-add-your-code-instead-of-adding-it-directly-in-your-fla-file/305784/1 "2010-03-03T13:45:05Z")

</div>

Hi,

Last night, for first time decided to start using Classes to add my code instead of adding it directly in Flash and I really thought I knew how to handle this since I have created some re-usable classes before where you target an object by passing parameter etc, but for some reason I’m a little confused.

For instance I thought that if I had one function (method) in my class and I wanted to call it from my .fla file all I needed to do was to create an instance of the class and then call my method.

Something like this:

Class

```auto
package apps.calculator{
    import com.greensock.*;
    import flash.display.*;

    public class Sample extends MovieClip {
        // recMc is on the stage in my .FLA file
              recMc.addEventListener(MouseEvent.CLICK, moveIt,false,0,true);

        public function Sample():void {
            trace("This is the constructor");

        }

        public function moveIt(event:MouseEvent):void {

            recMc.x = 500;
                        
        }
    }
}

```

.FLA file:

```auto

import apps.calculator.*;
var moveMc: Sample = new Sample();
moveMc.moveIt();

```

But this doesn’t work I get a message that says that it is missing arguments.  
Can someone be so kind and give me some advice on how to use my code directly on a class and what are the differences of doing this versus putting the code directly on my .fla file and if it’s even a good practice to do this?

Thanks a lot!
