# Accessing functions in embedded AS files

**URL:** <https://forum.kirupa.com/t/accessing-functions-in-embedded-as-files/232994>\
**Category:** Uncategorized\
**Created:** [July 19, 2007, 9:53am UTC](https://forum.kirupa.com/t/accessing-functions-in-embedded-as-files/232994 "2007-07-19T09:53:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raziel](https://avatars.discourse-cdn.com/v4/letter/r/4bbf92/32.png) [@Raziel](https://forum.kirupa.com/u/Raziel)\
**Post date:** [July 19, 2007, 9:53am UTC](https://forum.kirupa.com/t/accessing-functions-in-embedded-as-files/232994/1 "2007-07-19T09:53:52Z")

</div>

Hi,

I created a ChatLoader.swf that first imports Connect(); for the connect functions and then imports Avatars(); for the avatar functions.

the Avatars.as has several functions that need to transmit variables to Connect.as so that it sends the variables across to other people. How can i get Avatar.as to acces the Connect functions?

I can’t import Connect.as into Avatar.as since it’ll create 2 connections with the server.

ChatLoader.swf itself has

```auto
private var connect:Connect= new Connect();

```

and Connect.as has

```auto
	public function write(str:String):void
	{
		socket.writeUTFBytes(str);
		socket.flush();
	}

```

so that i can write:

```auto
connect.write();

```

from the ChatLoader.as if i want to send variables to the connect functions. I’d like to do the same with the avatar functions but it doesn’t seem to work.
