flash/flash8 에 해당하는 글5 개
2006/12/21   Object Drawing Model
2006/10/16   Frame rates in the Flash Player
2006/10/12   BitmapData trouble shooting
2006/08/28   FileReference Class Tip (2)
2006/08/06   Use Alpha Gradiant Masks

flash/flash8 | 2006/12/21 13:20
What is Object Drawing Model?

OBD 란 이전버전에서는 할 수 없었던 오브젝트 드로잉을 가능하게 해주는 기능이다.
플래시에서 drawing tool 로 같은 레이어에 어떤 shape를 그리게 되면 single object로 인식해
shape 간에 겹치는 부분이 생기게 되면 한개의 오브젝트로 바뀌게 된다.
OBD 란 이런 single object 를 overlapping shape 로 드로잉 가능하게 해준다.



물론 grouping 과 비슷한 개념이긴 하지만 약간의 차이가 있다.
OBD 로 그린 오브젝트는 group 오브제트가 할 수 없는 fill and stroke color 를 조정할 수 있다.
또한 Envelope , transformations 이 가능하다.




그리고 두개의 overlapping OBD shapes 를 선택하게 되면 Modify-Combine Objects 의 메뉴가 활성화 된다.
이 메뉴를 이용하여 Union, Intersect, Punch and Crop 할 수 있다.

 
 
태그 : flash, OBD, Tip
이 글의 관련글(트랙백) 주소 :: http://kimkijeung.com/trackback/75

Name 
Password 
Homepage 
  secret
Comment 
  글쓰기

flash/flash8 | 2006/10/16 16:19
There have been numerous posts about frame rate issues in Flash over the years, sometimes with quite inconsistent tips and workarounds. As we are approaching the final phase of development for Flash Player 9 at Adobe our bug database is filling up with duplicate bugs concerning old known issues. What is frustrating to designers is that they perceive the Flash Player changing its behavior over the past few releases, although it has not. Well, that might actually be the problem.

Flash uses a relative timing model, meaning it does not really care about a global frame rate, but will instead try to enforce frame intervals as best as it can. Say you have f.ex. set your frame rate to 30 frames/sec. That means that the Flash Player will try to wait for 33 milliseconds before trying to display the next frame (excluding the time it takes to render the frame). This loose timing causes all kinds of problems. First, the Flash Player depends on high level OS events to deliver timing messages. In the worst case this means the use of WM_TIMER, dependence on the NetScape plugin API or in the best case we use multimedia timers provided by a special Internet Explorer API. Second, we round frame intervals to milliseconds since Windows and MacOS can't support fractional time intervals. Third, the OS, the browser and the Flash Player will add overhead to the code executed on each frame, meaning that in the end the actual frame rate will sway between -10 to +5 frames/sec from the actual selected frame rate, depending in what environment you play it in. In Flash Player 8 and Flash Player 9 new overhead is originating mostly from the GC, something for which there is no workaround. As I said we do not calculate frame rates on a global basis so we can't correct it actively.

Lets talk about maximum frame rates. In Internet Explorer this is 100 frames/sec. Why? Because the minimum time slice Windows timers can provide is 10 milliseconds. What about FireFox? FireFox does not use special timers and made a decision to limit the maximum frame rate for plugins. Why? The thinking is that users constantly complain that plugins take too much CPU time. A valid complaint I think and every designer who puts online ads out there at higher than 8-12 frames/sec and more that 2 or 3% CPU usage should be ashamed. While a single ad will not be a problem, most pages easily serve 2 or 3 ads on a single page.

The Mozilla team also decided that plugins would get no time when they are on a hidden tab so it would not render the browser unresponsive or less responsive by adding new tabs. So do not be surprised if your SWFs and FLVs do no play on hidden tabs. Apple went even a step further in Safari: If the browser is not active, plugins will only get about 4 frames/sec, mainly to save battery and avoid the dreaded noise of the fans. Try it, go to Google Video, play a video and then switch to another application. The frame rate will drop to about 4 frames/sec. While we could drive our own background thread and work around this, there is a reason they decided to take these steps. We would be ill advised to just hack around it.

