all groups > flash actionscript > october 2005 >
You're in the

flash actionscript

group:

passing references to functions


passing references to functions etg7
10/13/2005 9:58:07 PM
flash actionscript:
Hi all,
I have an interface and a class that pass a reference to the other in a
function like this...

import package.you;
class me{

public function me(){}
public function addAYou(y:you){}

}

import package.me;
interface you{

public function changeMe(m:me){}

}

...i keep getting an error that it can't load the class....if i take out the
reference, it compiles fine...can anyone help??

Re: passing references to functions LuigiL
10/14/2005 7:41:05 AM
Re: passing references to functions etg7
10/14/2005 8:56:44 PM
Re: passing references to functions LuigiL
10/15/2005 12:00:00 AM
Well, you don't. An interface - basically - is an like an agreement. A class
that implements the interface agrees to implement the methods defined in the
interface. The coding should look like this:

class me implements you {
function addAYou(person:String){
trace("You");
}
}

interface you {
function addAYou(person:String);
}

The interface - basically - is just a list of methods. It doesn't provide an
implementation for the datatype, meaning you can't define properties and
methods like in a class. You can't include curly braces with the methods. But
there is a lot more to interfaces. Just read up on the topic.
AddThis Social Bookmark Button