Flashvars 在页面重新加载时停止 Flash 影片重新加载
我网站的每个页面上都有一个 Flash 横幅。我希望它在用户更改页面时继续播放而不是重新加载。我读到这可以使用 flashvars 来实现,但是,我已经有一段时间没有进行任何动作脚本了。我尝试查找教程但无济于事。有人可以指出我正确的方向吗?
已更新
感谢您的评论。我现在在 fla 文件的第 1 帧上有这个:
var mySharedObject:SharedObject = SharedObject.getLocal("displayCookie");
if(mySharedObject.data.displayed == true){
gotoAndPlay(currentFrame);
trace("cookie found");
}else{
trace("cookie not found, setting it now");
//do whatever if NOT already been played
mySharedObject.data.displayed = true;
mySharedObject.flush();
}
但我不知道如何为 currentFrame 提供刷新页面时的值。我怎样把它放在那里?
对不起我的菜鸟
I have a flash banner on every page in my site. I want it to continue playing rather than reloading when users change pages. Ive read that this can be achieved using flashvars, however, its been quite some time since I did any actionscripting. I've tried looking up tutorials to no avail. Can someone point me in the right direction please.
UPDATED
Thanks for your comments. I have this on frame 1 of my fla file now:
var mySharedObject:SharedObject = SharedObject.getLocal("displayCookie");
if(mySharedObject.data.displayed == true){
gotoAndPlay(currentFrame);
trace("cookie found");
}else{
trace("cookie not found, setting it now");
//do whatever if NOT already been played
mySharedObject.data.displayed = true;
mySharedObject.flush();
}
But I don't know how to give the currentFrame the value it had at the time the page was refreshed. How do I put that in there?
Sorry for my noobness
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 SharedObject 代码的基础上,您可以执行以下操作:
在第 1 帧上:
Building on your SharedObject code, you could do something like this:
On frame 1:
它可能比仅使用 FlashVars 稍微复杂一些。当用户导航到下一页时,您还需要使用一些外部接口来获取横幅的当前框架。 (注意:我使用的是 jQuery 和 swfobject)
首先,javascript 类似于:
然后,在第 1 帧上的 FLA 中,您将拥有:
现在,任何时候您导航到另一个页面,您只需添加当前帧即可使用
checkCurrentFrame(); 到查询字符串;
It'll probably be a little more complicated than just using FlashVars. You'll also need to use a little ExternalInterface to get the current frame of the banner once the user navigates to the next page. (Note: I'm using jQuery and swfobject)
First, the javascript would be something like:
Then, in your FLA on frame 1, you would have:
Now, any time you navigate to another page, you just tack on the current frame to the query string using
checkCurrentFrame();