⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 script.html

📁 基于actionscript3.0的flashLoading控件
💻 HTML
字号:
<html>

<head>

<title>3DEnvironment userguide</title>

<link href="style.css" rel="stylesheet" type="text/css">
<link href="help_pc.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {color: #009933}
-->
</style>
</head>

<body>

<h1 class="title">Adding Objects with Actionscript</h1>
<p>&nbsp;</p>

<p class="normal">1. If you have not already done so you should first complete the <a href="basic.html">Basic Tutorial</a>, then open the file that you created.</p>
<p class="normal"><br>
2. Select the <span class="highlight">3DEnvironment</span> on the stage and open the properties panel. Assign an instance name to the component, for the purposes of this tutorial name it <em>world</em>.</p>
<p><img src="images/screen14.jpg" border="1" class="image" alt="screen shot" /></p>
<p>&nbsp;</p>
<p><br>
3. De-select the component by clicking on the frame in the timeline. Press <span class="highlight">Alt+F9</span> to open the Actions panel.</p>
<p><br>
Enter the code below:</p>
<pre class="style1">var obj:Object = {x:0, y:0, z:0, regName:"newCircle", linkageId:"circle"};
world.addObj(obj);</pre>
</p>
<br>
This script creates a new object with the first line and adds the object to the <span class="highlight">3DEnvironment</span> component with the second line.
<p><br>
4. Immediately below the script you entered in step 3, add the following code: </p>
<pre><br><span class="style1">var lis:Object = new Object();
lis.onWorldInit = function(){
	world.motionObj("newCircle", {x:200, z:200}, 10);
}
world.addEventListener("onWorldInit", lis);</span></pre></p>
<p>This script creates another object in the first line. Then it uses the component's <span class="highlight">onWorldInit</span> function to call the component's <span class="highlight">motionObj</span> method as soon as the <span class="highlight">3DEnvironment</span> is initialized. Finally it registers the <span class="highlight">lis</span> object with the <span class="highlight">3DEnvironment</span> instance.</p>
<p><br>
5. Press <span class="highlight">Ctrl+S</span> (Win) or <span class="highlight">Cmnd+S</span> (Mac) to save your file and <span class="highlight">Ctrl+Enter</span> (Win) or <span class="highlight">Cmnd+Enter</span> (Mac) to test your file.</p>
<p>&nbsp;</p>
<p>When you test your file you'll see the new object has been added and moves to its new coordinates as soon as the component initializes. <br>
</p>
<p class="normal"><i><strong>Note:</strong> You can find more information on this script in the <a href="reference.html">Actionscript Reference</a> section of this userguide.</i></p>

<p>&nbsp;</p>
<p>&nbsp;</p>

<p>&nbsp;</p>
<p>&nbsp;</p>
</body>

</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -