Hi
Im trying to instantiate a class called Favourites_panel1 from FavouritesPanel.
Im passing an argument into FavouritesPanel to call te relevant class for which style of panel to create.
Im getting this error when attempting it…
Quote:
TypeError: Error #1007: Instantiation attempted on a non-constructor.
The code for each class is below…
FavouritesPanel.as
Code:
package {
import flash.display.Sprite;
import favourites_classes.*;
public class FavouritesPanel extends Sprite {
private var _type:String;
function FavouritesPanel($type:String = 'Favourites_panel1') {
// different type for different sections
_type = $type;
init();
}
private function init():void {
var targetClass:String = String(_type);
var duplicate:* = new [targetClass]();
}
}
}
And this is the class tat extends the above, and that want instantiated when the above tries to…
Favourites_panel1.as
Code:
package favourites_classes {
public class Favourites_panel1 extends FavouritesPanel {
function Favourites_panel1() {
trace(' i have been ccreated');
}
}
}
ANy help is greatly appreciated!!