[결과]
1
2
EX : string : wonsama
EX : object : b,a,wow

... 을 사용하여 여러가지 인수를 받을 수 있다.

'기타 > Old' 카테고리의 다른 글

GOP : Group of pictures  (0) 2008.04.23
W카운터 소드 (adjet.js) 들여다 보기  (0) 2008.04.18
get set : 오버라이드를 해보자  (0) 2008.04.18
if문에서 활용안.  (0) 2008.04.17
with 구문  (0) 2008.04.17

[결과]
3

Flash는 현재 오버라이드를 지원하고 있지 않다. 하지만 set, get 을 사용하면 오버라이드를 구현할 수 있다.

'기타 > Old' 카테고리의 다른 글

W카운터 소드 (adjet.js) 들여다 보기  (0) 2008.04.18
함수에서 여러가지 값을 입력받기  (0) 2008.04.18
if문에서 활용안.  (0) 2008.04.17
with 구문  (0) 2008.04.17
for each  (0) 2008.04.16
[if문의 오류 범하기 확인대안]
if(k==2) 를 if(k=2) 이런식으로 입력하면 컴파일 단에서 버그를 찾을 수 없다.

하지만....

if(2==k), 오타 if(2=k)
이런식으로 반대로 입력하는 습관을 갖는다면 컴파일 상에서 에러를 손쉽게 찾아 낼 수 있다.

[조건문의 배치방안]
if문에서 || (or 연산자) 사용시에는 앞에 틀릴 확률이 높은 조건문을 배치한다.
그러면 다음 조건을 행하지 않는 경우도 있다.(CPU에 따라 약간씩 차이남.)

'기타 > Old' 카테고리의 다른 글

함수에서 여러가지 값을 입력받기  (0) 2008.04.18
get set : 오버라이드를 해보자  (0) 2008.04.18
with 구문  (0) 2008.04.17
for each  (0) 2008.04.16
for in 구문  (0) 2008.04.16

[결과]
반지름이 1일때 원의 넓이 = 3.14
반지름이 2일때 원의 넓이 = 12.57
반지름이 3일때 원의 넓이 = 28.27
반지름이 4일때 원의 넓이 = 50.27
반지름이 5일때 원의 넓이 = 78.54

with
해당 블럭내에서 object명이나 type을 생략하여 사용할 수 있다.

'기타 > Old' 카테고리의 다른 글

get set : 오버라이드를 해보자  (0) 2008.04.18
if문에서 활용안.  (0) 2008.04.17
for each  (0) 2008.04.16
for in 구문  (0) 2008.04.16
실행시간 시간차이 구하기  (0) 2008.04.16
[결과]
1111
2222
3333

for each
메모리 단위로 이동하므로 속도가 빠르다.
캐쉬(최근 사용 데이터)를 사용한다.

'기타 > Old' 카테고리의 다른 글

if문에서 활용안.  (0) 2008.04.17
with 구문  (0) 2008.04.17
for in 구문  (0) 2008.04.16
실행시간 시간차이 구하기  (0) 2008.04.16
as, is, instanceof 연산자  (0) 2008.04.16
[결과]
two 2
one 1
three 3

이건쫌 이상한 거 같네 ;;
===================================================================

[Flash] http://wonsama.tistory.com/attachment/ek190000000001.swf



[결과]

0 one
1 two
2 three

성능은 그렇게 좋지 않다고 함.
특징이라면 Array의 사이즈를 구하지 않아도 됨.

하지만 Array의 length 프로퍼티를 구함 되니 뭐.. ㅡ,.ㅡ;
그닥 좋지는 않은듯..

'기타 > Old' 카테고리의 다른 글

with 구문  (0) 2008.04.17
for each  (0) 2008.04.16
실행시간 시간차이 구하기  (0) 2008.04.16
as, is, instanceof 연산자  (0) 2008.04.16
타입 캐스팅  (0) 2008.04.16

[Flash] http://wonsama.tistory.com/attachment/ek190000000000.swf


[결과 - 컴터 성능에 따라 차이남]
49995000
250

함수 실행 전후에 getTime 메소드를 넣어주면 된다.

'기타 > Old' 카테고리의 다른 글

for each  (0) 2008.04.16
for in 구문  (0) 2008.04.16
as, is, instanceof 연산자  (0) 2008.04.16
타입 캐스팅  (0) 2008.04.16
변수 관련 기초 공부  (1) 2008.04.16
as 
operator  
Usage

expression as datatype
Language version: ActionScript 3.0
Player version: Flash Player 9

Evaluates whether an expression specified by the first operand is a member of the data type specified by the second operand. If the first operand is a member of the data type, the result is the first operand. Otherwise, the result is the value null.

The expression used for the second operand must evaluate to a data type.

Operands

expression:* — The value to check against the data type specified.

datatype:Class — The data type used to evaluate the expression operand. The special * type, which means untyped, cannot be used.
Result

Object — The result is expression if expression is a member of the data type specified in datatype. Otherwise, the result is the value null.

