티스토리 뷰
728x90
반응형
기존엔 StageRefer라는 클래스를 만들어서
public static var stage:Stage;
라고 static 변수에 대입하여 접근하는 방식을 취하였었다~
하지만 아래클래스와 같이 수정해보았다.
( 물론 외쿡분의 라이브러리를 배껴서 우아하게 조금? 수정해 보았다~ㅋㅋ )
public static var stage:Stage;
라고 static 변수에 대입하여 접근하는 방식을 취하였었다~
하지만 아래클래스와 같이 수정해보았다.
( 물론 외쿡분의 라이브러리를 배껴서 우아하게 조금? 수정해 보았다~ㅋㅋ )
package oddeye.utils { import flash.display.Stage; /** * ... * @author .... */ public class StageRefer { public static const STAGE_ID:String = "stageID"; private static var _stageKey:Object; public static function getKey():Object { if ( StageRefer._stageKey == null) StageRefer._stageKey = { }; return StageRefer._stageKey; } /** * 초기에 stage 자체를 대입. 그래야 StageRefer.getStage()로 어디서든지 stage를 접근할 수 있다. * @param stage * @param id */ public static function setStage( stage:Stage, id:String=StageRefer.STAGE_ID ):void { StageRefer.getKey()[id] = stage; } /** * stage에 접근한다. * @param id * @return */ public static function getStage( id:String=StageRefer.STAGE_ID ):Stage { if ( StageRefer.getKey()[id] == null ) throw new Error( "StageRefer클래스에서 에러::Stage값이 없습니다.\n Document class에서 StageRefer.setStage()에 stage값을 대입하세요~" ); return StageRefer.getKey()[id]; } } }
728x90
반응형
'Programming language > Flash' 카테고리의 다른 글
mac에서 MouseEvent.MOUSE_WHEEL 적용하기.. (0) | 2012.02.08 |
---|---|
XML에서 이스케이프 시퀀스 삭제해버리기~ ㅎ (0) | 2012.02.08 |
getBounds(targetCoordinateSpace:DisplayObject) 요놈 물건이네~ (0) | 2012.02.08 |
나만 유용한 클래스3~ DepthUtils.as (0) | 2012.02.08 |
나만 유용한 클래스2~ FlashVarUtils.as (0) | 2012.02.08 |
댓글
250x250
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- react
- 태그
- RefreshToken
- 자바스크립트
- React.StrictMode
- svg 폰트
- CSS
- Vue3
- for of 구문
- 아이콘 폰트 만들기
- 반복문
- svg icon font
- icon font
- Angular
- cordova
- Aptana
- 리프래시토큰
- git checkout -b
- anime.js
- git
- 앵귤러
- IntrinsicElements
- Intrinsic
- svg모션
- interceptors
- vue-router
- 코도바
- react-router-dom
- JsDoc
- 내장요소
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
글 보관함