《功夫之王》游戏教程动画-普通攻击篇
点击播放

《功夫之王》游戏教程动画-防御技能篇
点击播放

《功夫之王》游戏教程动画-组队对战篇
点击播放
因为 Flash 对象没有直接控制暂停的方法,所以只能通过用 IsPlaying() 方法判断当前状态是否正在播放,是则调用 StopPlay() 方法,否则用 Play() 方法。
具体步骤
代码示例:

<object id="movie" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="150" height="100" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="demo.swf" />
<param name="menu" value="false" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffcc33" />
<embed src="demo.swf" menu="false" quality="high" bgcolor="#ffcc33" width="150" height="100" name="movie" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object><br>
<button onClick="movie.IsPlaying()?movie.StopPlay():movie.Play()">Pause</button>

提示:本例中的核心语句
movie.IsPlaying()?movie.StopPlay():movie.Play()

用了三目运算符,相当于

if(movie.IsPlaying()){
movie.StopPlay()
} else{
movie.Play()
}

特别提示
本例代码运行后的效果如图5.3.2所示,单击【Pause】按钮时如果Flash动画正在播放,则停止播放动画,否则播放动画。

图5.3.2 暂停Flash动画的按钮的实现

特别说明


本例主要用到Flash对象的IsPlaying()方法来测试Flash动画的当前播放状态,然后分别调用Play()方法和StopPlay()方法来实现暂停的功能。
IsPlaying() 如果动画当前正在播放,返回为 true,反之返回 false 。
Tags: , ,
/*
*Create by Geordi 14th Feb 2008
*function DrawSector is drawing a sector in the flash by actionscript 3
*/
import flash.display.MovieClip;
import flash.display.Sprite;
var stag:Sprite=new Sprite();
addChild(stag);
var moviec:MovieClip=new MovieClip;
stag.addChild(moviec);
var S_angle:int=60;
/* S_angle is expressed as a number between 0 and 360 degrees. it will draw a 60
* degree sector in this example, but you could change it to what ever you want
*/
DrawSector(moviec,200,200,100,S_angle,270,0xffcc00);
function DrawSector(mc:MovieClip,x:Number=200,y:Number=200,r:Number=100,
angle:Number=27,startFrom:Number=270,color:Number=0xff0000):void
/*
* mc the movieclip: the container of the sector.
* x,y the center position of the sector
* r the radius of the sector
* angle the angle of the sector
* startFrom the start degree counting point : 270 top, 180 left, 0 right, 90 bottom ,
* it is counting from top in this example.
* color the fil lin color of the sector
*/
{

/* start to fill the sector with the variable "color" if you want a sector without filling color ,
* please remove next line below.
*/
mc.graphics.beginFill(color,50); //remove this line to unfill the sector
/* the border of the secetor with color 0xff0000 (red) , you could replace it with any color
* you want like 0x00ff00(green) or 0x0000ff (blue).
*/
mc.graphics.lineStyle(0,0xff0000);
mc.graphics.moveTo(x,y);
angle=(Math.abs(angle)>360)?360:angle;
var n:Number=Math.ceil(Math.abs(angle)/45);
var angleA:Number=angle/n;
angleA=angleA*Math.PI/180;
startFrom=startFrom*Math.PI/180;
mc.graphics.lineTo(x+r*Math.cos(startFrom),y+r*Math.sin(startFrom));
for(var i=1;i<=n;i++)
{
startFrom+=angleA;
var angleMid=startFrom-angleA/2;
var bx=x+r/Math.cos(angleA/2)*Math.cos(angleMid);
var by=y+r/Math.cos(angleA/2)*Math.sin(angleMid);
var cx=x+r*Math.cos(startFrom);
var cy=y+r*Math.sin(startFrom);
mc.graphics.curveTo(bx,by,cx,cy);
}
if(angle!=360)
mc.graphics.lineTo(x,y);

mc.graphics.endFill(); // if you want a sector without filling color , please remove this line.
}
////////////////////////////////////////runing result////////////////////////////////////////////////////////
sector with fill in color: sector without fill in color:
withFill withoutFill
Tags: , ,

<?php


$arr = array(
"0" => array(line_num => "10", occur_time => "2007-11-19 10:25:04+08"),
"1" => array(line_num => "9", occur_time => "2007-11-19 10:25:04+08"),
"2" => array(line_num => "25", occur_time => "2007-11-19 10:25:04+08")
);

print_r($arr);

echo "<br />";
echo "<br />";
echo "<br />";

uasort( $arr,create_function('$a, $b', 'return $a[\'line_num\'] < $b[\'line_num\'];') );

print_r($arr);

echo "<br />";
echo "<br />";
echo "<br />";

foreach($arr as $key => $value) {
$ar[] = $value;
}

print_r($ar);

?>

输出结果:

Array
(
[0] => Array
(
[line_num] => 10
[occur_time] => 2007-11-19 10:25:04+08
)

[1] => Array
(
[line_num] => 9
[occur_time] => 2007-11-19 10:25:04+08
)

[2] => Array
(
[line_num] => 25
[occur_time] => 2007-11-19 10:25:04+08
)

)
<br /><br /><br />Array
(
[2] => Array
(
[line_num] => 25
[occur_time] => 2007-11-19 10:25:04+08
)

[0] => Array
(
[line_num] => 10
[occur_time] => 2007-11-19 10:25:04+08
)

[1] => Array
(
[line_num] => 9
[occur_time] => 2007-11-19 10:25:04+08
)

)
<br /><br /><br />Array
(
[0] => Array
(
[line_num] => 25
[occur_time] => 2007-11-19 10:25:04+08
)

[1] => Array
(
[line_num] => 10
[occur_time] => 2007-11-19 10:25:04+08
)

[2] => Array
(
[line_num] => 9
[occur_time] => 2007-11-19 10:25:04+08
)

)

Tags: , ,
分页: 59/128 第一页 上页 54 55 56 57 58 59 60 61 62 63 下页 最后页 [ 显示模式: 摘要 | 列表 ]