📄 xml.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}
.style2 {color: #009966; }
-->
</style>
</head>
<body>
<h1 class="title">Using XML</h1>
<p class="normal">As well as adding objects to the 3DEnvironment using parameters and Actionscript you can add objects using an external XML file.</p>
<p class="normal"><br>
1. Open Flash and start a new file.</p>
<p>Press Ctrl+F7 (Win) or Cmnd+F7 (Mac) to open the Component panel and drag a copy of the component onto the stage.</p>
<p><img src="images/screen1.jpg" border="1" class="image" alt="screen shot" /></p>
<p> </p>
<p><br>
2. Next you must create a symbol to exist in the 3D environment you're creating. Press Ctrl+F8 (Win) or Cmnd+F8 (Mac) to open the 'Create New Symbol' dialogue box. Enter a name for the symbol, for the purposes of the tutorial name it 'circle_clip' (without the quotes). Ensure that the type is set to 'Movie clip'. Tick the 'Export for Actionscript' checkbox (the 'Export in first frame' check box will be ticked automatically.) Enter an 'Identifier' for the clip, for the purposes of the tutorial give it the instance name 'circle' (without the quotes). Click OK.</p>
<p><img src="images/screen2.jpg" border="1" class="image" alt="screen shot" /></p>
<p> </p>
<p><br>
3. On the timeline of the clip you have just created draw a graphic, for the purposes of this tutorial draw a circle.</p>
<p><img src="images/screen3.jpg" border="1" class="image" alt="screen shot" /></p>
<p> </p>
<p><br>
4. Using bitmap editing software such as Adobe Photoshop or Macromedia Fireworks create a new image to use in your 3DEnvironment. (If you don't own bitmap editing software you can create a jpg file using Flash.) Create a new folder in the same directory as your Flash file and save the image you've just created as a jpg file inside the new folder. For the purposes of this tutorial name the folder <span class="highlight">myFolder</span> and the image <span class="highlight">myImage.jpg</span>.</p>
<p><br>
5. Using a plain text editor such as Notepad on Windows or TextEdit on a Mac create a new file and type the following line:</p>
<p class="normal"><pre class="style1"><?xml version="1.0"?></pre>
</p>
<p class="normal">This line is a standard opener for an XML file.</p>
<p> </p>
<p class="normal">Immediately below the xml file opener enter the following code to open the <span class="highlight">3DEnvironment</span> node:</p>
<p class="normal">
<pre class="style1"><3DEnvironment><br></pre>
<p class="normal">Next, we'll add an <span class="highlight">object</span> to the 3DEnvironment using the movie clip we created in steps 1, 2 and 3:</p>
<p class="normal"><pre class="style1"><object x="0" y="100" z="20" linkageId="circle" regName="object1" /></pre>
</p>
<p class="normal">This line is the object node. Its x, y and z attributes indicate the object's position within the <span class="highlight">3DEnvironment</span>. The <span class="highlight">linkageId</span> attribute refers to the linkage identifier we gave our movie clip in step 2. The <span class="highlight">regName</span> attribute is the name by which you can refer to the object with actionscript.</p>
<p class="normal"><br>
Next we will add another <span class="highlight">object</span> node but this time we will use the image you created in step 4 as the image to be added to the 3DEnvironment:<br>
</p>
<pre class="style1"><object x="0" y="0" z="0" url="myFolder/myImage.jpg" regName="object2" /></pre>
</p>
<p class="normal">As before, the object node's x, y and z attributes indicate its position and the regName attribute supplies the name to reference it with Actionscript. Unlike before, because we are referencing an external file, instead of the linkageId attribute we use the url attribute to specify the image's path and name.</p>
<p> </p>
<p class="normal">Repeat these steps until you have added all of the objects that you wish.</p>
<p class="normal"><br>
Finally, you need to close the 3DEnvironment node like so:
</p>
<pre class="style1"></3DEnvironment>
</pre>
<p class="normal">Your completed XML file should look like this:</p>
<p class="normal"><pre class="style1"><?xml version="1.0"?>
<3DEnvironment>
<object x="0" y="100" z="20" linkageId="circle" regName="object1" />
<object x="0" y="0" z="0" url="myFolder/myImage.jpg" regName="object2" />
</3DEnvironment></pre>
</p>
<p class="normal">Save your file as <span class="highlight">myXMLFile.xml</span> in the same directory as your Flash file.</p>
<p class="normal"><br>
6. Returning to your Flash file, select the <span class="highlight">3DEnvironment</span> component on the stage. With the component still selected press Alt+F7 to open the component inspector. In the field named <span class="highlight">xml file</span> enter the name of the xml file you created in step 5 (<span class="highlight">myXMLFile.xml</span>).</p>
<p><img src="images/screen15.jpg" border="1" class="image" alt="screen shot" /></p>
<p> </p>
<p> </p>
<p> </p>
<p class="normal">7. Press Ctrl+S (Win) or Cmnd+S (Mac) to save your file and Ctrl+Enter (Win) or Cmnd+Enter (Mac) to test your file.</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -