Basics of classes

I’m trying to figure out how to stop an external child swf from streaming. How ever it seems I’m not understanding the custom classes at all. I tried to have a simple Hello world application made, but it gives me this error:

1137: Incorrect number of arguments. Expected no more than 0

The code is straight from Flash help files. The Helloworld.swf has a small dynamic text field called mainText. Do I need to attach the class or what should I do?

Greeter.as:
package
{
public class Greeter
{
public function sayHello():String
{
var greeting:String;
greeting = “Hello World!”;
return greeting;
}
}
}

Helloworld.swf:
var myGreeter:Greeter = new Greeter();
mainText.text = myGreeter.sayHello(“Bob”);

You’ll need to tell us a bit more than that to help you. Like what is the content of your hello world class, and how are you instantiating it?

This is how ignorant I am with classes… Is there something else I need to have, other than the as-file and the swf-file? Swf-file should instantiate the class with this:

var myGreeter:Greeter = new Greeter();
mainText.text = myGreeter.sayHello(“Bob”);

At least that’s what I thought it would do…

Your problem lies here:
public function sayHello():String
It isn’t expecting anything passed to it, but you are passing it “bob”. I assume you want to use “bob”, like print out “Hello Bob” maybe?

If so, change the function to:

public function sayHello(name:String):String
{
var greeting:String;
greeting = "Hello " + name;
return greeting;
}

I thought I was missing out something cruzial in understanding classes… Well it was an error with the code.
Thanks a lot guys!!!