Tag Archive for 'wmode'

wmode and setInterval

IE 에서 wmode 를 적용한 swf 파일과 default swf 파일간의 차이점이 있다.
즉, opaque 또는 transparent 로 설정하고 swf 실행할 경우 발행하는 모든 이벤트 들이 프레임 갱신때 까지 딜레이 된다는 점이다. 다시말해 프레임 속도보다 빨리 실행하지 못한다는 말이다.
문제가 되는 부분은 프레임 보다 빨리 setInterval 을 사용하여 함수를 실행할때 발생하게 된다.
flash IDE 에서는 정상적으로 interval 값이 설정되어 호출되지만 wmode 가 설정된 html 파일을 IE 에서 확인할 경우 기존에 설정해 놓은 framerate 보다 빨리 호출되지 않는다. 이것은 IE 의 버그로서 firefox 에서는 발생하지 않는다.

bug test

wmode and performance

  • Window: Use the Window value to play a Flash Player movie in its own rectangular window on a web page. This is the default value for wmode and it works the way the classic Flash Player works. This normally provides the fastest animation performance.
  • Opaque: By using the Opaque value you can use JavaScript to move or resize movies that don’t need a transparent background. Opaque mode makes the movie hide everything behind it on the page. Additionally, opaque mode moves elements behind Flash movies (for example, with dynamic HTML) to prevent them from showing through.
  • Transparent: Transparent mode allows the background of the HTML page, or the DHTML layer underneath the Flash movie or layer, to show through all the transparent portions of the movie. This allows you to overlap the movie with other elements of the HTML page. Animation performance might be slower when you use this value.

wmode 를 그다지 신경쓰지 않고 있던 부분이기 하지만 간과하기에는 너무 큰 performance 차이를 보였다. 실제 전에도 웹에 올리기 전(플래시 플레이어에서 확인했을시) 에는 별 무리 없이 돌아가던 사이트가 웹상에 올리고 나면  framerate 가 떨어지는 느낌을 받았던 적이 많았다.

이건 정확히 말하자면 웹상에 올려서라기 보단 html 로 사이트를 봤기 때문이란 생각이 든다.

이전에 포스팅한 글에서 framerate 와 브라우저 간의 관계에서 브라우저 플러그인에서는 과도한 cpu 사용을 막기위한 방법으로 강제로 framerate를 떨어뜨리는 현상을 볼 수 있다.

그래서 html 페이지에서 플래시 파일을 확인하면 framerate 가 떨어지는 것이다.

보통 사이트 제작시에는 wmode 를 설정하지 않았다. default 인 window 로 설정한 것이다.

보통 wmode는 DHTML 을 flash 와 같이 사용하기 위해 설정하는 것으로 알고 있다.

하지만 wmode 와 performance 와의 상관관계가 상당부분 있는 것 같다.

대부분의 레퍼런스 문서나 자료에는 wmode 가 window 일때 가장 에니메이션 성능이 좋다고 나온다고 말하고 있지만 실제 테스트 결과 opaque 가 가장 좋은 framerate 를 보였다.

이부분이 가장 의문시 되었던 점이다. 분명 테스트를 해보고 레퍼런스를 제작했을텐데 왜 이런결과가 나오는 것일까?…레퍼런스에서 나오는 성능은 framerate와는 좀 다른 의미로 쓰인것일까 의문이 들었다.

하지만 이 의문점은 테스트를 하면서 자연스럽게 해결되었다. opaque 로 설정한후 테스트를하면 이전보다 훨씬 높은 framerate 를 보여준다. 하지만 performance 가 눈에 띄게 올라가게 된다.

이는 opaque 모드가 배경을 불투명으로 바꾸어 플래시로 하여금 부담을 줄여준 이유도 있겠지만 이 모드를 적용할시에 framerate 를 높인 이유가 클것이다. 하지만 opaque 모드는 framerate 가 높아지는 대신 cpu 사용량이 올라가게 된다.

사양이 좋은 컴퓨터에서는 큰 무리가 없겠지만 저 사양의 컴퓨터에서의 사용은 어느정도고려해야한댜.

http://www.communitymx.com/content/article.cfm?cid=E5141&print=true