tailieunhanh - adobe press ActionScript 3.0 for ADOBE FLASH PROFESSIONAL CS5 Classroom in a Book phần 10

Chú ý rằng sự kiện này CLICK không phải là một sự kiện MouseEvent nhưng là một sự kiện InteractiveScene3Devent Papervision3D. Trong tất cả các cách khác, các cú pháp nên quen thuộc với bạn. Chẳng bao lâu bạn sẽ tạo ra onClick () chức năng, và sau đó bạn sẽ sử dụng chức năng để động khối lập phương. | Notice that this CLICK event is not a MouseEvent event but is a Papervision3D InteractiveScene3Devent event. In all other ways the syntax should be familiar to you. Soon you will create the onClick function and then later you will use that function to animate the cube. Your next step though is to add the cube you created to the scene. Placing the cube in the scene You place a Papervision3D object into a scene in the same way that you place any object on the Flash Stage using the addChild method. This will be the last code you add to the makeCube function for the time being. 1 Add this line below the code you just typed cube In Papervision3D as in ordinary ActionScript the z-axis represents the depth of an object. Higher z values represent distances farther from the viewer and lower values bring the object closer and make it appear larger. The default z value of 3D objects is zero. 2 Below the last line you typed add a line to bring the cube closer to the viewer -300 The entire makeCube function at this point should read as follows private function makeCube void var materials MaterialsList new MaterialsList var imageMat1 BitmapFileMaterial new - BitmapFileMaterial . assets true material imageMat1 all cube new Cube materials 640 640 480 4 4 4 - onClick cube -300 If you tested the movie at this point you would receive error messages because three functions were referred to that do not yet exist. To be able to test what you have done so far you will need to create the shell for the onClick onKeyD and onKeyU functions. ACTIONSCRIPT FOR ADOBE FLASH PROFESSIONAL CS5 CLASSROOM IN A BOOK 357 3 On a new line below the closing curly brace for the makeCube function add the shell for all three functions private function onKeyD e KeyboardEvent void private function onKeyU e KeyboardEvent void private function onClick e .