# Variables between AS Files

**URL:** <https://forum.kirupa.com/t/variables-between-as-files/295854>\
**Category:** flash\
**Created:** [September 5, 2009, 9:26pm UTC](https://forum.kirupa.com/t/variables-between-as-files/295854 "2009-09-05T21:26:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![KillinSprE](https://avatars.discourse-cdn.com/v4/letter/k/a87d85/32.png) [@KillinSprE](https://forum.kirupa.com/u/KillinSprE)\
**Post date:** [September 5, 2009, 9:26pm UTC](https://forum.kirupa.com/t/variables-between-as-files/295854/1 "2009-09-05T21:26:19Z")

</div>

I have variables declared (I assume) in Main.as and I wish to use them in other AS files such as pg1.as  
Here’s my code:

```auto

//Main.as
package {
    import fl.controls.*;
    import flash.text.*;
    import flash.events.*;
    import flash.net.*;
    import flash.display.Sprite;

    public class Main extends Sprite {
        public static var tf_CSM_17_l:TextFormat = new TextFormat();
        tf_CSM_17_l.font = "Comic Sans MS";
        tf_CSM_17_l.bold = false;
        tf_CSM_17_l.color = 0x000000;
        tf_CSM_17_l.size = 17;
        tf_CSM_17_l.align = TextFormatAlign.LEFT;
        //several more almost identical declarations
        function Main(){
            var Page1:pg1 = new pg1();
            Page1.pg_1();
        }
//lots more coding not relevant to the problem
     }
}

//pg1.as
package {
    import fl.controls.*;
    import flash.text.*;
    import flash.events.*;
    import flash.net.*;
    import flash.display.Sprite;

    public class pg1 extends Sprite {
        public function pg_1(){
            var pt1:Label = new Label()
            pt1.setStyle("textFormat", tf_CSM_17_l);
            pt1.move(102,93);
            pt1.width = 789;
            pt1.height = 284;
            pt1.text="some text";
            addChild(pt1);
        }
     }
}

```

this produces the following error:  
1120: Access of undefined property tf\_CSM\_17\_l.

I assume its in the wording of the “public static var”. What should be used so that this variable is available to all AS files?