Example
How to use examples
The following example creates a simple array named myArray and uses the as operator with various data types.
public var myArray:Array = ["one", "two", "three"];
trace(myArray as Array); // one,two,three
trace(myArray as Number); // null
trace(myArray as int); // null

===================================================================================================
is  
operator  
Usage

expression1 is expression2
Language version: ActionScript 3.0
Player version: Flash Player 9

Evaluates whether an object is compatible with a specific data type, class, or interface. Use the is operator instead of the instanceof operator for type comparisons. You can also use the is operator to check whether an object implements an interface.

Result

Boolean — A value of true if expression1 is compatible with the data type, class, or interface specified in expression2, and false otherwise.

Example
How to use examples
The following example creates an instance of the Sprite class named mySprite and uses the is operator to test whether mySprite is an instance of the Sprite and DisplayObject classes, and whether it implements the IEventDispatcher interface.
import flash.display.*;
import flash.events.IEventDispatcher;

var mySprite:Sprite = new Sprite();
trace(mySprite is Sprite); // true
trace(mySprite is DisplayObject); // true
trace(mySprite is IEventDispatcher); // true

===================================================================================================
instanceof  
operator  
Usage

expression instanceof function
Language version: ActionScript 3.0
Player version: Flash Player 9

Evaluates whether an expression's prototype chain includes the prototype object for function. The instanceof operator is included for backward compatibility with ECMAScript edition 3, and may be useful for advanced programmers who choose to use prototype-based inheritance with constructor functions instead of classes.

To check whether an object is a member of a specific data type, use the is operator.

When used with classes, the instanceof operator is similar to the is operator because a class's prototype chain includes all of its superclasses. Interfaces, however, are not included on prototype chains, so the instanceof operator always results in false when used with interfaces, whereas the is operator results in true if an object belongs to a class that implements the specified interface.

Note: The ActionScript is operator is the equivalent of the Java instanceof operator.

Operands

expression:Object — The object that contains the prototype chain to evaluate.

function:Object — A function object (or class).
Result

Boolean — Returns true if the prototype chain of expression includes the prototype object for function, and false otherwise.

Example
How to use examples
The following example creates an instance of the Sprite class named mySprite and uses the instanceof operator to test whether the prototype chain of mySprite includes the prototype objects of the Sprite and DisplayObject classes. The result is true with the Sprite class and the DisplayObject class because the prototype objects for Sprite and DisplayObject are on the prototype chain of mySprite.
var mySprite:Sprite = new Sprite();
trace(mySprite instanceof Sprite); // true
trace(mySprite instanceof DisplayObject); // true
The following example uses the IBitmapDrawable interface to show that the instanceof operator does not work with interfaces. The is operator results in true because the DisplayObject class, which is a superclass of the Sprite class, implements the IBitmapDrawable interface.
var mySprite:Sprite = new Sprite();
trace(mySprite instanceof IBitmapDrawable); // false
trace(mySprite is IBitmapDrawable); // true

'기타 > Old' 카테고리의 다른 글

for in 구문  (0) 2008.04.16
실행시간 시간차이 구하기  (0) 2008.04.16
타입 캐스팅  (0) 2008.04.16
변수 관련 기초 공부  (1) 2008.04.16
OOP ?일까나....  (0) 2008.04.16

[결과]
true
string

is 구문으로 타입 캐스팅 가능 여부 확인 이후 as 구문으로 타입 캐스팅을 실시해 준다.

'기타 > Old' 카테고리의 다른 글

실행시간 시간차이 구하기  (0) 2008.04.16
as, is, instanceof 연산자  (0) 2008.04.16
변수 관련 기초 공부  (1) 2008.04.16
OOP ?일까나....  (0) 2008.04.16
addChildren의 특성 테스트  (0) 2008.04.16


결과 :

<type name="int" base="Object" isDynamic="false" isFinal="true" isStatic="false">
  <extendsClass type="Object"/>
  <constructor>
    <parameter index="1" type="*" optional="true"/>
  </constructor>
</type>

결과값이 하나만 출력된 것을 볼 수 있다. 그러므로 올바르게 설정하려면...

var t1:int, t2:int, t3:int; 이런식으로 설정해 줘야만 한다.

참조 1)

//strict 형태 모드
var c:int;
c=3.3;
trace(describeType(c));

//standard 형태 모드
- type을 지정하지 않아 대형 프로젝트에서는 늦어질 수 있음.
var c;
c=3.3;
trace(describeType(c));

결론 : strict 모드로 코딩하는 습관을 가져야 한다.

참조 2)
override : 상속 등에 사용되는 것임.
overload : 파라미터에 의존적. 함수명 동일 입력 변수가 다른 함수 등

참고로 현재 AS3에서는 overload는 지원하고 있지 않음에 유의한다.


'기타 > Old' 카테고리의 다른 글

as, is, instanceof 연산자  (0) 2008.04.16
타입 캐스팅  (0) 2008.04.16
OOP ?일까나....  (0) 2008.04.16
addChildren의 특성 테스트  (0) 2008.04.16
흥분한다면.... ?  (0) 2008.04.16

+ Recent posts