# Importing class into custom class

**URL:** <https://forum.kirupa.com/t/importing-class-into-custom-class/221466>\
**Category:** flash\
**Created:** [April 4, 2007, 3:40pm UTC](https://forum.kirupa.com/t/importing-class-into-custom-class/221466 "2007-04-04T15:40:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![schmichael](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@schmichael](https://forum.kirupa.com/u/schmichael)\
**Post date:** [April 4, 2007, 3:40pm UTC](https://forum.kirupa.com/t/importing-class-into-custom-class/221466/1 "2007-04-04T15:40:12Z")

</div>

Hi there, I realise I’m not allowed to import classes into other classes but I am not sure how to achieve what I want. I want 2 custom classes to pass data one from another directly. I have 2 custom classes I want to use: one extends the XMLSocket Class:  
[AS]  
class Game extends XMLSocket {  
import XMLParser //not allowed to do this I know!  
var parser:XMLParser = new XMLParser();  
function onXML(src:XML):Void {  
//trace(“xml:”+src);  
parser.parseIt(src);  
}

}  
[/AS]  
…and the other is a custom class I want to use to parse XML data that the Game class receives from its XML Socket:  
[AS]  
class XMLParser {  
public function XMLParser() {  
// constructor  
}  
function parseIt(theXML:XML):Void {  
trace(“xmlParser received:”+theXML.toString());  
//parsing code goes here  
}  
}  
[/AS]  
As I say I realise I am not allowed to import the parsing class into my Game class (or any class for that matter) but I don’t know how to pass data directly between these two classes without referencing them in the main FLA.  
If anyone could let me know that would be a massive help, thanks :)!  
Schm
