Study/Actionscript 3.02009. 3. 7. 19:39
http://wooyaggo.tistory.com/80




Posted by chacolina
Study/Actionscript 3.02009. 3. 5. 21:02
FLV에 관하여 알아봅시다.


1.  Streaming 이란?
2.  Progressive vs Non progressive
3. 실시간 동영상/음악 서비스  vod aod 일 경우 중요한 2가지 요소 ( Ordering / Jitter )

1.Streaming 이란?
-Stream : 흐름 (액체 및 기체와 같은 물질의 움직임을 그 예로 들 수 있다.)
액체와 기체의 특징 중 하나는 일부 만으로도 그 의미를 가진다.
즉 마카의 한 부분인 마카 뚜껑은 마카라고 이야기 할 수 없으나 물은 부분을 취한다 할지라도 그것 또한 물이다.
하지만 그 일부라는 것은 최소한의 단위가 있는데 물의 경우는 H2O 물분자 일 것이다.

-그렇다면 플래쉬는 streaming인가?
플래쉬는 스트리밍이다. 즉 swf는 스트리밍이라는 뜻이며 스트리밍의 최소단위는
"root의 프레임" 단위이다.

-플래쉬가 스트리밍이며 최소단위가 root의 프레임이라는 것을 증명해보자.
먼저 플래쉬를 열여 root에 3개의 키프레임을 만든 후 각각 다른 이미지를 올려놓는다.
그 상태에서 test movie를 누르고 view > simulate download 를 누르자.





결과를 보면 swf 화면에 바로 이미지들이 바로 한장한장 로드되다가 모든 사진이 로드되면 정상 플레이되는 것을 알 수 있다.



다음은 플래쉬를 열여 root에 1개의 빈 무비클립을 만들고 무비클립 안에 3개의 키프레임을 만든 후
각각 다른 이미지를 올려놓는다.
그 상태에서 test movie를 누르고 view > simulate download 를 누르자.

이 경우는 한동안 빈 화면의 swf가 지속되다가 일정 시간 후 정상 플레이되는 것을 볼 수 있다.



결과적으로
root에 직접 키프레임이 있는 것은 2프레임 이상 모두 로딩 안되어도 1프레임을 먼저 보여준다.
반면 무비클립 안에 키프레임이 있는 것은 모든 이미지가 로딩이 되기 전까지 플레이가 안된다.
그러므로 root에 이미지를 직접 뿌려주는 것이 더 빠르며 플레쉬의 가장 기본 단위는 root의 프레임이라는 것을 알 수 있다.
(한가지 더 중요한 것은 무조건 무비클립을 쓸 것이 아니라 필요에 따라 root에 직접 노출하는 방식도 활용할 줄 알아야 한다는 것이다.)



2.Progressive vs Non progressive and FMS(FLASH MEDIA SEVER)

플래쉬는 기본적으로 progressive 즉 순차적으로 다운로드 되면서 진행하는 방식만 취하고 있다.
그러므로 FLV 또한 스트리밍 으로 progressive 방식을 기본으로 하고 있지만 Non progressive를 지원하는 스트리밍이라는 특징을 가지고 있다. 다시말하면 진행 중 "Skip" 기능이 가능하다는 것이다.

non- progressive (중간에 스킵하려면 )하기 위한 조건 !!!!
non- progressive 하려면 "30분 이후 내용 부터 주세요" 라는 식의 요청을 수행 할 수 있어야 한다.
즉 서버가 동영상을 분석하거나 편집할 수 있는 능력이 있어야 하는데 FMS를 이용하면 있으면 가능하다.

<참고>
FMS 란?? (FLASH MEDIA SEVER)--->최근에는 FMS, FMIS 둘로 나뉘어졌다.
RED5....



3. 실시간 동영상/음악 서비스  VOD / AOD 일 경우 중요한 2가지 요소 ( Ordering / Jitter )
1.Ordering (영상이 순서대로 전송 되어야 한다.)
2.Jitter (영상과 영상사이의 간격)


