自定义图像的HTMLLoader自定义、图像、HTMLLoader

2023-09-08 13:57:04 作者:万物不及你

有强大的的HTMLLoader 部分空气包裹在 MX:HTML 为Flex的

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

我要手动提供的图像(最好从字节) MX:HTML,这将显示我生成的内容。问题的关键是收拾所有的资源在没有外部文件的应用程序。我可以包不同的html页面中的应用程序,切换他们时, MX:HTML 调度 Event.LOCATION_CHANGE 现在我想相同的图像。你有什么建议?

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 suggest?

推荐答案

解决经过几个阶段去了!

请HTMLLoader对象的背景透明与 paintsDefaultBackground =假 backgroundAlpha =0。获取图片的位置用JavaScript通知,并吸引他们在HTMLLoader中的图形。这是复杂的,有问题的调整(图片得到转移),但几乎做了... 在接下来的想法 - 使用&lt;画布&GT;对他们绘制图像,将数据发送到JavaScript的。 在阅读帆布教程,偶然发现了数据URI方案,这不正是我需要在最简单的可能方式。图像在base64编码嵌入在HTML页面。 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... Next idea - use <canvas> to draw images on them, sending data to javascript. 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.
 
精彩推荐
图片推荐