# How to pass X and Y coordinates from one as.file to another as.file

**URL:** <https://forum.kirupa.com/t/how-to-pass-x-and-y-coordinates-from-one-as-file-to-another-as-file/331241>\
**Category:** Uncategorized\
**Created:** [June 19, 2013, 10:17am UTC](https://forum.kirupa.com/t/how-to-pass-x-and-y-coordinates-from-one-as-file-to-another-as-file/331241 "2013-06-19T10:17:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xaq](https://avatars.discourse-cdn.com/v4/letter/x/3e96dc/32.png) [@xaq](https://forum.kirupa.com/u/xaq)\
**Post date:** [June 19, 2013, 10:17am UTC](https://forum.kirupa.com/t/how-to-pass-x-and-y-coordinates-from-one-as-file-to-another-as-file/331241/1 "2013-06-19T10:17:06Z")

</div>

hello,  
How do you do?  
Iam new to actionscript 3 also new to english launguage.  
I have made 3 as.file , 1- Main, 2 -A and 3-B.  
File A and B contain both a moving sprite(circle) for the stage.  
What i need is the coordinates X and Y of the “MOVING SPRITE” on stage from as.file 3-B to pass the variable into as.file 2-A.  
I could merge both as.file into Main.as file, but thats not my goal !!!  
I dont know if its possible, i search google and tried many option without succes.  
hopefully you guy’s can help me .  
Below i show the code.  
thnx for your time and reading.

package  
{

```
import flash.display.*;
import flash.events.*;

public class a extends Sprite
{

    public var cirleA:Sprite;
    public var speed:Number = 7;
    public var coordinatesX:Number;
    public var coordinatesY:Number;

    public function a()
    {

        cirleA = new Sprite ();
        cirleA.graphics.beginFill(0x000000);
        cirleA.graphics.drawCircle(0,0,10);

        addEventListener(Event.ENTER_FRAME, movecirleA);
    }
    function movecirleA(event:Event)
    {

        cirleA.x += speed / 4;
        cirleA.y += speed / 7;

        /*coordinatesX = cirleB.x ; &lt;=========== this is what i need,
        coordinatesY = cirleB.y ;*/// &lt;========= dunno how to do it !!!        

        addChild(cirleA);
    }
}

```

}

package  
{

```
import flash.display.*;
import flash.events.*;

public class b extends Sprite
{

    public var cirleB:Sprite;
    public var speed:Number = 7;

    public function b()
    {

        cirleB = new Sprite ();
        cirleB.graphics.beginFill(0xff0000);
        cirleB.graphics.drawCircle(0,0,10);

        addEventListener(Event.ENTER_FRAME, movecirleB);
    }
    function movecirleB(event:Event)
    {

        cirleB.x += speed / -4;
        cirleB.y += speed / 7;

        addChild(cirleB);
    }
}

```

}

package  
{

```
import a;
import b;
import flash.display.*;

public class Main extends Sprite
{

    public var circleA:a;
    public var circleB:b;

    public function Main()
    {

        circleA = new a ();
        circleB = new b ();

        circleB.x = 450;
        circleB.y = 0;
        addChild(circleA);
        addChild(circleB);
    }

}

```

}