경로가 정해져있지 않으면 먼저 출발한 패킷이 나중에 출발한 패킷보다 빠르게 전송될 수 있다.
또한 출발 간격이 일정하지 않으면 흐름상 혼란이 일어날 수 있다.

그러므로

==>컨텐츠들이 "순서대로" "일정 간격"으로 전송되어야 하고 중간중간에 관리자의 역할이 필요하다.

(방법정리)
1.길 만들기 :: 순서 --> NetConnection
2.흐름관리::  흐름관리(댐관리)-->NetStream
3.화면 :video







Posted by chacolina
Study/Visualizing Data2009. 3. 5. 19:55
Overview
1.preprocessing
     (Data is always dirty, and once you’ve found your data set, you’ll need to clean it up.)
2.Loading the Data (Acquire and Parse)
     (A single location will be defined using a second class named Place.)
3.Drawing a Scatterplot of Zip Codes (Mine and Represent)
     (After parsing your data, you must give some consideration to how the data is mapped to the screen.)
4.Highlighting Points While Typing (Refine and Interact)
     (the focus is now to add interaction so that users can explore how the postal codes relate to          
     geography./The refinement stage begins with choosing a set of colors.)
5.Show the Currently Selected Point (Refine)
    (we’ll show the location of a fully typedout, five-digit zip code as a rectangle and add text to its    
     upper-right corner that names the location.)
6.Progressively Dimming and Brightening Points (Refine)
     (a class called ColorIntegrator does the same, but interpolates between two colors. Instead of a    
     float, the ColorIntegrator.target( ) method takes a color.)
7.Zooming In (Interact)
     (the crux of the representation is the map( ) function, which remaps a series of coordinates (with a   
      predefined range) to a specific location on the screen (with a new range))
8.Changing How Points Are Drawn When Zooming (Refine)
     (points should become larger as more digits are typed.)
9.Deployment Issues (Acquire and Refine)
     ( A better alternative is to use the built-in Thread class to load the data asynchronously.)
10.Next Steps
     (several directions in which to take this project.)

Detail
1.DBF file을 받아 데이터를 정리하는 방법
1차 DBF->excel/open office 로 열기->CSV,TSV로 저장->
2차 ->PROCESSING+FITS+CSV(TSV) WITH 8 ISSUES->최종결과치->최종 CLEANED FILE 얻기

2,새로운 텝을 열어 place class를 만들기
pasing을 위해 readData( ) parseInfo( )parsePlace( ) method 이용하기
readData( )->데이터 읽어들이기
parseInfo( )->데이터 파일의 첫번째 single line 분석 with comma (파일개수/위도,경도의 최대 최소값)
parsePlace( )->나머지 single line 분석 with tap

3.map()을 이용하여 stage 내 특정 영역에 데이터 뿌리기

4.입력 텍스트와 관련한 변수,method, array 지정/ keypress handling /depth 와 color를 입력 텍스트 상태에 따라서 match 시키기

char typedChars[] = new char[5];  letters typed
int typedCount; number of digits entered.
float messageX, messageY;  location where the text should...
int foundCount; number of locations currently selected.

keyPressed( )

typedPartials[typedCount]
입력되는 코드들을 10으로 나누고 그 몫을 취하여 인식하도록 함
for (int j = typedCount-1; j > 0; --j) {
typedPartials[j] = typedPartials[j + 1] / 10;
}

int partial[];
int matchDepth;

check()

5.default로 chosen을 null시키고 null이 되지 않았을 때 선택된 점들을 rect()로 그려주는 코드 지정
최종 셀렉트 된 point와 일치하는 지점 위에 텍스트가 위치하는 방식 정의
외곽 등에 존재하는 놈들은 이상하게 보이지 않도록  additional rule 지정



6.입력값과 정확하게 match되는 point만 highlight(target=highlight color) 해주고 나머지는 모두 dimmed(target=unhighlight color) 시키기