What does this mean? Well, the frame rate you select does not really mean too much and you should not depend on it in a way to be accurate to the millisecond. This especially goes for ANY sort of synchronization. If you need synchronization your only choice is placing code in ActionScript which will 'correct' your timing or workarounds like placing a streaming sound on your main time line (In which case we use the audio device to report time correctly to the nanosecond. Due to bugs this does not work correctly on Linux right now, which is the reason audio and video are out of sync, even for FLVs :-( )

What does the future hold? As I explained in a earlier post we will likely add synchronization primitives into the player to allow SMILE like global timing at some point. But there is also a good chance we'll limit what users can actually do when it comes to frame rates and overall CPU usage. There are various ways we could enforce low CPU usage. SWF files originating from a different domain (speaking advertisement) could get a lower priority and have a frame rate cap which would be user selectable. Secondly, with the advent of GPU support in the OS there will be a time when we finally add VBL wait, meaning tearing free drawing. In most cases this means the maximum frame rate will be 60 frames/sec. On high CPU load we might actually cut this into half, e.g. 30 frames/sec. OS X already does this in certain conditions.

firefox 와 safari 에서 유독 flash framerate 가 떨어지는 현상이 있다고 느꼈었는데... 강제로 플러그인에서 막아놓은 결과였다. 무분별한 framerate 의 사용으로 인해 사이트가 느려지고 사용자 컴퓨터가 다운되는 걸 막기 위한 궁여지책이 아닌가 생각든다.
flash player 9 에서는 framerate 0.1 에서 1000까지 지원한다고 나와있지만 과연 어느정도의 성능을 보여줄지..
위에서 언급한 내용대로라면 플레이어 근본을 바꾸지 않는다면 힘들다는 생각이 들지만 AS3 을 기반으로 제작한 flash player 9 의 성능은 AVM2 로 전혀 새로운 머신으로 탈바꿈했다고 하니 한번 기대해 볼만하다.
근데 사운드가 포함된 stream 파일도 200-300 framerate 를 지원할까궁금하다.

 
 
태그 : flash player, framerate
이 글의 관련글(트랙백) 주소 :: http://kimkijeung.com/trackback/64

Name 
Password 
Homepage 
  secret
Comment 
  글쓰기

flash/flash8 | 2006/10/12 21:05
Drawing Method 와 BitmapData 간의 충돌문제

Drawing Method를 통해 생성한 객체를 마스크 클립으로 활용할때(특히, 동적으로 scroll mask 만들때)
마스크되어지는 클립안에 Transition 되는 BitmapData 객체가 있을 경우 BitmapData의 외곽선이 Redrawing
되는 현상이 발생한다. (flash player 에서 다시그리기 생성탭을 클릭했을때와 비슷한 현상)

따라서 Transition 되는 무비클립을 BitmapData 로 생성한 오브젝트로 마스크를 적용할경우 반드시 마스크 오브젝트는 비트맵이어야한다.

cacheAsBitmap 속성을 true 로 설정해야함.

 
 
태그 : BitmapData, bug, flash
이 글의 관련글(트랙백) 주소 :: http://kimkijeung.com/trackback/61

Name 
Password 
Homepage 
  secret
Comment 
  글쓰기

flash/flash8 | 2006/08/28 17:54

현재 flash8 에서 지원하는 파일 업로드 클래스인 FileReference 는 어쩌면 반쪽짜리 업로드 클래스이다. 왜냐하면 파일업로드 완료시 서버와의 어떤 변수 값도 받을 수 없기 때문이다.
물론 onComplete 가 업로드 완료시에 플래시 쪽에서 호출되지만 이는 단순히 업로드 완료만 알수 있는것이다.
특별히 안정적으로 업로드를 구성하지 않는다면 다시말해, 개인이 업로드를 관리하고 사용자가 많지 않을경우 물론 업로드가  완료되는 이벤트만 발생되어도 문제가 없다.
하지만 사용자가 많은 경우, 예를 들어 사용자가 사진을 업로드하는 사이트를 만들경우,
이런 경우에는 반드시 업로드하는 클라이언트 파일명을 바꾸어야 할 필요가 있다.
중복의 여지가 있기 때문이다. 만약 이런 파일 필터링을 거치지 않는다면 분명히 파일이름이 같게되어 이전 파일이 덮어써지는 현상이 발생할 것이다.

따라서 좀더 안정적인 파일 업로드 구현을 원한다면 파일 생성 일자나 일련의 첨자를 붙여 파일 이름을 변경하는 것은 필수이다.
이때 문제가 되는 것이 바로 위에 언급한 서버와 플래시간의 변수 교환문제이다.

FileReference class 에서의 upload()  method의 파라미터에는 서버파일의 데이타를 받을수 없다.
따라서 서버에서 파일 이름을 임의로 변경해 버리면 플래시에서 알 수 있는 방법이 없다.
물론 약간의 팁을 사용하면 가능하다.

다행이도 upload url에 매개변수를 첨부하여 서버에 전송할 수 있다.
바로 이런방법으로 서버에서 파일명을 저장하는 것이 아니라 플래시에서 정한 파일명을 서버로 보내 그걸 파일명으로 저장하면 위와 같은 문제를 해결할 수 있다.

<upLoad.as>
private function upload():Void
{
var success:Boolean;
noRep=new Date().getTime();
success = this._fileRef.upload(UploadExample.URL+"?noRep="+noRep); 
  // url에 중복을 피하기 위한 현재 시간 정보를 첨부한다.
}

private function onComplete(fileRef:FileReference):Void
{
  trace(file Name--->"+noRep+"_"+fileRef.name);
  //업로드 완료시 서버에 저장완료된 파일명을 알수 있다.
}


<upload.php>
<?php

//path to storage
$storage = 'uploadedFiles';

$upFile="$storage/".$noRep.'_'.$_FILES['Filedata']['name'];

//if the file is moved successfully
if ( move_uploaded_file( $_FILES['Filedata']['tmp_name'] , $upFile ) ) {
echo( '1 ' . $_FILES['Filedata']['name']);

//file failed to move
}else{
echo( '0');
}

?>

AS3.0 에서 업로드 데이타 필드명을 따로 플래시에서 지정할 수 있게 바뀌었지만 서버에서의 변수 문제는 제공해 주질않았다.


 
 
태그 : As2.0, filereference, Tip
이 글의 관련글(트랙백) 주소 :: http://kimkijeung.com/trackback/54
BlogIcon 지돌스타 2008/05/04 12:33 ReplyDelete
Flash Player 9.0.28.0 부터는 서버측에서 송신되는 내용을 받을 수 있습니다.

http://blog.jidolstar.com/324
BlogIcon 기정e 2008/05/06 21:12 ReplyDelete
flash CS3 정식버전 출시 이전에 작성한 포스트라서 미처 업데이트를 못했네요... 혹시나 이글을 보고 as3.0 도 이전과 다른게 없구나 하고 잘못 생각하실 수 도 있는데....코멘트 감사드립니다. ^^

Name 
Password 
Homepage 
  secret
Comment 
  글쓰기

flash/flash8 | 2006/08/06 07:49

flash8 이 출시된지 반년 이상이 지났다.
정말 출시전에는 엄청난 기능상의 변화, 그리고 놀라운 퍼포먼스의 향상과 같은 프리뷰 내용으로 잔뜩 기대감에 부풀어 있었지만 정작 뚜껑을 열어보고 사용해보니 기대가 너무 컸던 탓일까...
지금에 와서는 좀 아쉬는 생각이 든다.
플래시에서도 photoshop과 같은 필터효과를 줄 수 있다라는 말에 정말 이젠 플래시로 표현 못하는것이 없겠구나 하는 했지만....원하는 정도의 효과를 사용한다면 너무 느려지는 퍼포먼스로 인해 도저히
봐줄수 없는 상태......

물론 BitmapData 의 도입으로 기존에는 할수 없었던 것들을 할수있다.
하지만 게으름때문인지는 몰라도 이런 위의 문제점으로 성능상에 문제가 있을거야 하는 내나름의 한계를 그어버리는 건지도 모른다. as3.0이 본격적으로 사용되면 최대 9배 이상의 성능향상이 있다고 한다. 그렇게 되면 핑계도 없어질텐데....
정말 해봐야 할것 많은데...몸이 따라주질 않는다..

전에 한번 flash 8 에서 비트맵을 지원해서 Mask 에서도 alpha 값을 사용할 수도 있다는 내용을 본적이 있어 이것저것 테스트 해보았는데 정말 alpha gradiant 를 Mask 에서도 사용할수 있었다.

maskee.cacheAsBitmap = true;
maskMC.cacheAsBitmap = true;



actionscript 에서 적용하려면 mask 무비클립과 mask 되어지는 무비클립에 cacheAsBitmap 을 적용해 비트맵으로 전환한다.
그리고 alpha gradiant  를 적용할 mask를 제작하여 적용하면 된다.

movieclip property 창에서 적용할 수도 있다. Use runtime bitmap caching 을 체크해주면 위와 똑같은 기능을 한다.

flash를 사용할때면 alpha 값이 적용된 mask를 꼭 한번 사용할 일이 있을것이다.
그때 잊지말고.....


 
 
태그 : alpha, flash8, mask, Tip
이 글의 관련글(트랙백) 주소 :: http://kimkijeung.com/trackback/43

Name 
Password 
Homepage 
  secret
Comment 
  글쓰기


[PREV] [1] [NEXT]

 
전체 (105)
flash (74)
math&physics (4)
programming (11)
Flex2 (1)
Mac (2)
photo (0)
project (6)
주저리주저리 (3)
유용한 자료들 (1)
diary (0)
Book (1)
web (2)
«   2009/01   »
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31