Flash Platform의 성능 최적화

Similar documents
Analytics > Log & Crash Search > Unity ios SDK [Deprecated] Log & Crash Unity ios SDK. TOAST SDK. Log & Crash Unity SDK Log & Crash Search. Log & Cras

MasoJava4_Dongbin.PDF

DocsPin_Korean.pages

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션

Modern Javascript

Remote UI Guide

( )부록

1

MAX+plus II Getting Started - 무작정따라하기

,,,,,, (41) ( e f f e c t ), ( c u r r e n t ) ( p o t e n t i a l difference),, ( r e s i s t a n c e ) 2,,,,,,,, (41), (42) (42) ( 41) (Ohm s law),

LCD Display

I T C o t e n s P r o v i d e r h t t p : / / w w w. h a n b i t b o o k. c o. k r

No Slide Title

01-OOPConcepts(2).PDF

Scene7 Media Portal 사용

자바GUI실전프로그래밍2_장대원.PDF

Jwplayer 요즘 웹에서 동영상 재생을 목적으로 많이 쓰이는 jwplayer의 설치와 사용하기 입니다. jwplayer홈페이지 : 위의 홈페이지에 가시면 JWplayer를 다운 받으실 수 있습니다. 현재 5.1버전

04_오픈지엘API.key

슬라이드 1

Something that can be seen, touched or otherwise sensed

rmi_박준용_final.PDF

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D D382E687770>

Orcad Capture 9.x

JMF3_심빈구.PDF

Javascript.pages


02 C h a p t e r Java

PowerPoint 프레젠테이션

VOL /2 Technical SmartPlant Materials - Document Management SmartPlant Materials에서 기본적인 Document를 관리하고자 할 때 필요한 세팅, 파일 업로드 방법 그리고 Path Type인 Ph

The Self-Managing Database : Automatic Health Monitoring and Alerting

07 자바의 다양한 클래스.key

03장

2005CG01.PDF

Connection 8 22 UniSQLConnection / / 9 3 UniSQL OID SET

Windows Embedded Compact 2013 [그림 1]은 Windows CE 로 알려진 Microsoft의 Windows Embedded Compact OS의 history를 보여주고 있다. [표 1] 은 각 Windows CE 버전들의 주요 특징들을 담고

chapter4

ilist.add(new Integer(1))과 같이 사용하지 않고 ilist.add(1)과 같이 사용한 것은 자바 5.0에 추가된 기본 자료형과 해당 객체 자료 형과의 오토박싱/언박싱 기능을 사용한 것으로 오토박싱이란 자바 컴파일러가 객체를 요구하는 곳에 기본 자료형

APOGEE Insight_KR_Base_3P11

untitled

FMX M JPG 15MB 320x240 30fps, 160Kbps 11MB View operation,, seek seek Random Access Average Read Sequential Read 12 FMX () 2

<4D F736F F D205B4354BDC9C3FEB8AEC6F7C6AE5D3131C8A35FC5ACB6F3BFECB5E520C4C4C7BBC6C320B1E2BCFA20B5BFC7E2>

ORANGE FOR ORACLE V4.0 INSTALLATION GUIDE (Online Upgrade) ORANGE CONFIGURATION ADMIN O

비긴쿡-자바 00앞부속

6주차.key

K7VT2_QIG_v3

Mentor_PCB설계입문

JMF2_심빈구.PDF

ch09

05-class.key

Eclipse 와 Firefox 를이용한 Javascript 개발 발표자 : 문경대 11 년 10 월 26 일수요일

untitled

Interstage5 SOAP서비스 설정 가이드

untitled

Chap12

untitled

CD-RW_Advanced.PDF

Solaris Express Developer Edition

PowerPoint 프레젠테이션

[ReadyToCameral]RUF¹öÆÛ(CSTA02-29).hwp

MPLAB C18 C

4. #include <stdio.h> #include <stdlib.h> int main() { functiona(); } void functiona() { printf("hihi\n"); } warning: conflicting types for functiona

< B3E2C1A632C8B8BFF6B5E531B1DE42C7FC2E687770>

hd1300_k_v1r2_Final_.PDF

manual pdfÃÖÁ¾

uFOCS

Building Mobile AR Web Applications in HTML5 - Google IO 2012

wp1_ hwp

AGENDA 모바일 산업의 환경변화 모바일 클라우드 서비스의 등장 모바일 클라우드 서비스 융합사례

2

김기남_ATDC2016_160620_[키노트].key

인켈(국문)pdf.pdf

신림프로그래머_클린코드.key

PowerChute Personal Edition v3.1.0 에이전트 사용 설명서

목차 1. 제품 소개 특징 개요 Function table 기능 소개 Copy Compare Copy & Compare Erase

Chap7.PDF

PRO1_04E [읽기 전용]

C# Programming Guide - Types

09-interface.key

11 템플릿적용 - Java Program Performance Tuning (김명호기술이사)

PowerPoint 프레젠테이션

자바 프로그래밍

untitled

Domino Designer Portal Development tools Rational Application Developer WebSphere Portlet Factory Workplace Designer Workplace Forms Designer

Ext JS À¥¾ÖÇø®ÄÉÀ̼ǰ³¹ß-³¹Àå.PDF

1217 WebTrafMon II

Week3

자바로

Lab10

교육2 ? 그림

1부

P/N: (Dec. 2003)

ETL_project_best_practice1.ppt

FileMaker 15 WebDirect 설명서

