📄 advanced3.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 { color: #003366;
font-weight: bold;
}
.style2 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
.underline { text-decoration: underline;
}
.style3 {
font-size: 24px;
font-weight: bold;
}
.mainlink { font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
font-weight: bold;
color: #000080;
}
a:link {
color: #0000FF;
}
.style16 {
color: #009933;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
.style10 {font-size: 12px}
.style18 {font-weight: bold; font-family: Verdana, Arial, Helvetica, sans-serif; font-style: normal;}
.style19 {color: #000000}
.style20 {font-style: normal; font-family: Verdana, Arial, Helvetica, sans-serif;}
-->
</style>
</head>
<body>
<h2 class="style2 style3"><span style=''>Controlling the 3D rotation </span></h2>
<p class="style2">This example demonstrates how to use ActionScript
together with the <span class="style1">3D Box</span> parameters, in order to create additional interaction (such as motion
effects, physic effects and so on).</p>
<p class="style2">1. Continue to work with the <span class="style1">'box.fla'</span> movie that you created in the <span class="style18"><b><font color="#000080" size="2"></font></b></span><span class="mainlink"><b><font face="Verdana" color="#000080" size="2"><span style='font-family:Verdana'><a href="advanced2.htm" target="_self" class="mainlink">Controlling the dimensions</a></span></font></b></span><span class="style20"><font size="2"><span style='font-family:Verdana'><span class="style19"> tutorial. </span></span></font></span></p>
<p class="style2">2. Add two simple buttons for <span class="style1">"show
me front"</span> and <span class="style1">"show
me back"</span><span class="style10"> to the stage:</span></p>
<p class="style2"><img src="images/image31.gif" width="257" height="257"></p>
<p class="style2"><br>
3. Add the following code to first button ("show me front"):</p>
<p class="style16">on (release) {<br>
box.k = 1;<br>
box.rx+=10;<br>
}</p>
<p class="style16"> </p>
<p class="style2">4. Add the following code to the second button ("show me back"):</p>
<p class="style16">on (release) {<br>
box.k = -1;<br>
box.rx-=10;<br>
}</p>
<p class="style2"><br>
5. Give your <span class="style1">3D Box</span> the instance name of <span class="style1">"box"</span>:</p>
<p class="style2"><img src="images/image32.gif" width="227" height="116"></p>
<p class="style2"><br>
<br>
6. Add the following code to the <span class="style1">3D
Box</span> instance:</p>
<p class="style16"> onClipEvent (enterFrame) {<br>
if (k) {<br>
// rotate
the 3D box to achive horizontal position:<br>
this.rx += k*(1-this.v3.px)/30;<br>
this.ry += -k*(1-this.v3.py)/30;<br>
this.rz += k*(1-this.v2.py)/80;<br>
// stop the calculation when the 3D Box get the
horizontal pozition:<br>
if (this.rx*this.rx+this.ry*this.ry+this.rz*this.rz<.01) {<br>
this.rx = this.ry=this.rz=0; <br>
}<br>
}<br>
}<br>
// pause the rotation on mouse press <br>
onClipEvent (mouseDown) {<br>
k=0; <br>
} </p>
<p class="style2"><span style=""><br>
This code demonstrates some interesting
functionality: You can still roll the box with your mouse, but when
you press "show me front" or "show me back" the box return to the horizontal
position (viewed either from the front or from the back). You can tune it somewhat
by changing the coefficients to '30' or '80' as well as by changing the <span class="style1">3D Box</span> friction
parameter.</span></p>
<p class="style2">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="260" height="260">
<param name="movie" value="images/image33.swf">
<param name="quality" value="high">
<embed src="images/image33.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="260" height="260"></embed>
</object>
</p>
<p class="style2"> </p>
<p class="style2"> </p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -