Hello :)
i forget ... you can transform your expression too with [] notation :
import ConcreteClass;
import Interface;
var tmp:Interface = new ConcreteClass();
tmp[bar]() ; // works too
EKA+ :)
2006/6/15, Mark Lapasa [EMAIL PROTECTED]:
Thanks EKA and JC for your answers.
I -kinda- knew that was the answer but I wanted to know if there was
another
way.
Casting/trantyping an abstract object down into one of a concrete type
seems
like to me very self-defeating to use abstractions as a data type.
I might as well say
var tmp:ConcreteClass = new ConcreteClass();
tmp.bar();
as JC has mentioned and forget about the low-coupling flexibility of using
interfaces. I imagined the inital route I wanted to go ought to work at
run-time but the compiler is not forgiving.
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Hans
Wichman
Sent: Wednesday, June 14, 2006 5:52 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Accessing non-interface methods from an
object ofan interface type
The compiler sees an object of type Interface which does not support the
method you are trying to call. Either use:
var tmp:ConcreteClass = new ConcreteClass();
or
var tmp:Interface = new ConcreteClass();
ConcreteClass(tmp).bar();
grtz
JC
On 6/14/06, Mark Lapasa [EMAIL PROTECTED] wrote:
///
// Inside Interface.as //
///
interface Interface
{
public function foo():Void;
}
///
// Inside ConcreteClass.as //
///
import Interface;
class ConcreteClass implements Interface
{
public function foo():Void { trace(Foo was fired);}; // As
required by
the interface
public function bar():Void { trace(Bar was fired);};
}
///
// Inside the Test.FLA //
///
import ConcreteClass;
import Interface;
var tmp:Interface = new ConcreteClass();
tmp.foo(); // Works
tmp.bar(); // Doesn't Work, why?
I don't think all the public ConcreteClass methods have to be listed in
an
interface.
Has anyone else come across this problem? Thx,
-mL
http://knowledge.lapasa.net
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com