Presumably you're referencing Adobe's Getting started with ActionScript: Creating a basic application.
This older tutorial is more geared towards Flex 3, in which you would implement a front-end presentation to wire to the Greeter
class.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*"
layout="vertical"
creationComplete="initApp()">
<mx:Script>
<![CDATA[
private var myGreeter:Greeter = new Greeter();
public function initApp():void
{
// says hello at the start, and asks for the user's name
mainTxt.text = myGreeter.sayHello();
}
]]>
</mx:Script>
<mx:TextArea id="mainTxt" width="400" backgroundColor="#DDDDDD"
editable="false"/>
<mx:HBox width="400">
<mx:Label text="User Name:"/>
<mx:TextInput id="userNameTxt" width="100%"
enter="mainTxt.text=myGreeter.sayHello(userNameTxt.text);"/>
</mx:HBox>
</mx:Application>
By simply pasting the Greeter
class, you would not receive errors since no part of this class is executing. Nothing from that class is being called.
This is a rather poor tutorial, and combined with being dated it would be advisable to look elsewhere for tutorials and examples such as: