package{

//because I'm writing this as an external as file,
//I must import all classes that I need. If you don't, you will get an error.
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.text.*;// /* is a wildcard. It imports all text classes in this example

public class Main extends MovieClip{
//Main is also the name of the file.
//(could call it Fred, but would have to name the class and file Fred too. )


public function Main(){

var titleStr:String;
var myNum:Number;
var lineX:Number=myNum;
var newLine:Line = new Line();
var strNum:Number;


newLine.x=1;

//event listeners applied to go_mc
go_mc.addEventListener(MouseEvent.CLICK, onClick);
go_mc.addEventListener(MouseEvent.MOUSE_OVER, onOver);
go_mc.addEventListener(MouseEvent.MOUSE_OUT, onOut);


function onOver(event:MouseEvent):void{
go_mc.alpha=.5;
}

function onOut(event:MouseEvent):void{
go_mc.alpha=1;
}


//onClick function is executed when the go_mc CLICK event happens.
function onClick(event:MouseEvent):void{
titleStr = title_txt.text;
strNum= titleStr.length;
myNum = titleStr.charCodeAt(0);
x_txt.text= "the x = " +myNum + " , the string length is" +strNum;
addChild(newLine);
newLine.x=myNum;
trace (strNum);
}
}

}

}