简体   繁体   English

AS3(闪存)网站调整大小抖动/滞后

[英]AS3 (flash) Website resizing jittering/lag

Hi i am new to the forums and i'm looking for some help with a current project. 嗨,我是论坛的新手,我正在寻找有关当前项目的帮助。

i am basically making a website called www.noised.co.uk, feel free to take a look to see what my problem is and don't judge me on the images etc it has not been optimized as of yet. 我基本上是在建立一个名为www.noised.co.uk的网站,可以随时查看我的问题所在,并且不要在图像上判断我,等等。

but as you will be able to see when my screen re sizes the redraw is awfully slow. 但是您可以看到我的屏幕调整大小时,重绘的速度非常慢。 in AS2 i used updateAfterEvent() but as i understand you can only use this under a mouse or timer event (and another but i cannot remember which) all three of which i am not using to call my re sizer, i am using: 在AS2中,我使用了updateAfterEvent()但是据我了解,您只能在鼠标或计时器事件下使用它(还有另一个但我不记得哪个),我不使用这三个来调用我的resizer,我正在使用:

stage.addEventListener(Event.RESIZE, resizer)

so my question is how can i make this redraw a nice, smoother effect? 所以我的问题是我怎样才能使此重绘效果更好,更平滑?

I'm assuming that your stage.addEventListener(Event.RESIZE, resizer) is working fine and the function is called on the right time. 我假设您的stage.addEventListener(Event.RESIZE,resizer)工作正常,并且函数在正确的时间被调用。

So looks like your function is some how like this: 所以看起来您的函数是这样的:

function resizer(e:Event):void{
 obj.x = your calculation of position X;
 obj.y = your calculation of position Y;
}

All you need to do is use some Tween class like Tweenlite. 您所需要做的就是使用Tweenlite之类的Tween类。 http://www.greensock.com/tweenlite/ http://www.greensock.com/tweenlite/

So inside your resizer function just change the content like this. 因此,在您的调整大小函数内部,只需更改内容即可。

TweenLite.to(obj, 1, {x:your calculation of position X, y:your calculation of position Y }); TweenLite.to(obj,1,{x:您对位置X的计算,y:您对位置Y的计算});

Now the animation will be smoother 现在,动画将更加平滑

What you're experiencing is something that is caused by the flash player and the way it gets resized by the webkit renders. 您所遇到的是Flash播放器及其通过Webkit渲染调整大小的方式引起的。 It's hard to get around it in AS3 code alone, but the following link shows how you can use a combination of JS and AS3 to get a smooth stage resizing 仅在AS3代码中很难解决它,但是以下链接显示了如何结合使用JS和AS3来实现平滑的舞台大小调整

http://www.tagtixx.com/smooth-flash-resizing-in-webkit-browsers/ http://www.tagtixx.com/smooth-flash-resizing-in-webkit-browsers/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM