开发者

Custom images for HTMLLoader

开发者 https://www.devze.com 2023-01-28 12:09 出处:网络
There is powerful HTMLLoader component for AIR wrapped in mx:HTML for Flex. I want to supply images manually (ideally from bytes) for mx:HTML, which will display my generated content. The point is to

There is powerful HTMLLoader component for AIR wrapped in mx:HTML for Flex.

I want to supply images manually (ideally from bytes) for mx:HTML, which will display my generated content. The point is to pack all resources in the application without external files. I can pack different html pages in the app and switch them when mx:HTML dispatches Event.LOCATION_CHANGE. Now I want the same for images. What do you开发者_StackOverflow中文版 suggest?


Solved! Went through several stages:

  1. Make HTMLLoader's background transparent with paintsDefaultBackground="false" and backgroundAlpha="0". Get notified of pictures location with javascript and draw them on HTMLLoader's graphics. This is complex and has problems with resizing (pictures get shifted), but was almost done...
  2. Next idea - use <canvas> to draw images on them, sending data to javascript.
  3. While reading canvas tutorials, stumbled upon data URI scheme, which does exactly what I needed in simplest possible way. Images are embedded in html page in base64 encoding.
0

精彩评论

暂无评论...
验证码 换一张
取 消