PWR PWR HDD HDD USB USB Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl Cable PC PC DDNS (

5장.key

PCServerMgmt7

DE1-SoC Board

fundamentalOfCommandPattern_calmglow_pattern_jstorm_1.0_f…

Transcription:

ADOBE FLASH PLATFORM

http://help.adobe.com/ko_kr/legalnotices/index.html.

iii 1 :.................................................................................................. 1.................................................................................................. 2........................................................................................................... 3 2 :.................................................................................................................. 4............................................................................................................ 4............................................................................................................. 5............................................................................................................... 10............................................................................................................... 12 18............................................................................................................... 18 3D............................................................................................................. 19...................................................................................................... 20........................................................................................................ 21 3 : CPU Flash Player 10.1 CPU................................................................................ 22................................................................................................................. 24............................................................................................ 25.................................................................................................. 28.......................................................................................................... 29 ENTER_FRAME............................................................................................ 29............................................................................................................. 31 4 : ActionScript 3.0 Vector Array.............................................................................................. 32 API............................................................................................................... 33...................................................................................................... 34........................................................................................................ 35............................................................................................................... 37............................................................................................................... 37 5 :.......................................................................................................... 42........................................................................................................ 43............................................................................................................... 44............................................................................................................... 46.................................................................................................. 47

iv............................................................................................................... 48.......................................................................................................... 54........................................................................................................ 59 GPU.................................................................................................................... 63............................................................................................................... 65............................................................................................................... 67.................................................................................................... 67 6 :............................................................................................... 69................................................................................................................. 70............................................................................................................... 73 Flash Remoting......................................................................................................... 74.................................................................................................... 75 7 :................................................................................................................... 76 StageVideo............................................................................................................. 76................................................................................................................... 76 8 : SQL............................................................................... 78.................................................................................................. 80.......................................................................................... 81 SQL........................................................................................................ 81 SQL.............................................................................................................. 82 9 :................................................................................................................. 83..................................................................................................................... 84

1 1 : Adobe AIR Adobe Flash Player,,,... CPU ActionScript 3.0 SQL, AIR Flash Player.. Flash Player 10.1 AIR 2.5, AIR Flash Player. Flash Platform. " "..., 30, 1/30.. Adobe Flash Builder Flash Professional.. ActionScript [SWF(frameRate="24"]. MXML framerate WindowedApplication.,, enterframe. ( enterframe ),........ enterframe.....

2 : updateafterevent. updateafterevent..,.... " (elastic racetrack)". ( ).. 1/30 30.... Flash Platform. Flash Player Mental Model - The Elastic Racetrack(Ted Patrick ) Asynchronous ActionScript Execution(Trevor McCauley ) http://www.adobe.com/go/learn_fp_air_perf_tv_kr(sean Christmann MAX ), Adobe AIR....,..??????????? CPU???.,... 42..

3....,. Flash Platform.. " ".......,,.... 83.. http://www.adobe.com/go/learn_fp_goldman_tv_kr(oliver Goldman MAX ) AIR http://www.adobe.com/go/learn_fp_air_perf_devnet_kr( Oliver Goldman Adobe Developer Connection )

4 2 :... ActionScript 3.0.. Shape, Sprite, MovieClip... trace(getsize(new Shape())); // output: 236 trace(getsize(new Sprite())); // output: 412 trace(getsize(new MovieClip())); // output: 440 getsize(). MovieClip Shape MovieClip. getsize(). String 4-8..

5 // Primitive types var a:number; trace(getsize(a)); // output: 8 var b:int; trace(getsize(b)); // output: 4 var c:uint; trace(getsize(c)); // output: 4 var d:boolean; trace(getsize(d)); // output: 4 var e:string; trace(getsize(e)); // output: 4 64 Number AVM(ActionScript Virtual Machine) 8. 4. // Primitive types var a:number = 8; trace(getsize(a)); // output: 4 a = Number.MAX_VALUE; trace(getsize(a)); // output: 8 String. String. var name:string; trace(getsize(name)); // output: 4 name = ""; trace(getsize(name)); // output: 24 name = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularized in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."; trace(getsize(name)); // output: 1172 getsize()..

6.. const MAX_NUM:int = 18; const COLOR:uint = 0xCCCCCC; var area:rectangle; for (var:int = 0; i < MAX_NUM; i++) // Do not use the following code area = new Rectangle(i,0,1,10); mybitmapdata.fillrect(area,color); Rectangle.. const MAX_NUM:int = 18; const COLOR:uint = 0xCCCCCC; // Create the rectangle outside the loop var area:rectangle = new Rectangle(0,0,1,10); for (var:int = 0; i < MAX_NUM; i++) area.x = i; mybitmapdata.fillrect(area,color);. BitmapData.. var myimage:bitmapdata; var mycontainer:bitmap; const MAX_NUM:int = 300; for (var i:int = 0; i< MAX_NUM; i++) // Create a 20 x 20 pixel bitmap, non-transparent myimage = new BitmapData(20,20,false,0xF0D062); // Create a container for each BitmapData instance mycontainer = new Bitmap(myImage); // Add it to the display list addchild(mycontainer); // Place each container mycontainer.x = (mycontainer.width + 8) * Math.round(i % 20); mycontainer.y = (mycontainer.height + 8) * int(i / 20); : int Math.floor()..

7 Bitmap BitmapData. // Create a single 20 x 20 pixel bitmap, non-transparent var myimage:bitmapdata = new BitmapData(20,20,false,0xF0D062); var mycontainer:bitmap; const MAX_NUM:int = 300; for (var i:int = 0; i< MAX_NUM; i++) // Create a container referencing the BitmapData instance mycontainer = new Bitmap(myImage); // Add it to the display list addchild(mycontainer); // Place each container mycontainer.x = (mycontainer.width + 8) * Math.round(i % 20); mycontainer.y = (mycontainer.height + 8) * int(i / 20); 700KB,. Bitmap BitmapData.

8 // Create a single 20 x 20 pixel bitmap, non-transparent var myimage:bitmapdata = new BitmapData(20,20,false,0xF0D062); var mycontainer:bitmap; const MAX_NUM:int = 300; for (var i:int = 0; i< MAX_NUM; i++) // Create a container referencing the BitmapData instance mycontainer = new Bitmap(myImage); // Add it to the DisplayList addchild(mycontainer); // Place each container mycontainer.x = (mycontainer.width + 8) * Math.round(i % 20); mycontainer.y = (mycontainer.height + 8) * int(i / 20); // Set a specific rotation, alpha, and depth mycontainer.rotation = Math.random()*360; mycontainer.alpha = Math.random(); mycontainer.scalex = mycontainer.scaley = Math.random();. 48

9.. Array Vector. CPU. null. null..... package import flash.display.sprite; public final class SpritePool private static var MAX_VALUE:uint; private static var GROWTH_VALUE:uint; private static var counter:uint; private static var pool:vector.<sprite>; private static var currentsprite:sprite; public static function initialize( maxpoolsize:uint, growthvalue:uint ):void MAX_VALUE = maxpoolsize; GROWTH_VALUE = growthvalue; counter = maxpoolsize; var i:uint = maxpoolsize; pool = new Vector.<Sprite>(MAX_VALUE); while( --i > -1 ) pool[i] = new Sprite(); public static function getsprite():sprite if ( counter > 0 ) return currentsprite = pool[--counter]; var i:uint = GROWTH_VALUE; while( --i > -1 ) pool.unshift ( new Sprite() ); counter = GROWTH_VALUE; return getsprite(); public static function disposesprite(disposedsprite:sprite):void pool[counter++] = disposedsprite;

10 SpritePool. getsprite() disposesprite().... 10. SpritePool. const MAX_SPRITES:uint = 100; const GROWTH_VALUE:uint = MAX_SPRITES >> 1; const MAX_NUM:uint = 10; SpritePool.initialize ( MAX_SPRITES, GROWTH_VALUE ); var currentsprite:sprite; var container:sprite = SpritePool.getSprite(); addchild ( container ); for ( var i:int = 0; i< MAX_NUM; i++ ) for ( var j:int = 0; j< MAX_NUM; j++ ) currentsprite = SpritePool.getSprite(); currentsprite.graphics.beginfill ( 0x990000 ); currentsprite.graphics.drawcircle ( 10, 10, 10 ); currentsprite.x = j * (currentsprite.width + 5); currentsprite.y = i * (currentsprite.width + 5); container.addchild ( currentsprite );. stage.addeventlistener ( MouseEvent.CLICK, removedots ); function removedots ( e:mouseevent ):void while (container.numchildren > 0 ) SpritePool.disposeSprite (container.removechildat(0) as Sprite ); : Sprite. SpritePool dispose().. Flash Player.. ActionScript 1.0 2.0 delete ActionScript 3.0. ActionScript 3.0. : Adobe AIR Flash Player. Sprite null.

11 var mysprite:sprite = new Sprite(); // Set the reference to null, so that the garbage collector removes // it from memory mysprite = null; null....... CPU.. null.. : null. CPU. null. Adobe AIR Flash Player System.gc(). Adobe Flash Builder.. :. null removeeventlistener().. BitmapData dispose(). 1.8MB BitmapData. 1.8MB System.totalMemory. trace(system.totalmemory / 1024); // output: 43100 // Create a BitmapData instance var image:bitmapdata = new BitmapData(800, 600); trace(system.totalmemory / 1024); // output: 44964 BitmapData,. trace(system.totalmemory / 1024); // output: 43100 // Create a BitmapData instance var image:bitmapdata = new BitmapData(800, 600); trace(system.totalmemory / 1024); // output: 44964 image.dispose(); image = null; trace(system.totalmemory / 1024); // output: 43084 dispose() null. BitmapData dispose() null.

12 : Flash Player 10.1 AIR 1.5.2 System disposexml(). XML XML. 25. ( ) CPU GPU... 54 Flash Player 16 32 16.. Windows Mobile Flash Player 10.1. : Flash Player 10.1 32 (4 ). 300 x 300 350KB (300*300*4/1024). 175KB. 16. (PNG, GIF, JPG). 16 32,.. 16 32. BitmapData BitmapData. Flash Player 10.1 AIR 2.5 BitmapData. BitmapData BitmapData.. [Embed]. : Flash Player 10.1 AIR 2.5.. Flash Player 10.1 AIR 2.5.

13 Flash Player 10.1 AIR 2.5 Flash Player 10.1 AIR 2.5 BitmapData.. Flash Player 10.1 AIR 2.5. Star.

14 const MAX_NUM:int = 18; var star:bitmapdata; var bitmap:bitmap; for (var i:int = 0; i<max_num; i++) for (var j:int = 0; j<max_num; j++) star = new Star(0,0); bitmap = new Bitmap(star); bitmap.x = j * star.width; bitmap.y = i * star.height; addchild(bitmap). Flash Player 10 1008KB Flash Player 10.1 4KB. BitmapData.

15 const MAX_NUM:int = 18; var star:bitmapdata; var bitmap:bitmap; for (var i:int = 0; i<max_num; i++) for (var j:int = 0; j<max_num; j++) star = new Star(0,0); bitmap = new Bitmap(star); bitmap.x = j * star.width; bitmap.y = i * star.height; addchild(bitmap) var ref:bitmap = getchildat(0) as Bitmap; ref.bitmapdata.pixeldissolve(ref.bitmapdata, ref.bitmapdata.rect, new Point(0,0),Math.random()*200,Math.random()*200, 0x990000); Star.. BitmapData..

16 setpixel(). Flash Player 10.1 AIR 2.5 8KB.. beginbitmapfill(). var container:sprite = new Sprite(); var source:bitmapdata = new Star(0,0); // Fill the surface with the source BitmapData container.graphics.beginbitmapfill(source); container.graphics.drawrect(0,0,stage.stagewidth,stage.stageheight); addchild(container); BitmapData. Star Matrix. Matrix beginbitmapfill().

17 var container:sprite = new Sprite(); container.addeventlistener(event.enter_frame, rotate); var source:bitmapdata = new Star(0,0); var matrix:matrix = new Matrix(); addchild(container); var angle:number =.01; function rotate(e:event):void // Rotate the stars matrix.rotate(angle); // Clear the content container.graphics.clear(); // Fill the surface with the source BitmapData container.graphics.beginbitmapfill(source,matrix,true,true); container.graphics.drawrect(0,0,stage.stagewidth,stage.stageheight); ActionScript... BitmapData.. :. Shape.

18 Pixel Bender. Pixel Bender..... CPU. Flash Player 10.1 AIR 2.5. 30,.... 30. 30.... CPU GPU. ( : Adobe Photoshop ). ActionScript. CPU GPU,....

19 Flash Player 10.1 AIR 2.5. Flash Player 9 AIR 1.0. :.... 250 x 250 125 x 125.. 256 x 256, 512 x 512, 1024 x 1024 2. 1024 x 1024... 1024 x 1024 64 x 64. 512 x 512, 256 x 256, 128 x 128, 64 x 64. Flash Player 10.1 AIR 2.5. 4MB(1024 x 1024) 16KB(64 x 64).. 64 x 64 4MB... 1:8 1:4/1:2/1:1. 1:1. JPEG... JPEG. :.,.,.. 3D 3D. Flash Player 10 AIR 1.5 3D. rotationx rotationy Graphics drawtriangles(). z...

20. AIR Flash Player AIR 2.0.1 AIR 2.5 3D. Flash Player. API 3D. Flash Player 10 AIR 1.5 3D. drawtriangles(). 3D API,. ActionScript. rendermode GPU AIR 2.0.1 AIR 2.5 GPU 3D. rendermode CPU CPU 3D (GPU ). Flash Player 10.1 CPU 3D. CPU 3D 3D.. 3D. CPU 3D 3D. Adobe Flash Text Engine TextField. Flash Player 10 AIR 1.5 Adobe Flash Text Engine(FTE). FTE API ActionScript 3.0 flash.text.engine. Flash Text Engine. ActionScript TextField.

21 59. ActionScript 3.0.. dispatchevent().... dispatchevent( new Event ( Event.COMPLETE ) ); Document. addeventlistener( Event.COMPLETE, onanimationcomplete );,. Event. Event.ENTER_FRAME..

22 3 : CPU CPU. CPU,. Flash Player 10.1 CPU Flash Player 10.1 CPU. SWF, Flash Player., :, Adobe AIR. CPU Flash Player 10.1. SWF CPU. Flash Player.. SWF. SWF.. ActionScript haspriority HTML true. SWF haspriority HTML. SWF. haspriority HTML SWF 2fps 8fps. SWF. Windows Mac Flash Player 11.2 ThrottleEvent. Flash Player, ThrottleEvent. ThrottleEvent., EventDispatcher. DisplayObject. : Adobe AIR. haspriority HTML SWF. Flash Player 10.1 haspriority HTML. <param name="haspriority" value="true" />

CPU 23 Flash Player. CPU. SWF. SWF... haspriority false. SWF haspriority true. haspriority SWF. : CPU haspriority true Flash Player. JavaScript haspriority. haspriority 1x1 0x0 SWF. SWF. " (click to play)". haspriority. SWF haspriority false SWF haspriority false SWF haspriority false SWF SWF haspriority

CPU 24 SWF haspriority false SWF haspriority false SWF haspriority true SWF SWF haspriority Flash Player 10.1 AIR 2.5 CPU,.. 4 / (fps). AIR. ActionScript. Stage.frameRate 4fps, 4fps. 0 4fps (NetStream, Socket NetConnection). 0. 250ms(4fps).. : Stage.frameRate 4fps SWF..... A/V 4fps. A/V.

CPU 25 SWF. A/V Flash Player A/V Flash Player. A/V 4fps... CPU. : ActionScript. REMOVED_FROM_STAGE ADDED_TO_STAGE... CPU. Event.ENTER_FRAME. Event.REMOVED_FROM_STAGE Event.ADDED_TO_STAGE.. // Listen to keyboard events stage.addeventlistener(keyboardevent.key_down, keyisdown); stage.addeventlistener(keyboardevent.key_up, keyisup); // Create object to store key states var keys:dictionary = new Dictionary(true); function keyisdown(e:keyboardevent):void // Remember that the key was pressed keys[e.keycode] = true; if (e.keycode==keyboard.left e.keycode==keyboard.right) runningboy.play(); function keyisup(e:keyboardevent):void // Remember that the key was released keys[e.keycode] = false; for each (var value:boolean in keys) if ( value ) return; runningboy.stop();

CPU 26 runningboy.addeventlistener(event.enter_frame, handlemovement); runningboy.stop(); var currentstate:number = runningboy.scalex; var speed:number = 15; function handlemovement(e:event):void if (keys[keyboard.right]) e.currenttarget.x += speed; e.currenttarget.scalex = currentstate; else if (keys[keyboard.left]) e.currenttarget.x -= speed; e.currenttarget.scalex = -currentstate; [Remove]. // Show or remove running boy showbtn.addeventlistener (MouseEvent.CLICK,showIt); removebtn.addeventlistener (MouseEvent.CLICK,removeIt); function showit (e:mouseevent):void addchild (runningboy); function removeit(e:mouseevent):void if (contains(runningboy)) removechild(runningboy);

CPU 27 Event.ENTER_FRAME.. CPU. // Listen to Event.ADDED_TO_STAGE and Event.REMOVED_FROM_STAGE runningboy.addeventlistener(event.added_to_stage,activate); runningboy.addeventlistener(event.removed_from_stage,deactivate); function activate(e:event):void // Restart everything e.currenttarget.addeventlistener(event.enter_frame,handlemovement); function deactivate(e:event):void // Freeze the running boy - consumes fewer CPU resources when not shown e.currenttarget.removeeventlistener(event.enter_frame,handlemovement); e.currenttarget.stop(); [ ], Event.ENTER_FRAME,. : null. CPU. CPU. Flash Player 10 AIR 1.5.. Loader. Flash Player 9 AIR 1.0 Loader LoaderInfo Event.UNLOAD.,. Flash Player 10 AIR 1.5 Loader unloadandstop(). SWF, SWF,. SWF unload(),. var loader:loader = new Loader(); loader.load ( new URLRequest ( "content.swf" ) ); addchild ( loader ); stage.addeventlistener ( MouseEvent.CLICK, unloadswf ); function unloadswf ( e:mouseevent ):void // Unload the SWF file with no automatic object deactivation // All deactivation must be processed manually loader.unload(); unloadandstop().

CPU 28 var loader:loader = new Loader(); loader.load ( new URLRequest ( "content.swf" ) ); addchild ( loader ); stage.addeventlistener ( MouseEvent.CLICK, unloadswf ); function unloadswf ( e:mouseevent ):void // Unload the SWF file with automatic object deactivation // All deactivation is handled automatically loader.unloadandstop(); unloadandstop().. SWF.. ( : ).. Event.ENTER_FRAME, Event.FRAME_CONSTRUCTED, Event.EXIT_FRAME, Event.ACTIVATE Event.DEACTIVATE. Event.ACTIVATE Event.DEACTIVATE. (Event.ACTIVATE Event.DEACTIVATE) CPU... 0.. var originalframerate:uint = stage.framerate; var standbyframerate:uint = 0; stage.addeventlistener ( Event.ACTIVATE, onactivate ); stage.addeventlistener ( Event.DEACTIVATE, ondeactivate ); function onactivate ( e:event ):void // restore original frame rate stage.framerate = originalframerate; function ondeactivate ( e:event ):void // set frame rate to 0 stage.framerate = standbyframerate;

CPU 29.,. " ". 47 25. ( : MovieClip Sprite )., CPU.. mouseenabled mousechildren. // Disable any mouse interaction with this InteractiveObject myinteractiveobject.mouseenabled = false; const MAX_NUM:int = 10; // Create a container for the InteractiveObjects var container:sprite = new Sprite(); for ( var i:int = 0; i< MAX_NUM; i++ ) // Add InteractiveObject to the container container.addchild( new Sprite() ); // Disable any mouse interaction on all the children container.mousechildren = false;. CPU,. ENTER_FRAME ENTER_FRAME., Event.ENTER_FRAME. ActionScript 3.0. (DisplayObject) Event.ENTER_FRAME.. ActionScript ENTER_FRAME. ENTER_FRAME

CPU 30.. Stage.frameRate. ENTER_FRAME.. ENTER_FRAME.... :.,. 10fps. 1. TimerEvent updateafterevent()... // Use a low frame rate for the application stage.framerate = 10; // Choose one update per second var updateinterval:int = 1000; var mytimer:timer = new Timer(updateInterval,0); mytimer.start(); mytimer.addeventlistener( TimerEvent.TIMER, updatecontrols ); function updatecontrols( e:timerevent ):void // Update controls here // Force the controls to be updated on screen e.updateafterevent(); updateafterevent().. 10fps. ENTER_FRAME. SWF. Timer enterframe. enterframe. enterframe. enterframe.. Timer Timer.. Timer.., Timer 100. Timer 2000. Timer Timer delay., 100, 200. delay 100 Timer. timer 200..

CPU 31 var timer:timer = new Timer(100); timer.addeventlistener(timerevent.timer, timerhandler); timer.start(); var offcycle:boolean = true; function timerhandler(event:timerevent):void // Do things that happen every 100 ms if (!offcycle) // Do things that happen every 200 ms offcycle =!offcycle; Timer.. Timer timer true Timer stop(). enterframe Timer..,. Flash Player AIR " ".. Writing well-behaved, efficient, AIR applications(arno Gourdol ) 56 CPU. CPU,. Flash...

32 4 : ActionScript 3.0 Vector Array Array Vector. Vector Array. Array Vector. Array. var coordinates:array = new Array(); var started:number = gettimer(); for (var i:int = 0; i< 300000; i++) coordinates[i] = Math.random()*1024; trace(gettimer() - started); // output: 107 Vector. var coordinates:vector.<number> = new Vector.<Number>(); var started:number = gettimer(); for (var i:int = 0; i< 300000; i++) coordinates[i] = Math.random()*1024; trace(gettimer() - started); // output: 72. // Specify a fixed length and initialize its length var coordinates:vector.<number> = new Vector.<Number>(300000, true); var started:number = gettimer(); for (var i:int = 0; i< 300000; i++) coordinates[i] = Math.random()*1024; trace(gettimer() - started); // output: 48.......

ActionScript 3.0 33 // Store the reused value to maintain code easily const MAX_NUM:int = 300000; var coordinates:vector.<number> = new Vector.<Number>(MAX_NUM, true); var started:number = gettimer(); for (var i:int = 0; i< MAX_NUM; i++) coordinates[i] = Math.random()*1024; trace(gettimer() - started); // output: 47 Vector API API. API API. Flash Player 10 AIR 1.5 API. API. ActionScript. API. drawpath() drawgraphicsdata() drawtriangles() : 3D drawtriangles(). ActionScript.. var container:shape = new Shape(); container.graphics.beginfill(0x442299); var coords:vector.<number> = Vector.<Number>([132, 20, 46, 254, 244, 100, 20, 98, 218, 254]); container.graphics.moveto ( coords[0], coords[1] ); container.graphics.lineto ( coords[2], coords[3] ); container.graphics.lineto ( coords[4], coords[5] ); container.graphics.lineto ( coords[6], coords[7] ); container.graphics.lineto ( coords[8], coords[9] ); addchild( container );. drawpath().

ActionScript 3.0 34 var container:shape = new Shape(); container.graphics.beginfill(0x442299); var commands:vector.<int> = Vector.<int>([1,2,2,2,2]); var coords:vector.<number> = Vector.<Number>([132, 20, 46, 254, 244, 100, 20, 98, 218, 254]); container.graphics.drawpath(commands, coords); addchild( container ); drawgraphicsdata().. ActionScript 3.0. ActionScript.... MouseEvent.CLICK. const MAX_NUM:int = 10; var scenewidth:int = stage.stagewidth; var sceneheight:int = stage.stageheight; var currentapple:interactiveobject; var currentappleclicked:interactiveobject; for ( var i:int = 0; i< MAX_NUM; i++ ) currentapple = new Apple(); currentapple.x = Math.random()*sceneWidth; currentapple.y = Math.random()*sceneHeight; addchild ( currentapple ); // Listen to the MouseEvent.CLICK event currentapple.addeventlistener ( MouseEvent.CLICK, onappleclick ); function onappleclick ( e:mouseevent ):void currentappleclicked = e.currenttarget as InteractiveObject; currentappleclicked.removeeventlistener(mouseevent.click, onappleclick ); removechild ( currentappleclicked ); Apple addeventlistener(). removeeventlistener(). ActionScript 3.0 InteractiveObject. addeventlistener() removeeventlistener()..

ActionScript 3.0 35 const MAX_NUM:int = 10; var scenewidth:int = stage.stagewidth; var sceneheight:int = stage.stageheight; var currentapple:interactiveobject; var currentappleclicked:interactiveobject; var container:sprite = new Sprite(); addchild ( container ); // Listen to the MouseEvent.CLICK on the apple's parent // Passing true as third parameter catches the event during its capture phase container.addeventlistener ( MouseEvent.CLICK, onappleclick, true ); for ( var i:int = 0; i< MAX_NUM; i++ ) currentapple = new Apple(); currentapple.x = Math.random()*sceneWidth; currentapple.y = Math.random()*sceneHeight; container.addchild ( currentapple ); function onappleclick ( e:mouseevent ):void currentappleclicked = e.target as InteractiveObject; container.removechild ( currentappleclicked ); addeventlistener(). Apple. onappleclick(). function onappleclick ( e:mouseevent ):void e.stoppropagation(); currentappleclicked = e.target as InteractiveObject; container.removechild ( currentappleclicked ); addeventlistener() false. // Listen to the MouseEvent.CLICK on apple's parent // Passing false as third parameter catches the event during its bubbling phase container.addeventlistener ( MouseEvent.CLICK, onappleclick, false ); false. container.addeventlistener ( MouseEvent.CLICK, onappleclick ); setvector(). BitmapData. setvector().

ActionScript 3.0 36 // Image dimensions var wdth:int = 200; var hght:int = 200; var total:int = wdth*hght; // Pixel colors Vector var pixels:vector.<uint> = new Vector.<uint>(total, true); for ( var i:int = 0; i< total; i++ ) // Store the color of each pixel pixels[i] = Math.random()*0xFFFFFF; // Create a non-transparent BitmapData object var myimage:bitmapdata = new BitmapData ( wdth, hght, false ); var imagecontainer:bitmap = new Bitmap ( myimage ); // Paint the pixels myimage.setvector ( myimage.rect, pixels ); addchild ( imagecontainer ); setpixel() setpixel32() lock() unlock(). lock() unlock(). var buffer:bitmapdata = new BitmapData(200,200,true,0xFFFFFFFF); var bitmapcontainer:bitmap = new Bitmap(buffer); var positionx:int; var positiony:int; // Lock update buffer.lock(); var starting:number=gettimer(); for (var i:int = 0; i<2000000; i++) // Random positions positionx = Math.random()*200; positiony = Math.random()*200; // 40% transparent pixels buffer.setpixel32( positionx, positiony, 0x66990000 ); // Unlock update buffer.unlock(); addchild( bitmapcontainer ); trace( gettimer () - starting ); // output : 670 BitmapData lock() BitmapData. Bitmap BitmapData BitmapData. Bitmap BitmapData. setpixel() setpixel32() unlock(). lock() unlock(). : ( ). lock() unlock(). Flash Player.

ActionScript 3.0 37 ( : getpixel(), getpixel32(), setpixel() setpixel32()).. getpixels() getvector(). Vector Vector API. indexof(), substr() substring() String. String., String.indexOf(). String. ( (xxxx) ) ( (?:xxxx) ).., "ab". "+". /(ab)+/ " "..... /(?:ab)+/....... TextField += appendtext(). TextField text += appendtext(). appendtext(). += 1120ms.

ActionScript 3.0 38 addchild ( mytextfield ); mytextfield.autosize = TextFieldAutoSize.LEFT; var started:number = gettimer(); for (var i:int = 0; i< 1500; i++ ) mytextfield.text += "ActionScript 3"; trace( gettimer() - started ); // output : 1120 += appendtext(). var mytextfield:textfield = new TextField(); addchild ( mytextfield ); mytextfield.autosize = TextFieldAutoSize.LEFT; var started:number = gettimer(); for (var i:int = 0; i< 1500; i++ ) mytextfield.appendtext ( "ActionScript 3" ); trace( gettimer() - started ); // output : 847 847ms..... 2ms. var mytextfield:textfield = new TextField(); addchild ( mytextfield ); mytextfield.autosize = TextFieldAutoSize.LEFT; var started:number = gettimer(); var content:string = mytextfield.text; for (var i:int = 0; i< 1500; i++ ) content += "ActionScript 3"; mytextfield.text = content; trace( gettimer() - started ); // output : 2 HTML Flash Player Timeout.. : Adobe AIR.

ActionScript 3.0 39 var mytextfield:textfield = new TextField(); addchild ( mytextfield ); mytextfield.autosize = TextFieldAutoSize.LEFT; var started:number = gettimer(); for (var i:int = 0; i< 1500; i++ ) mytextfield.htmltext += "ActionScript <b>2</b>"; trace( gettimer() - started ); 29ms. var mytextfield:textfield = new TextField(); addchild ( mytextfield ); mytextfield.autosize = TextFieldAutoSize.LEFT; var started:number = gettimer(); var content:string = mytextfield.htmltext; for (var i:int = 0; i< 1500; i++ ) content += "<b>actionscript<b> 3"; mytextfield.htmltext = content; trace ( gettimer() - started ); // output : 29 : Flash Player 10.1 AIR 2.5 String..... var lng:int = 5000; var arraysprite:vector.<sprite> = new Vector.<Sprite>(lng, true); var i:int; for ( i = 0; i< lng; i++ ) arraysprite[i] = new Sprite(); var started:number = gettimer(); for ( i = 0; i< lng; i++ ) arraysprite[i].x = Math.random()*stage.stageWidth; arraysprite[i].y = Math.random()*stage.stageHeight; arraysprite[i].alpha = Math.random(); arraysprite[i].rotation = Math.random()*360; trace( gettimer() - started ); // output : 16.

ActionScript 3.0 40 var lng:int = 5000; var arraysprite:vector.<sprite> = new Vector.<Sprite>(lng, true); var i:int; for ( i = 0; i< lng; i++ ) arraysprite[i] = new Sprite(); var started:number = gettimer(); var currentsprite:sprite; for ( i = 0; i< lng; i++ ) currentsprite = arraysprite[i]; currentsprite.x = Math.random()*stage.stageWidth; currentsprite.y = Math.random()*stage.stageHeight; currentsprite.alpha = Math.random(); currentsprite.rotation = Math.random()*360; trace( gettimer() - started ); // output : 9.... SWF. Math. Math.abs(). const MAX_NUM:int = 500000; var arrayvalues:vector.<number>=new Vector.<Number>(MAX_NUM,true); var i:int; for (i = 0; i< MAX_NUM; i++) arrayvalues[i] = Math.random()-Math.random(); var started:number = gettimer(); var currentvalue:number; for (i = 0; i< MAX_NUM; i++) currentvalue = arrayvalues[i]; arrayvalues[i] = Math.abs ( currentvalue ); trace( gettimer() - started ); // output : 70 Math.abs().

ActionScript 3.0 41 const MAX_NUM:int = 500000; var arrayvalues:vector.<number>=new Vector.<Number>(MAX_NUM,true); var i:int; for (i = 0; i< MAX_NUM; i++) arrayvalues[i] = Math.random()-Math.random(); var started:number = gettimer(); var currentvalue:number; for (i = 0; i< MAX_NUM; i++) currentvalue = arrayvalues[i]; arrayvalues[i] = currentvalue > 0? currentvalue : -currentvalue; trace( gettimer() - started ); // output : 15 4.. :. ActionScript JIT.. Adobe Flex, TLF ActionScript.... for (var i:int = 0; i< myarray.length; i++). var lng:int = myarray.length; for (var i:int = 0; i< lng; i++) while. while. var i:int = myarray.length; while (--i > -1) ActionScript,. ActionScript. http://www.rozengain.com/blog/2007/05/01/some-actionscript-30-optimizations/.

42 5 :.. Flash Player. Flash Player [ ]. : [ ] Adobe AIR Flash Player. Adobe AIR, [ ]. MovieClip. flash.profiler.showredrawregions(). // Enable Show Redraw Regions // Blue color is used to show redrawn regions flash.profiler.showredrawregions ( true, 0x0000FF ); Adobe AIR.. CPU.... CPU.

43 visible false.. CPU... 25.,....

44......

45. StageQuality.LOW:. TV Adobe AIR. StageQuality.MEDIUM:. AIR TV AIR. StageQuality.HIGH: ( ). SWF. StageQuality.BEST:.. StageQuality.MEDIUM StageQuality.LOW. Flash Player 8 LOW. : HIGH Flash Player MEDIUM. HIGH. dpi. dpi. MEDIUM....

46 ( ). ( ). Flash Player 8. Flash Player 10.1 StageQuality.MEDIUM. alpha. alpha ( : ).... alpha. 48 59

47.. 1 " "... CPU.. Flex.. 20. 30. 12. " ". " "......,. Stage.frameRate ( Flex WindowedApplication.frameRate )..,..... Flex.. 20. 30. 12.. 12. 5. AIR 2.. visible false.

48 Flex spark.components. WindowedApplication. backgroundframerate. 1, Spark 1. backgroundframerate., -1.. Reducing CPU usage in Adobe AIR(Jonnie Hallman Adobe ) Writing well-behaved, efficient, AIR applications(arno Gourdol ) Grant Skinner.. FramerateThrottler http://gskinner.com/blog/archives/2009/05/idle_cpu_usage.html Grant Idle CPU Usage in Adobe AIR and Flash Player. SWF. CPU... :.. fps...... ( : ),.., CPU.. Sprite. x y.,,. : AIR Packager for iphone DisplayObject.cacheAsBitmapMatrix. cacheasbitmapmatrix.. 250 x 250 1KB 250KB. Sprite..

49 package org.bytearray.bitmap import flash.display.sprite; import flash.events.event; public class Apple extends Sprite private var destinationx:number; private var destinationy:number; public function Apple () addeventlistener(event.added_to_stage,activation); addeventlistener(event.removed_from_stage,deactivation); private function activation(e:event):void initpos(); addeventlistener (Event.ENTER_FRAME,handleMovement); private function deactivation(e:event):void removeeventlistener(event.enter_frame,handlemovement); private function initpos():void destinationx = Math.random()*(stage.stageWidth - (width>>1)); destinationy = Math.random()*(stage.stageHeight - (height>>1)); private function handlemovement(e:event):void x -= (x - destinationx)*.5; y -= (y - destinationy)*.5; if (Math.abs(x - destinationx) < 1 && Math.abs(y - destinationy) < 1) initpos(); MovieClip Sprite...

50 import org.bytearray.bitmap.apple; stage.addeventlistener(mouseevent.click,createapples); stage.addeventlistener(keyboardevent.key_down,cacheapples); const MAX_NUM:int = 100; var apple:apple; var holder:sprite = new Sprite(); addchild(holder); function createapples(e:mouseevent):void for (var i:int = 0; i< MAX_NUM; i++) apple = new Apple(); holder.addchild(apple); function cacheapples(e:keyboardevent):void if (e.keycode == 67) var lng:int = holder.numchildren; for (var i:int = 0; i < lng; i++) apple = holder.getchildat (i) as Apple; apple.cacheasbitmap = Boolean(!apple.cacheAsBitmap);. C ( 67). CPU... cacheasbitmap = true

51 Flash Player 10.1 AIR 2.5 18.. : opaquebackground, cacheasbitmap 32. 0xFF.. 16 16. opaquebackground. cacheasbitmap. 211 x 279. 229KB. 211 279. 7KB 6 42KB.

52 getchildat() Vector. import org.bytearray.bitmap.apple; stage.addeventlistener(keyboardevent.key_down, cacheapples); const MAX_NUM:int = 200; var apple:apple; var holder:sprite = new Sprite(); addchild(holder); var holdervector:vector.<apple> = new Vector.<Apple>(MAX_NUM, true); for (var i:int = 0; i< MAX_NUM; i++) apple = new Apple(); holder.addchild(apple); holdervector[i] = apple; function cacheapples(e:keyboardevent):void if (e.keycode == 67) var lng:int = holdervector.length for (var i:int = 0; i < lng; i++) apple = holdervector[i]; apple.cacheasbitmap = Boolean(!apple.cacheAsBitmap);,. x y. Flash Player. CPU. AIR Packager for iphone cacheasbitmapmatrix.. private function handlemovement(e:event):void alpha = Math.random(); x -= (x - destinationx)*.5; y -= (y - destinationy)*.5; if (Math.abs(x - destinationx) < 1 && Math.abs(y - destinationy) < 1) initpos();... cacheasbitmap true..

53... x y., CPU. Paul Trani Flash Professional ActionScript. ActionScript AIR AIR cacheasbitmapmatrix. AIR cacheasbitmapmatrix Matrix. 2D.. cacheasbitmap true, 3D. cacheasbitmapmatrix visible false. cacheasbitmapmatrix. cacheasbitmapmatrix. 2..

54... displayobject.cacheasbitmap = true; displayobject.cacheasbitmapmatrix = new Matrix(); cacheasbitmapmatrix,,. 0 1. transform.colortransform 0 255.. cacheasbitmap true cacheasbitmapmatrix.,. BitmapData. BitmapData. BitmapData. CPU.. BitmapApple. package org.bytearray.bitmap import flash.display.bitmap; import flash.display.bitmapdata; import flash.events.event; public class BitmapApple extends Bitmap private var destinationx:number; private var destinationy:number; public function BitmapApple(buffer:BitmapData) super(buffer); addeventlistener(event.added_to_stage,activation); addeventlistener(event.removed_from_stage,deactivation); private function activation(e:event):void initpos(); addeventlistener(event.enter_frame,handlemovement); private function deactivation(e:event):void removeeventlistener(event.enter_frame,handlemovement);

55 private function initpos():void destinationx = Math.random()*(stage.stageWidth - (width>>1)); destinationy = Math.random()*(stage.stageHeight - (height>>1)); private function handlemovement(e:event):void alpha = Math.random(); x -= (x - destinationx)*.5; y -= (y - destinationy)*.5; if ( Math.abs(x - destinationx) < 1 && Math.abs(y - destinationy) < 1) initpos();. BitmapApple. import org.bytearray.bitmap.bitmapapple; const MAX_NUM:int = 100; var holder:sprite = new Sprite(); addchild(holder); var holdervector:vector.<bitmapapple> = new Vector.<BitmapApple>(MAX_NUM, true); var source:applesource = new AppleSource(); var bounds:object = source.getbounds(source); var mat:matrix = new Matrix(); mat.translate(-bounds.x,-bounds.y); var buffer:bitmapdata = new BitmapData(source.width+1, source.height+1, true, 0); buffer.draw(source,mat); var bitmapapple:bitmapapple; for (var i:int = 0; i< MAX_NUM; i++) bitmapapple = new BitmapApple(buffer); holdervector[i] = bitmapapple; holder.addchild(bitmapapple); BitmapApple., BitmapApple.. smoothing true.

56 public function BitmapApple(buffer:BitmapData) super (buffer); smoothing = true; addeventlistener(event.added_to_stage, activation); addeventlistener(event.removed_from_stage, deactivation);. HIGH LOW. import org.bytearray.bitmap.bitmapapple; const MAX_NUM:int = 100; var holder:sprite = new Sprite(); addchild ( holder ); var holdervector:vector.<bitmapapple> = new Vector.<BitmapApple>(MAX_NUM, true); var source:applesource = new AppleSource(); var bounds:object = source.getbounds ( source ); var mat:matrix = new Matrix(); mat.translate ( -bounds.x, -bounds.y ); var buffer:bitmapdata = new BitmapData ( source.width+1, source.height+1, true, 0 ); stage.quality = StageQuality.HIGH; buffer.draw ( source, mat ); stage.quality = StageQuality.LOW; var bitmapapple:bitmapapple; for (var i:int = 0; i< MAX_NUM; i++ ) bitmapapple = new BitmapApple( buffer ); holdervector[i] = bitmapapple; holder.addchild ( bitmapapple );.. LOW. cacheasbitmap. LOW,. Event.ENTER_FRAME. Apple Event.ENTER_FRAME. CPU. BitmapApple.

57 package org.bytearray.bitmap import flash.display.bitmap; import flash.display.bitmapdata; public class BitmapApple extends Bitmap private var destinationx:number; private var destinationy:number; public function BitmapApple(buffer:BitmapData) super (buffer); smoothing = true;. import org.bytearray.bitmap.bitmapapple; const MAX_NUM:int = 100; var holder:sprite = new Sprite(); addchild(holder); var holdervector:vector.<bitmapapple> = new Vector.<BitmapApple>(MAX_NUM, true); var source:applesource = new AppleSource(); var bounds:object = source.getbounds(source); var mat:matrix = new Matrix(); mat.translate(-bounds.x,-bounds.y); stage.quality = StageQuality.BEST; var buffer:bitmapdata = new BitmapData(source.width+1,source.height+1, true,0); buffer.draw(source,mat); stage.quality = StageQuality.LOW; var bitmapapple:bitmapapple; for (var i:int = 0; i< MAX_NUM; i++) bitmapapple = new BitmapApple(buffer); bitmapapple.destinationx = Math.random()*stage.stageWidth; bitmapapple.destinationy = Math.random()*stage.stageHeight; holdervector[i] = bitmapapple; holder.addchild(bitmapapple); stage.addeventlistener(event.enter_frame,onframe);

58 var lng:int = holdervector.length function onframe(e:event):void for (var i:int = 0; i < lng; i++) bitmapapple = holdervector[i]; bitmapapple.alpha = Math.random(); bitmapapple.x -= (bitmapapple.x - bitmapapple.destinationx) *.5; bitmapapple.y -= (bitmapapple.y - bitmapapple.destinationy) *.5; if (Math.abs(bitmapApple.x - bitmapapple.destinationx ) < 1 && Math.abs(bitmapApple.y - bitmapapple.destinationy ) < 1) bitmapapple.destinationx = Math.random()*stage.stageWidth; bitmapapple.destinationy = Math.random()*stage.stageHeight; 200 Event.ENTER_FRAME... stage.addeventlistener(event.enter_frame, updategame); function updategame (e:event):void gameengine.update();. BitmapApple. package org.bytearray.bitmap import flash.display.bitmap; import flash.display.bitmapdata; import flash.display.sprite; public class BitmapApple extends Sprite public var destinationx:number; public var destinationy:number; private var container:sprite; private var containerbitmap:bitmap; public function BitmapApple(buffer:BitmapData) container = new Sprite(); containerbitmap = new Bitmap(buffer); containerbitmap.smoothing = true; container.addchild(containerbitmap); addchild(container); Sprite BitmapApple..

59 opaquebackground. Flash Text Engine.. TextLine ActionScript. TextLine... opaquebackground.. TextField..

60. preloader. wait_mc.addeventlistener( Event.ENTER_FRAME, moveposition ); var destx:number=stage.stagewidth/2; var desty:number=stage.stageheight/2; var preloader:displayobject; function moveposition( e:event ):void preloader = e.currenttarget as DisplayObject; preloader.x -= ( preloader.x - destx ) *.1; preloader.y -= ( preloader.y - desty ) *.1; if (Math.abs(preloader.y-destY)<1) preloader.removeeventlistener( Event.ENTER_FRAME, moveposition ); Math.abs(). destx desty int. int Math.ceil() Math.round(). int....

61 // Do not use this code var destx:number = Math.round ( stage.stagewidth / 2 ); var desty:number = Math.round ( stage.stageheight / 2);. var destx:int = stage.stagewidth / 2; var desty:int = stage.stageheight / 2;. var destx:int = stage.stagewidth >> 1; var desty:int = stage.stageheight >> 1;. TextField. wait_mc.cacheasbitmap = true;.. opaquebackground. opaquebackground 32. 255. opaquebackground.. wait_mc.addeventlistener( Event.ENTER_FRAME, moveposition ); wait_mc.cacheasbitmap = true; // Set the background to the color of the scene background wait_mc.opaquebackground = 0x8AD6FD; var destx:int = stage.stagewidth >> 1; var desty:int = stage.stageheight >> 1; var preloader:displayobject; function moveposition ( e:event ):void preloader = e.currenttarget as DisplayObject; preloader.x -= ( preloader.x - destx ) *.1; preloader.y -= ( preloader.y - desty ) *.1; if ( Math.abs ( preloader.y - desty ) < 1 ) e.currenttarget.removeeventlistener ( Event.ENTER_FRAME, moveposition );. LOW HIGH.

62 wait_mc.addeventlistener( Event.ENTER_FRAME, moveposition ); wait_mc.cacheasbitmap = true; wait_mc.opaquebackground = 0x8AD6FD; // Switch to low quality stage.quality = StageQuality.LOW; var destx:int = stage.stagewidth>>1; var desty:int = stage.stageheight>>1; var preloader:displayobject; function moveposition( e:event ):void preloader = e.currenttarget as DisplayObject; preloader.x -= ( preloader.x - destx ) *.1; preloader.y -= ( preloader.y - desty ) *.1; if (Math.abs(e.currentTarget.y-destY)<1) // Switch back to high quality stage.quality = StageQuality.HIGH; preloader.removeeventlistener( Event.ENTER_FRAME, moveposition ); TextField... BitmapData opaquebackground...... BitmapData.draw(). Flash Player 8( AIR 1.0). CPU..

63 wait_mc.addeventlistener( Event.ENTER_FRAME, moveposition ); // Switch to low quality stage.quality = StageQuality.LOW; var destx:int = stage.stagewidth >> 1; var desty:int = stage.stageheight >> 1; var preloader:displayobject; function moveposition ( e:event ):void preloader = e.currenttarget as DisplayObject; preloader.x -= ( preloader.x - destx ) *.1; preloader.y -= ( preloader.y - desty ) *.1; if ( Math.abs ( preloader.y - desty ) < 1 ) // Switch back to high quality stage.quality = StageQuality.HIGH; preloader.removeeventlistener ( Event.ENTER_FRAME, moveposition ); ( ).. LOW. HIGH. GPU Flash Player GPU Flash Player 10.1 GPU. CPU. GPU,,. GPU.. Flash Player 10.1 Pixel Bender.. Flash Player 10 GPU GPU. GPU. Flash Player 10.1 GPU. CPU ( : ). GPU. GPU wmode gpu wmode opaque transparent GPU. : Flash Player CPU... AIR GPU AIR <rendermode>gpu</rendermode>.. rendermode GPU.

64 GPU AIR 2.5 GPU. GPU, CPU. layer, alpha, erase, overlay, hardlight, lighten darken.. PixelBender. GPU 1024x1024. ActionScript. AIR GPU. GPU..,. GPU. AIR. GPU GPU... visible false. alpha 0. removechild().. 2 n x 2 m. 2, 2 2. 31 x 15 33 x 17. 31 15 2: 32 16. Graphic.beginBitmapFill() repeat false.....,,... cacheasbitmap cacheasbitmapmatrix. ActionScript API(Graphics )... AIR 2.0.3 GPU GPU Packager for iphone AIR. GPU cacheasbitmap,. cacheasbitmap cacheasbitmapmatrix GPU. GPU.

65 GPU GPU SWF. GPU. GPU. : SWF. SWF. HTML wmode=transparent wmode=opaque.. -. GPU.,,. GPU. GPU..,.. GPU. ( : ). GPU. 500 500 100 10. GPU.,... GPU...... GPU..........

66....... 2..,.. Adobe AIR. File FileStream File.,. "Async"., File.deleteFile() File.deleteFileAsync(). FileStream FileStream. FileStream.openAsync()... FileStream. SQL SQL SQLConnection. SQLConnection.open() SQLConnection.openAsync()... SQL 78 SQL. Pixel Bender ShaderJob Pixel Bender. ShaderJob.start().. ShaderJob ( ) true start()....... Timer... Asynchronous ActionScript Execution(Trevor McCauley, ) Parsing & Rendering Lots of Data in Flash Player(Jesse Warden, "builder pattern green threads )

67 Green Threads(Drew Cummins, green threads ) greenthreads(charlie Hubbard, ActionScript green threads. greenthreads Quick Start ) http://www.adobe.com/go/learn_fp_as3_threads_kr(" " Alex Harui ) ActionScript 3 AIR. AIR XML. <initialwindow> <transparent>false</transparent> </initialwindow> transparent false( ) NativeWindowInitOptions. NativeWindow NativeWindow. // NativeWindow: flash.display.nativewindow class var initoptions:nativewindowinitoptions = new NativeWindowInitOptions(); initoptions.transparent = false; var win:nativewindow = new NativeWindow(initOptions); Flex Window Window open() false( ). // Flex window component: spark.components.window class var win:window = new Window(); win.transparent = false; win.open();.....,....

68 Flash Professional. Adobe Illustrator [ ]. SWF....

69 6 : Flash Player 10.1 AIR 2.5... Flash Player 10.1 AIR 2.5 FLV ( MP4 )......,...., RAM. 4MB RAM 20MB. :. RAM. RAM. MP4. MP4... NetStream.seek() NetStream.Seek.InvalidTime. : Adobe Flash Media Server 3.5.3. Flash Player 10.1 AIR 2.5... (NetStream.bufferTime) 20 10 10... buffertime.

70..... :. NetStream.inBufferSeek true. SWF.. SWF,. SWF.

71 portfolio.swf infos.swf contact.swf 10KB 10KB 10KB main.swf 10KB preload.swf 40KB SWF SWF.. portfolio.swf infos.swf contact.swf main.swf preload.swf library.swf 10KB 10KB SWF. ApplicationDomain getdefinition()... SWF.,, ActionScript.

72 // Create a Loader object var loader:loader = new Loader(); // Listen to the Event.COMPLETE event loader.contentloaderinfo.addeventlistener(event.complete, loadingcomplete ); // Load the SWF file loader.load(new URLRequest("library.swf") ); var classdefinition:string = "Logo"; function loadingcomplete(e:event ):void var objectloaderinfo:loaderinfo = LoaderInfo ( e.target ); // Get a reference to the loaded SWF file application domain var appdomain:applicationdomain = objectloaderinfo.applicationdomain; // Check whether the definition is available if ( appdomain.hasdefinition(classdefinition) ) // Extract definition var importlogo:class = Class ( appdomain.getdefinition(classdefinition) ); // Instantiate logo var instancelogo:bitmapdata = new importlogo(0,0); // Add it to the display list addchild ( new Bitmap ( instancelogo ) ); else trace ("The class definition " + classdefinition + " is not available."); SWF. // Create a Loader object var loader:loader = new Loader(); // Listen to the Event.COMPLETE event loader.contentloaderinfo.addeventlistener ( Event.COMPLETE, loadingcomplete ); // Load the SWF file loader.load ( new URLRequest ("rsl.swf"), new LoaderContext ( false, ApplicationDomain.currentDomain) ); var classdefinition:string = "Logo"; function loadingcomplete ( e:event ):void var objectloaderinfo:loaderinfo = LoaderInfo ( e.target ); // Get a reference to the current SWF file application domain var appdomain:applicationdomain = ApplicationDomain.currentDomain; // Check whether the definition is available if (appdomain.hasdefinition( classdefinition ) ) // Extract definition var importlogo:class = Class ( appdomain.getdefinition(classdefinition) ); // Instantiate it var instancelogo:bitmapdata = new importlogo(0,0); // Add it to the display list addchild ( new Bitmap ( instancelogo ) ); else trace ("The class definition " + classdefinition + " is not available.");

73 SWF getdefinition(). getdefinitionbyname(). SWF. loader.swf. SWF. IO... IO_ERROR.... IO.. var loader:loader = new Loader(); loader.contentloaderinfo.addeventlistener( Event.COMPLETE, oncomplete ); addchild( loader ); loader.load( new URLRequest ("asset.swf" ) ); function oncomplete( e:event ):void var loader:loader = e.currenttarget.loader; loader.x = ( stage.stagewidth - e.currenttarget.width ) >> 1; loader.y = ( stage.stageheight - e.currenttarget.height ) >> 1;.. var loader:loader = new Loader(); loader.contentloaderinfo.addeventlistener ( Event.COMPLETE, oncomplete ); loader.contentloaderinfo.addeventlistener ( IOErrorEvent.IO_ERROR, onioerror ); addchild ( loader ); loader.load ( new URLRequest ("asset.swf" ) ); function oncomplete ( e:event ):void var loader:loader = e.currenttarget.loader; loader.x = ( stage.stagewidth - e.currenttarget.width ) >> 1; loader.y = ( stage.stageheight - e.currenttarget.height ) >> 1; function onioerror ( e:ioerrorevent ):void // Show a message explaining the situation and try to reload the asset. // If it fails again, ask the user to retry when the connection will be restored. onioerror().

74 Flash Remoting - Flash Remoting AMF. XML SWF. XML. Flash Remoting AMF(Action Message Format). AMF. AMF. AMF AMF.. ActionScript... Flash Remoting ZendAMF, FluorineFX, WebORB Adobe Java Flash Remoting BlazeDS. Flash Remoting. HTTP AMF ZendAMF Web ORB RubyAMF FluorineFX BlazeDS (PHP Class, Java, C#...) Flash Remoting NetConnection Flash Remoting. // Create the NetConnection object var connection:netconnection = new NetConnection (); // Connect to a Flash Remoting gateway connection.connect ("http://www.yourserver.com/remotingservice/gateway.php"); // Asynchronous handlers for incoming data and errors function success ( incomingdata:* ):void trace( incomingdata ); function error ( error:* ):void trace( "Error occured" ); // Create an object that handles the mapping to success and error handlers var serverresult:responder = new Responder (success, error); // Call the remote method connection.call ("org.yourserver.helloworld.sayhello", serverresult, "Hello there?");. Adobe Flex SDK RemoteObject Flash Remoting. : Flex SWC Adobe Flash Professional. SWC Flex SDK RemoteObject. Socket.