📄 advanced4.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;
}
.style5 {
color: #009933;
font-size: 12px;
}
.style7 {font-size: 12px}
.style8 {color: #009933}
-->
</style>
</head>
<body>
<h2 class="style2 style3"><span style='font-family:Verdana'>Customizing the mouse behaviour and active area </span></h2>
<p class="style7" style="font-family: Verdana"><span class="style2">The </span><span class="style1">3D
Box</span> <span class="style2">creates
a rectangular area around the 3D object for mouse control. You may
wish
to create your own mouse sensitive area instead. You may
also
want
to
change the mouse behaviour. For example, you may wish to rotate the object on mouse move instead of on mouse drag.</span></p>
<p class="style7" style="font-family: Verdana">In this tutorial we'll be using the <span style="font-family: Verdana"><span class="style1">'box.fla'</span></span> movie as created in the <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> tutorial. </p>
<p class="style7"><span style="font-family: Verdana">1. Select the <span class="style1">3D
Box</span> component
in the <span class="style1">'box.fla'</span> movie and uncheck
the <span class="style1">'Allow mouse control'</span> checkbox. This
disables the default mouse behavior and will allow you to control it yourself. </span></p>
<p class="style7"><span style="font-family: Verdana"><br>
2. Create an empty square
button (make it have a hit area only):</span></p>
<p class="style7"><span style="font-family: Verdana"><img src="images/image41.gif" width="307" height="228"></span></p>
<p class="style7"><span style="font-family: Verdana"><br>
3. Place this button on top of all the objects in the <span class="style1">"front"</span> movieclip and make it the same size as the elements in the <span style="font-family: Verdana"><span class="style1">"front"</span> movieclip:</span></span></p>
<p class="style7"><span style="font-family: Verdana"><img src="images/image42.gif" width="221" height="269"></span></p>
<p class="style7"><span style="font-family: Verdana"><br>
4. Add the
following ActionScript code to the button:</span></p>
<p class="style2"><font face="Lucida Console"><span class="style8">on (rollOver) {<br>
rootObject.activeMouse = true;<br>
}<br>
on (rollOut, dragOut) {<br>
rootObject.activeMouse = false;<br>
}<br>
//rootObject - link to the root 3DBox instance.<br>
//activeMouse - public parameter of the 3DBox, indicates when the 3DPlane rotates
with the mouse.</span><br>
</font><span style="font-family: Verdana"><br>
<br>
5. Copy this button with the actions and paste it into the remaining five side movieclips. Ensure that you adjust the button size accordingly to match each movieclip.</span></p>
<p class="style2"><br>
<span style='font-family:Verdana'>6. The 3D element should now react when the mouse is dragged on the object surfaces only and now when the mouse is dragged anywhere outside of the object itself. </span></p>
<p class="style7"><span style="font-family: Verdana"><br>
7. Finally, remove
all of the actions from the <span class="style1">3D Box </span>instance as well as the <span style="font-family: Verdana"><span class="style1">"show me front"</span> and <span class="style1">"show me back"</span></span> buttons. Add the following code to the <span style="font-family: Verdana"><span class="style1">3D Box </span>instance</span> instead:</span></p>
<p class="style5"><font face="Lucida Console">onClipEvent (enterFrame)
{<br>
this.rx += (x0-this.v3.px)/30;<br>
this.ry += -(y0-this.v3.py)/30;<br>
this.rz += (z0-this.v2.py)/80;<br>
if (this.rx*this.rx+this.ry*this.ry+this.rz*this.rz<.001) {<br>
this.rx = this.ry = this.rz = 0;<br>
}<br>
}<br>
onClipEvent (load) {<br>
//store the initial position<br>
x0 = this.v3.px;<br>
y0 = this.v3.py;<br>
z0 = this.v2.py;<br>
//push it gently in the beginning<br>
this.rx = this.ry=5;<br>
}</font></p>
<p class="style5"><font face="Lucida Console">
<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/image43.swf">
<param name="quality" value="high">
<embed src="images/image43.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="260" height="260"></embed>
</object>
</font></p>
<p class="style2">Now your visitors will notice this cool 3D feature immediately!</p>
<p class="style2"> </p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -