[FlashVar]as3 에서 HTML parameter 받기
HTML 에서 값을 넘길수가 있다.
워낙 브라우져를 싫어 하던 터라... 이런게 존재한다는것도 몰랐다.
보통 임베디드나 외부 연동할때는 익스터널이나 소켓으로 받거나 주는데,,
이런기능이 있다니,., 간편하긴 하다.
먼져 HTML 단에서는.
<body>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="651" height="407" id="FlashID" title="paramTest">
<param name="FlashVars" value="PARAM1=KOREA&PARAM2=USA&PARAM3=UK3"/>
이다.
여기서 보면 추억의 txt 파일에서 변수를 불러 오던 시절의 "&" 가 생각난다.
그와 마찮가지로 문자열에
" 파라미터 = 값 & 파라미터 =값 ... "
으로 쭉~ 적어주자
body 밑에 object classid 밑에 넣어 주면 된다 .
일단 보면 param 태그가 여럿 있다. 거기에 하나로 넣어 주면 된다.
as3 에서는
private var _param:Object; private var str:String; public function testParam() { _param = stage.loaderInfo.parameters; var Tx:TextField = new TextField; addChild(Tx); Tx.width = stage.stageWidth; for each(var getValue in _param) { str = getValue; Tx.appendText(str + "\n"); } }
와 같이 쉽게 얻을수 있다.
아웃은
와 같이 된다.
그리고 for each 안에는 지정된 파라미터 값을 검출 하는 if 처리를 해서 써도 되고
편한대로 배열에 넣어서 사용해도 무방 하겠다.
그리고 중요한것은 html 에서 파라미터를 넘겨주지 않았을 경우를 대비하여
undefined 나 null 이 올경우를 대비하여 기본값을 처리할것들도 만들어 줘야 하겠다.
그리고 이건 빌더에서 F11로 디버깅 해서 생성되는 html 에 넣으면 당연 안된다 ., 매번 초기화 된다.
그래서 따로 만든 html 에 swf넣고 테스트 해야 한다.
stage 에 loaderinfo 는 avm 이 실행되기전 환경에 대한 초기화를 한다.
그중 하나가 FlashVar를 받는 parameters 인데 구지 html이 아니라 다른 응용프로그램에서도
작동을 한다.
아쉬운점은 swf 안에 swf를 불러올때, 부모의 stage.loaderinfo 만 실행되면 되는데,
자식의 불필요한 loaderinfo 도 실행된다., 이것은 stage, 곧 DisplayObject 들이고,
플래시에서는 정확한 시작점 클래스가 없어서 이러한 불필요한 전처리가 중복적으로 나타나고 있다.
뭐 ., 아니면 말고,
-
시작점 클래스에 대해 2009/12/18 14:34 # 삭제
시작점 클래스란 어플리케이션에서 최초에 시스템이 실행하는 클래스를 말합니다. 진입 클래스라고 하고 자바의 키워드 그대로 메인 클래스라고도 자주 부르죠. 만일 시작점이 되는 클래스가 없다면 모든 OOP언어는 최초에 클래스를 실행시킬 방법이 없습니다. 따라서 크게 두 가지로만 클래스를 분리하라 하면 시작점 클래스와 그 외의 클래스로 나누는 것이 타당합니다. 시작점 클래스가 특별한 이유는 모든 클래스는 결국 또 다른 클래스에 의해 생성되거나 사용시...... more
'AS3' 카테고리의 다른 글
[as3 byteArray]오브젝트 변환과 복제 와 전송 (114) | 2010.12.04 |
---|---|
[Wsocket] Socket GUI 클래스 (135) | 2010.12.04 |
[FlashVar]as3 에서 HTML parameter 받기 (82) | 2010.12.04 |
[drawTriangles] 가장?쉬운 삼각형 응용 예제 (37) | 2010.12.04 |
[bitmapData Capture] stage capture 시 유의점 (78) | 2010.12.04 |
[beginBitmapFill] 연속되는 이미지 만들기 (49) | 2010.12.04 |
댓글을 달아 주세요
- 이전 댓글 더보기
-
vetement burberry 2015.03.27 21:10 수정/삭제 댓글쓰기
상로chinoise principalement dans une très forte de saisir des informations de première main| | Shang le nord et le nord - Ouest L'avion s'est écrasé au Japon et Boeing 747sr est la ligne de charge de courte portée spécialisé pour la machine de graves retards de la situation ma femme"""Salope" le héros de duffle coat burberry l'intégrit&eac다로
-
匿名 2015.03.31 08:50 수정/삭제 댓글쓰기
알한Needs TLC: It was totaled in a fire,The Death of the Home Compute
Cozy: Small
Owner Must Sell: Duh!
Privacy: Overgrown bushes
View Lot: View of the lot next door
Upgraded Flooring: New area rugs from Walmart
Three-Car Garage: If one of them is a motorcycle
Model Home: If you happen to be Twiggy
Remodeled: Repainted
Executive Home: Incl뉴관 -
匿名 2015.04.03 13:49 수정/삭제 댓글쓰기
일되In fact, AIRMAX and not stand still, today we join in the use of special powers of the Nike Air Max 2009 sale, AIRMAX identification of a new era to create. Nike Air Max 2009 sale, the use of a feature of the technology of today's most ardent Flywire.
Although the use of new technologies and maintaining AIRMAX traditional shoe design line of the body, new technology and tradition in the col련가 -
匿名 2015.04.03 17:37 수정/삭제 댓글쓰기
겠뉴Hold on a moment though, before you go doling out that credit card number. Have you considered the safety of the purchase, such as, have you made sure that...
you are on a secure site
you fully understand what it is you are buying
you have read any "terms and conditions" that may be present but not obvious, on the page before you purchase, or agree to any trial offers.
Yes, the inte마일 -
匿名 2015.04.04 02:54 수정/삭제 댓글쓰기
네없and even better news is that their greatest extent EVER!Beautiful flowers and fittings add a touch of tartan jackets that unmistakable feminine essence, while injections of red.
Purple and orange make this the biggest ever range of colors.Barbour waxed jackets, Barbour International Quilt Jacket, Jackets Barbour Polar Quilt .
Coffee shops are offered in many sizes and designs, but all 지마
덧글