I'm having an issue. At first, I thought it was the inheritance bug (unsure if this was fixed in 7.2). However, it doesn't appear to be that after all. Here's some code:
// Doesn't Work
// class shell
private var m_Display:Display;
public function Shell()
{
var overload:Overload = new Overload();
overload.addHandler( [Display], ShellByOneDisplay );
overload.forward( arguments );
}
Your problem is in your overload declaration I think...
When you declare your overload, you have to define what you 're going to overload...
So your line :
----------------------------------------------
var overload:Overload = new Overload();
----------------------------------------------
must be tranformed in :
----------------------------------------------
var overload:Overload = new Overload(this);
----------------------------------------------
And all works well now ;)
I have test it with these classes :
----------------------------------------------
import org.as2lib.env.overload.*;
class Shell
{
private var m_Display:Display;
public function Shell() {
var overload:Overload = new Overload(this);
overload.addHandler([], ShellByDefaultDisplay );
overload.addHandler([Display], ShellByOneDisplay );
overload.addHandler([String], ShellByOneStringDisplay)
overload.forward(arguments);
}
public function getDisplay(Void) : Display {
return m_Display;
}
private function ShellByOneDisplay(inDisplay:Display) : Void {
m_Display = inDisplay;
}
private function ShellByOneStringDisplay(sDisplay:String) : Void {
m_Display = new Display(sDisplay);
}
public function ShellByDefaultDisplay(Void) : Void {
m_Display = new Display();
}
}
----------------------------------------------
And it's Ok....
Bye !
eRom.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi and thanks for the great Library.
I'm having an issue. At first, I thought it was the inheritance bug (unsure if this was fixed in 7.2). However, it doesn't appear to be that after all. Here's some code:
// Doesn't Work
// class shell
private var m_Display:Display;
public function Shell()
{
var overload:Overload = new Overload();
overload.addHandler( [Display], ShellByOneDisplay );
overload.forward( arguments );
}
private function ShellByOneDisplay(inDisplay:Display):Void
{
this.m_Display = inDisplay;
trace( 'shell display = ' + m_Display ); // displays [type Display]
}
// Application
var display:Display = new Display();
var shell:Shell = new Shell(display);
trace( shell.display ); // undefined
If I just set the property in the constructor, then everything is set fine, and I can trace out the [type Display] in the application.
Any ideas on why this is not setting the property correctly? Thanks.
Hi,
Your problem is in your overload declaration I think...
When you declare your overload, you have to define what you 're going to overload...
So your line :
----------------------------------------------
var overload:Overload = new Overload();
----------------------------------------------
must be tranformed in :
----------------------------------------------
var overload:Overload = new Overload(this);
----------------------------------------------
And all works well now ;)
I have test it with these classes :
----------------------------------------------
import org.as2lib.env.overload.*;
class Shell
{
private var m_Display:Display;
public function Shell() {
var overload:Overload = new Overload(this);
overload.addHandler([], ShellByDefaultDisplay );
overload.addHandler([Display], ShellByOneDisplay );
overload.addHandler([String], ShellByOneStringDisplay)
overload.forward(arguments);
}
public function getDisplay(Void) : Display {
return m_Display;
}
private function ShellByOneDisplay(inDisplay:Display) : Void {
m_Display = inDisplay;
}
private function ShellByOneStringDisplay(sDisplay:String) : Void {
m_Display = new Display(sDisplay);
}
public function ShellByDefaultDisplay(Void) : Void {
m_Display = new Display();
}
}
----------------------------------------------
And it's Ok....
Bye !
eRom.
Yes, that was my error. Thanks eRom. I appreciate it.