[결과]
반지름이 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

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



파일명은 패키지의 클래스명과 일치해야 함에 유의해야 한다.

위와 같은 형태로 패키지를 작성한 이후 Flash에서 사용하려면....

var cal:Calculator = new Calculator();
trace(cal.SUM(14,2));

그럼 결과가 16 나온다.

여기서 cal 은 인스턴스 및 변수, Calculator은 Type이라 명명한다.
이것을 바로 OOP적인 방법으로 코딩하는 것임. 즉 Type을 Instance 化 하여 사용하는 것이다.

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

타입 캐스팅  (0) 2008.04.16
변수 관련 기초 공부  (1) 2008.04.16
addChildren의 특성 테스트  (0) 2008.04.16
흥분한다면.... ?  (0) 2008.04.16
NAT  (0) 2008.04.15
기본적으로 플레시 화면에 2개의 무비클립을 추가시켜준 이후에 컴파일 해준다.

결과

stage.numChildren : 1
this.numChildren : 2
===================
ADD
stage.numChildren : 2
this.numChildren : 1

결론 :

ㄱ. add하면 하나 빠지네 ㅡ,.ㅡ;
ㄴ. 구조
Stage - MainTimeline - 무비클립 : 메인 타임라인 위에 스테이지가 있네 ㅋㅋ

기타 :

hash table
: key, value 형태로 되어있음.

cs3에서는 non-dynamic 형태로 바뀌면서 속도가 증가됨
(이전에는 dynamic이여서 runtime에서 타입이 결정됨.)
(non-dynamic compile단계에서 타입이 결정되므로 속도가 빠름.)

ctrl+F8 : create new symbol

dynamic일 경우(무비클립...)에는 hashtable 사용가능
PP.kk=30;
trace(PP.kk);
trace(PP["kk"]); => 해쉬 테이블 형태로 호출하는것이 속도가 빠르다.

trace(describeType(PP)); 위에서 생성한 무비클립의 타입을 상세 보여준다.

:: 범위 연산자(Arrage Operator)
ex) flash.display::MovieClip => MovieClip은 flash.display의 패키지 소속이다.

isDynamic => hash table 사용여부
isFinal => 상속 가능 여부

implementsInterface (구현상속)
accessor 속성값

metadata
fla -> swf : 컴파일 단계에서 명령을 주는 것임.

쩝.. 아직 갈길이 멀다 멀어 ;;




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

변수 관련 기초 공부  (1) 2008.04.16
OOP ?일까나....  (0) 2008.04.16
흥분한다면.... ?  (0) 2008.04.16
NAT  (0) 2008.04.15
DMZ란?  (0) 2008.04.15
사용자 삽입 이미지

헐... 이렇게 되지 않을까나 ? ㅋㅋ

출처 : Soul Eater 2화 스크린 샷뚜~

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

변수 관련 기초 공부  (1) 2008.04.16
OOP ?일까나....  (0) 2008.04.16
addChildren의 특성 테스트  (0) 2008.04.16
NAT  (0) 2008.04.15
DMZ란?  (0) 2008.04.15

+ Recent posts