7. zoom 상태에 따라서 remap하기
When zoom is not enabled, the horizontal coordinate of a location
on screen is calculated by using map( ) to convert the value from the range minX
to maxX into the range mapX1 to mapX2. When zooming, we replace minX and maxX with
the minimum and maximum values that we want to be visible onscreen.

if (zoomEnabled) {
return map(x, zoomX1.value, zoomX2.value, mapX1, mapX2);
} else {
return map(x, minX, maxX, mapX1, mapX2);
}


void calcZoom( ) {
}

8.depth에 따라서 점의 크기가 변함.


9.온라인 상의 효율성을 증가시키기 위해 data를 load하는 것을 별도 class로 만들기

class Slurper{
public void run( ) {
}
 }

void readData( ) {
new Slurper( );
}

10.next stap
이번 쳅터의 시스템을 기본으로 하여 그 밖의 다양한 데이터 및 방식으로 접근할 수 있습니다.
Germany and the UK 의 zip code
town names/migration patterns
street names
area codes
other questions
additional data sets—whether satellite photography, geographicboundaries, interstate highways,
or map images.


그리고..have fun!!!!!!!!!...이라네요..^^;
Posted by chacolina
Posted by chacolina
Study/Visualizing Data2009. 3. 5. 19:55

Chapter 4. Time Series
• Acquiring a table of data from a text file
• Parsing the contents of the file into a usable data structure
• Calculating the boundaries of the data to facilitate representation
• Finding a suitable representation and considering alternatives
• Refining the representation with consideration for placement, type, line weight, and color
• Providing a means of interacting with the data so that we can compare variables
  against one another or against the average of the whole data set

• 데이터 구간설정을 위해 읽어들인 데이터의 최대/최소를 구하는 방법, MIN_FLOT, MAX_FLOAT
• 읽어들인 데이터를 map을 사용하여 디스플레이의 플롯(plot)에 매핑하기
• Labeling
• createFont() 를 이용한 시스템 폰트 사용
• 키보드 입력을 통한 화면 전환
• Too many labels make the diagram look like graph paper, and too few suggests that
   only the minimum and maximum values need to be shown.


• % 연산자 (modulo : 나누기 나머지 구하기) - 반복적인 무언가를 할때 활용 가능 
   if (data % 7 == 0) {
           // 여기서 무언가 할일 작성 하면 7의 간격으로 실행됨
   }

• Grid 를 제공하여 가독성 높이기
• Vertex 사용하기
       beginShape( );
       vertex(10, 10);
       vertex(90, 30);
       vertex(40, 90);
       vertex(50, 40);
       endShape();    -> endShape(CLOSE); 하면 구간이 닫히고 면적으로 표시됨

• 특정 점에서 Mouse rollover 사용하기 - dist 활용
       if (dist(mouseX, mouseY, x, y) < 3) {
               // rollover 시 동작 작성
       }


• Integrator class 를 이용한 부드러운 데이터 전환
Posted by chacolina
Study/Visualizing Data2009. 3. 5. 19:54
Chapter 1. The Seven Stages of Visualizing Data
- characteristics of a data set
- data is a moving target
- Great information visualization never starts from the standpoint of the data set; it starts with questions. 
   Why was the data collected, what’s interesting about it, and what stories can it tell?

   The most important part of understanding data is identifying the question that you want to answer.
- The more specific you can make your question, the more specific and clear the visual result will be.
- Proper visualization is a kind of narrative, providing a clear answer to a question without extraneous
   details.
- Each Project Has Unique Requirements
- Who is your audience? What are their goals when approaching a visualization?

Chapter 3. Mapping
- 외부에서 데이터를 읽어들이고, 가공하고, 목적에 맞게 사용하는 과정을 공부했습니다.
   여기서는 .tsv 라는 저자가 직접 만든 데이터 파일을 다루었고, 우리가 앞으로 주로 다룰 데이터는 이렇게 
   컴퓨터에 파일로 있는것도 있을 수 있지만, 음악파일, 책 텍스트파일 등을 비롯해 인터넷상에서 얻어지는
   데이터들, XML 형식 등 무궁무진하게 다양합니다.
   그러나 DB이던 파일이던 XML 이던 데이터 형식이 어떻든 간에, 우리는 일단 최초에 할일이 읽어들일 
   데이터를 우리의 목적에 맞게 잘라내고 가공해야 한다는 건 공통적입니다.

