在某些页面上跳过flash标题动画
2010年11月15日
Q: 我怎么做闪光 header 只在某些页面上播放完整的动画,但在其他页面上跳过它?
A: In the HTML 我们的模板代码,你会发现以下两个代码块之一:
第一个(你会在我们之前的模板中找到):
The 2nd one:
您应该在这些代码块的帮助下将参数放入Flash中. In the .FLA文件中应该有一个Action Script 接受并处理该参数的代码. 要添加参数,请执行以下操作:
在第一种情况下 update 代码是这样的:
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0″ width=”880″ height=”800″>
flash/header.swf?par=skip“>
在第二种情况下 update it in this way:
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0″ width=”745″ height=”328″>
Header.htm”>
flash/header.swf?par=skip“>
<–>
Header.htm” width=”745″ height=”328″ type=”application/x-shockwave-flash”>
flash/header.swf?par=skip“>
http://www.macromedia.com/go/getflashplayer”>
FAIL (the browser 应该渲染一些flash内容,而不是这个).
在ActionScript代码中,这个参数可以作为 _root.par . 这意味着你可以使用这样的条件:
if(_root.par == “skip”){
//你的代码在这里
//you usually use gotoAndStop(); or gotoAndPlay(); functions to skip a certain number of frames
}
在实际情况下,您通常会将此条件合并到预加载程序的代码中. 预加载器的代码如下所示:
onClipEvent(负载)
{
total = _root.getBytesTotal ();
}
onClipEvent (enterFrame)
{
loaded = _root.getBytesLoaded ();
% = int(loaded/total*100);
Text = % + " % ";
gotoAndStop(百分比);
If ((loaded == total)) && (_root.Par == " skip "))
{
_root.gotoAndStop(200); // usually the frame number where animation finishes
} else if (loaded == total) {
_root.gotoAndPlay (2);
}
}
See also: