将cacheAsBitmap对掩蔽的scrollRect的在空气中的iOS雪碧没有影响 [英] cacheAsBitmap has no effect on a Sprite masked with a scrollRect in AIR for iOS

查看:185
本文介绍了将cacheAsBitmap对掩蔽的scrollRect的在空气中的iOS雪碧没有影响的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发的AIR一个简单的运动菜单的UI组件为iPad。这基本上是一个轻量级的填空题的组合框相匹配的iOS的风格。我有一个包含任何地方从2到60项按钮弹出,让你通过他们拂去/滚动,只显示在任何给定的时间约为7项的精灵。

I'm developing a simple kinetic menu UI component for AIR for iPad. It's basically a lightweight fill-in for a combobox that matches the style of iOS. I have a sprite containing any where from 2 to 60 item buttons that pops up and lets you flick/ scroll through them, only showing about 7 items at any given time.

目前我第一次尝试用一个面具戴在我的精灵,移动我的菜单精灵上下下的固定面具。此产生的测试设备上无光泽结果(小于20帧)。

My first attempt at this used a mask over my sprite, moving my menu sprite up and down under the stationary mask. This produced lackluster results on the test device (< 20 fps).

然后我尝试了块传输的解决方案,使菜单精灵关闭显示列表,并使用的BitmapData.draw()来渲染只有一部分,我需要看到的列表。这样就产生在我的Windows开发平台上的最好成绩,但低于10 FPS此时帧率下降了iPad上。我假设我是招致无论是征税的CPU使用率或GPU回读处罚。我本来希望能够运行我的应用程序60 fps的,但是我已经逐步加大我的目标降低到一个更谦卑30 fps的。

I then tried a blitting solution, leaving the menu sprite off the display list and using BitmapData.draw() to render only the part to the list i needed visible. This produced the best results on my Windows dev platform, but this time the framerate dropped below 10 fps on iPad. I am assuming I was incurring either a taxing CPU usage or a GPU readback penalty. Originally I had hoped to be able to run my app a 60 fps, however I've ratcheted my goal down to a more humble 30 fps.

这让我想起我在使用精灵的.scrollRect遮蔽功能与.cacheAsBitmap结合此UI组件3的尝试。再次,观察到的行为不同,疯狂空气之间在Windows与iOS的。在Windows上,只重画菜单精灵通过scrollRect的尺寸为界,因为它应该的一部分。与iOS我能触摸上方或菜单精灵的可视面积屏幕下方的面积,还是拖动菜单,即使我的手指已经结束空的空间!这里的表现是不错的,之间徘徊。(19 - 25 FPS),并几乎肯定会是完美的,在30,如果它的工作,因为它没有在Windows

Which brings me to my 3rd attempt at this UI component using the sprite's .scrollRect masking function in conjunction with .cacheAsBitmap . Again, the observed behaviors differ wildly between AIR on Windows vs. iOS. On Windows it only redraws the part of the menu sprite bounded by the dimensions of the scrollRect as it should. With iOS i can touch the area of the screen above or below the visible area of the menu sprite and still drag the menu even though my finger is over "empty" space! The performance here is decent, hovering between (19 - 25 fps) and would almost certainly be perfect at 30 if it worked as it did on windows.

有没有人有任何意见或者有关AIR的scrollRect的功能行为的iOS或实施在iOS原生风格的滑翔在空气中的iOS菜单的更好的办法?

Does anyone have any ideas either about the scrollRect feature's behavior on AIR for iOS or a better way of implementing an iOS native style gliding menu in AIR for iOS?

请注意,上面的方法进行尝试CPU和GPU模式,但CPU模式进行好得多。我用AIR 2.7安装在闪存临CS 5.5上面,用的是FlashDevelop作为我的IDE。

Note, the above methods were tried in both CPU and GPU mode, but CPU mode performed vastly better. I used AIR 2.7 installed on top of Flash Pro CS 5.5, with FlashDevelop as my IDE.

推荐答案

http://esdot.ca/site/2011/fast-rendering-in-air-3-0-ios-android#comment-10

从上面的链接真正的好人:雅,scrollRect的基本上是一个不走的手机,基本上忘记了API,即使存在,不管你信不信......老同学屏蔽是要走的路团团我们去。 !

Really nice guy from the above link: "Ya, scrollRect is basically a no-go on mobile, basically forget that API even exists. Believe it or not… old school masking is the way to go. Round and round we go!"

这篇关于将cacheAsBitmap对掩蔽的scrollRect的在空气中的iOS雪碧没有影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