- 데이터베이스(Database) 와 클래스(Class)에 관한 간략한 설명.
- 이 챕터에서는 저자가 작성해놓은 Table 이라는 데이터를 모델링한 class를 사용하여 데이터를 저장/관리.
- 데이터를 가공할때 자주쓰는 주요 함수(function) 를 공부함
   map / norm / lerpColor
- 음/양 부호와 크기를 가지는 데이터를 효과적으로 표현하기 위한 여러가지 방법 시도(크기, 색, 투명도 등등)
- 마우스를 통한 사용자 interaction 요소 추가
- 수치 표시할때 자주쓰는 함수 공부 (자리수)
   nf / nfp
- 저자가 만든 Integrator 라는 class 를 활용하여 좀더 값이 부드럽게 변하도록 시도 
  (이 클래스도 다른곳에서 활용 가능할듯)

Homework
- 각자 Flickr 의 API 사이트를 방문에서 어떤 종류의 프로그램언어로 API 를 제공하고 있고, 제공하는 
   데이터의 모양은 어떻게 생겼는지 알아보기.
   주소 http://www.flickr.com/services/api/

- 이번 챕터에 나왔던 Processing 코드들 실행해보고 이해하기.
Posted by chacolina
Study/Actionscript 3.02009. 2. 28. 15:56
Papervision3D를 익혀보자 (입문)

