Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 停止ajax计时器中的图像闪烁_Asp.net - Fatal编程技术网

Asp.net 停止ajax计时器中的图像闪烁

Asp.net 停止ajax计时器中的图像闪烁,asp.net,Asp.net,我环顾四周,但每个人似乎都指向javascript。作为一名asp.NETC#服务器端开发人员,我对这一点并不满意 我的asp.net标记中有以下内容: <asp:UpdatePanel ID="upVideo" runat="server"> <ContentTemplate> <asp:Timer ID="Timer1" runat="server" Enabled="False" Interval="100" OnTick="Timer1_Tick">

我环顾四周,但每个人似乎都指向javascript。作为一名asp.NETC#服务器端开发人员,我对这一点并不满意

我的asp.net标记中有以下内容:

<asp:UpdatePanel ID="upVideo" runat="server">
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Enabled="False" Interval="100" OnTick="Timer1_Tick">
</asp:Timer>
<asp:Image ID="Image1" runat="server" ImageUrl="~/images/img00001.jpg" Width="352"
Height="288" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
</asp:UpdatePanel>
它是有效的,但有一种可怕的“闪烁”。有没有人想出解决办法


谢谢..

恐怕解决办法是使用Javascript!我建议创建一个包含所有帧的CSS精灵,将其设置为div上的背景,并设置背景位置偏移的动画。这样,它将加载在一个请求中,您将不会闪烁。你可以使用这样的框架,它会帮你很多。嗨,谢谢。我正在调查这件事,因为这是一条路要走。最后一件事,在我们看来,这会是我在精灵中可以使用的帧数的上限吗?没问题。如果我的评论有帮助,请投票表决;)我想这取决于您的场景(您需要的sprite的图像文件大小是多少,您的最终用户有什么样的网络连接?)您可能可以将sprite编码为JPEG,并设置压缩比以进一步减少带宽。希望对您有所帮助,您使用过spritly.net框架吗?我不知道如何使用它,如果我有15帧宽15帧高。它只播放第一行…看起来Sprity不支持垂直CSS精灵。恐怕你得把镜框水平排列
private void SetImageUrl()
{
int _index = Convert.ToInt16(Session["FrameIndex"]);
_index++;
if (_index == 29)
{
_index = 0;
}
Image1.ImageUrl = "~/images/img000" + _index.ToString("00") + ".jpg";
Session["FrameIndex"] = _index;
}


protected void Timer1_Tick(object sender, EventArgs e)
{
try
{
SetImageUrl();
}
catch { }
}