노력과 삽질 퇴적물

AS3: 클래스와 생성자 본문

프로그래밍note/언어. 스크립트 계열

AS3: 클래스와 생성자

알 수 없는 사용자 2011. 5. 16. 23:33
* 개발환경: FlashDevelop 3.3.4

생성자라는 개념이 JAVA나 C++에도 있어서 AS3에 한정된건 아님.

package 
{
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.Event;

/** @author MTG **/

public class As3_ex extends Sprite 
{
private var text_str:TextField;
public function As3_ex():void //생성자: 클래스와 동명, 반환타입 기술X
       //괄호내 매개변수가 없는게 생성자.
{
this.text_str = new TextField;
this.text_str.autoSize = "center";
this.text_str.border = true;
this.text_str.background = true;
}
private function im_ant():void 
{
this.text_str.text = "Hello_World!";
this.addChild(this.text_str);
}
}
}


'프로그래밍note > 언어. 스크립트 계열' 카테고리의 다른 글

AS3: 소켓통신  (0) 2011.05.17
AS3: 여러개의 패키지  (0) 2011.05.17
AS3: 언제나의 Hello_World!  (0) 2011.05.16
AS3: flashdevelop프로젝트 생성, 빌드  (0) 2011.05.15
AS3: 클래스 사용하기  (0) 2011.05.05