1.Papervision3D 관련 class들을 다운받는다. (  http://code.google.com/p/papervision3d/  )
2.Papervision3D는 AS3.0의 기본 계층구조와는 다른  별도의 계층구조를 가지고 있으므로 경우에 따른 상속관계를 잘 따져보아야 한다. (무엇을 상속 받았는가에 따라 가능한 기능이 달라지므로 계층구조를 숙지해야할 필요가 있다.)
3.Papervision3D의 기본 요소(viewPort3D,  Sceane3D,  Camera3D, BasicRenderEngine )를 익히고 활용해본다.


1.Papervision3D 관련 class들을 다운
http://code.google.com/p/papervision3d/  를 방문하여 최신버젼을 다운받고 폴더 중 nochump 와 org을 flex내 현재 프로젝트의 
src폴더에 넣는다.




2. Papervision3D 계층구조 및 기본 요소




**Papervision3D의 기본 요소(viewPort3D,  Sceane3D,  Camera3D, BasicRenderEngine )
package
{
    import flash.display.Sprite;
    import flash.events.Event;
   
    import org.papervision3d.cameras.Camera3D;
    import org.papervision3d.objects.primitives.Plane;
    import org.papervision3d.render.BasicRenderEngine;
    import org.papervision3d.scenes.Scene3D;
    import org.papervision3d.view.Viewport3D;

[SWF (width="640", height="480", frameRate="36", backgroundColor="0xEEEEEE")] //meta tag는 꼭 붙여줍니다.
    public class PV3Test1 extends Sprite
    {
        // 1. ViewPort
        private var viewPort:Viewport3D;
        // 2. Scene3D
        private var scene3D:Scene3D;
        // 3. Camera3D
        private var camera3D:Camera3D;
        // 4. BasicRenderEngine
        private var randerEngine:BasicRenderEngine;

        //3D Object
        private var plan:Plane;
       
        public function PV3Test1()
        {
            super();
            //1.ViewPort 만들고 화면에 붙이기
            this.viewPort= new Viewport3D();
            this.addChild(this.viewPort);  //눈에 보이는 것이므로 addChild
            //2.Scene3D 만들기
            this.scene3D= new Scene3D();
            //3.Camera3D 만들기
            this.camera3D= new Camera3D();
            this.camera3D.zoom=40;
            this.camera3D.moveBackward(500);
            //4.RanderEngine 만들기
            this.randerEngine= new BasicRenderEngine();

            //3D Object 만들기
            this.plan= new Plane();
            this.scene3D.addChild(this.plan); //눈에 보이는 것이므로 addChild
           
            this.addEventListener(Event.ENTER_FRAME, onEnter);
        }
         private function onEnter(e:Event):void
         {
             this.plan.rotationY++;
             this.randerEngine.renderScene(this.scene3D, this.camera3D, this.viewPort );
         }
     
    }//class
}//package

위의 코드는 PV3D의 기본 틀이다. 자 이제부터는 위의 기본 요소들을 하나씩 짚어보면서 Papervision3D의 상속관계를 알아본다.

!!!!!상속받은 class로 직접 이동하는 방법..
ctrl을 누르고 원하는 class 이름 위에 커서를 올리면 이름에 underline이 생깁니다. 그 상태에서 class 이름을 클릭하면 곧바로 해당 class 로 이동하게 됩니다. (mac은 사과를 누르세요~) 이러한 방법으로 잘 모르는 class일지라도 상속관계를 찾아들어가 유추할 수 있는 것입니다.


1. ViewPort
*상속관계 ViewPort3D -> Sprite
(ViewPort는 Sprite 상속받았으므로 눈에 보이는 것임을 알 수 있다.)
ViewPort는 PV3D에 의해서 만들어지는 화면(이미지/영상)을 플래시에 연결시키는 ... 클래스이다.     
PV3D는 flash와는 전혀 다른 독자적인 화면랜더링 방식을 취하기 때문에 PV3D와 flash를 연결해주는 것이 필요하다.
그 역할을 ViewPort가 하는 것이다. { PV3D <--> flash }


2. Scene3D
*상속관계 Scene3D -> SceneObject3D -> DisplayObjectContainer3D -> EventDispatcher -> Object
(기본 상속관계 뼈대를 벗어나 자기만의 상속관계를 가진다는 것을 알 수 있다.)
Scene3D는 PV3D에서 stage와 같은 역할을 하는 객체이다. 그러므로  container 역할이 필요함(
DisplayObjectContainer3D 상속 )
여기서 DisplayObjectContainer3D 는 DisplayObject3D를 담을 수 있는 능력이 있어서
addChild( displayObject3D ) / removeChild /  numChildren 와 같은 기능이 가능하다.
( AS3  DisplayObject 기본 계층구조의 DisplayObjectContainer 참조)

3. Camera3D
*상속관계 Camera3D -> CameraObject3D -> DisplayObject3D -> DisplayObjectContainer3D -> EventDispatcher -> Object
( DisplayObjectContainer3D을 상속받았다는 것이 매우 중요하다.)
DisplayObject3D ::: 플래시의 Sprite 같은 객체로서
x, y, z, scaleX, scaleY, scaleZ, rotationX, rotationY, rotationZ, alpha, ... addChild/ removeChild 가 가능하다.
기존 flash는 고정 카메라였으나 PV3D에서는 다양한 각도와 움직임이 있기 때문에 상당히 복잡한 메카니즘을 가지게 된다.

4.BasicRenderEngine 만들기
*상속관계 BasicRenderEngine -> AbstractRenderEngine ->  EventDispatcher -> Object
플래쉬는 플래시 플레이어가 알아서 랜더링 해주지만 플래시 플레이어는 DisplayObject를 상속받은 객체만 랜더링 해준다...
PV3D는 DisplayObject를 상속받은게 아니라서.... 별로도 랜더링 해 줄수있는... flashPlayer 같은 객체가 필요하다...!!   
그 역할을 RenderEngine이 하는 것이다.

*** Plane (for 3D Object)
*상속관계 Plane -> TriangleMesh3D -> Vertices3D -> DisplayObject3D -> DisplayObjectContainer3D -> EventDispatcher -> Object
TriangleMesh3D :: 삼각형 면  <--- 안에 내용( material )을 채울 수 있다..
눈에 보이기 위한 최소면 단위는 삼각형이다. (3개 vertexs(점들)이 이루는 최소면 )  그래서 눈에 보이는 도형들은 모두 TriangleMesh3D 로 만든다. (점 두개가 모이면 선...선은 눈에 보이지 않는다...점 세개가 모이면 면이 된다. 그러므로 최소한의 면은 점 세개가 모여서 만들어진 트라이앵글이다.) 복잡한 도형의 경우 여러개의 triangle을 연결하여 만드는 것이다.



3.Papervision3D 활용

Basic 틀이 되는 코드 만들기
SuperClass: Sprite




기본이 되는 코드를 별도 class로 만들어 놓으면 기본 사항을 반복하여 코딩하지 않아도 되므로 유용하다.
기본 내용을 포함한 Base3D라는 class를 만들어 저장하고 이것을 Document class로 불러들여 (상속) 활용하도록 해보자.

먼저 flex내에서 Base3D class를 만들기 위한 as 파일을 생성한다.
해당 프로젝트 src폴더에서 오른쪽 마우스 클릭 > new > Actionscript class

팝업이 뜨면 package 이름/ 경로와 as. 파일의 name, 기본적으로 상속받을 Superclass를 지정해준다. (Superclass 시작은 대문자)
package 이름/경로는 본인이 원하는대로 적어주면 자동으로 생성된다.
여기서는 자신이 만든 class를 timo라는 폴더에 넣어두어 관리하고있다.




Package: timo.pv3d  SuperClass: Spriite


Base3D를 상속받은 여러가지 Document class를 만들어보기
Document calss를 만드는 것은 위의 Base3D class를 만드는 방법과 유사하다. 차이점이 있다면 package를 써주지 않고 as 파일을 생성한 후에 방금 만든  Document calss 파일 위에서 오른쪽 마우스 클릭을 하여 Set as a default application을 체크해주어야 한다는 것이다.

Superclass: Sprte   (사각형 안을 채우기)



Superclass Base3D  (양쪽 면에 다른 색 입히기  )


Superclass Base3D  (회전 중심축 이동하기 )



Superclass: Base3D  (표면에 perlinNoise 를 입히기)

Superclass Base3D  (이미지 파일을 표면에 입히기)


Superclass Base3D  (지구 이미지를 입히고 지구를 도는 달을 만들어보기)



Superclass Base3D (특정 개체의 움직임을 절대 중심에 두고 카메라를 이동 시켜보기 )



Reference
http://blog.papervision3d.org/
http://code.google.com/p/papervision3d/ 
Posted by chacolina
Study/Actionscript 3.02009. 2. 26. 18:06
외부이미지를 Embed시켜보자

1.flex의 이미지폴더에 임의의 이미지를 등록한 후 Document Class인 EmbedTest를 작성한다.

SuperClass Sprite


Posted by chacolina
Study/Actionscript 3.02009. 2. 26. 17:46
BitmapData의 다양한 속성값을 적용시켜보자

1.Polygon SWC파일을 만들어 Flex로 Export한 후 Documant Class인 BitmapTest2를 작성한다.
2.Documant Class인 BitmapTest2를 작성한다.

1.SuperClass Sprite  (Polygon version)




2.SuperClass Sprite  (Text version)


Posted by chacolina
Study/Actionscript 3.02009. 2. 26. 17:17
외부 데이터를 BitmapData로서 불러보자

1. 적당한 이미지 몇개를 flex내 img 폴더에 저장한다 (이름은 img0...img1 식으로...)
2.Documant Class인 BitmapTest를 작성한다.

SuperClass Sprite




SuperClass Sprite  (이미지를 클릭했을 때 컬러값 추출하기 첨가_붉은부분 자세히보기)


Posted by chacolina
Study/Actionscript 3.02009. 2. 26. 16:48
외부 데이터를 BitmapData로서 불러보자

1. 적당한 이미지 몇개를 flex내 img 폴더에 저장한다 (이름은 img0...img1 식으로...)
2.Documant Class인 BitmapTest를 작성한다.

SuperClass: Sprite


Posted by chacolina