forked from: 継承
/**
* Copyright hacker_yk666qry ( http://wonderfl.net/user/hacker_yk666qry )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/4b66
*/
// forked from hacker_yk666qry's 継承
// forked from hacker_nekomaru's flash on 2009-2-24
package {
import flash.display.Sprite;
import flash.events.*;
import flash.utils.*;
public class FlashTest extends Sprite {
public function FlashTest() {
init();
}
public function init():void {
var test:ITest;
test = new CTest2();
addChild( test.getSprite() );
}
}
}
import flash.display.Sprite;
interface ITest{
function getSprite():Sprite
}
class CTest implements ITest{
public function getSprite():Sprite{
var temp:Sprite = new Sprite();
temp.graphics.beginFill( 0xffcc00 , 1 );
temp.graphics.drawRect( 100,100,60,60 );
temp.graphics.endFill();
return temp;
}
}
class CTest2 implements ITest{
public function getSprite():Sprite{
var temp:Sprite = new Sprite();
temp.graphics.beginFill( 0xaadd77 , 1 );
temp.graphics.drawCircle( 200,200,80 );
temp.graphics.endFill();
return temp;
}
}