![]() When you run the application, you will see that the light that is sitting above the model will slowly fade between yellow and cyan. Once the application is ready, the creationComplete function is called, at which point a new CoppercubeSprite object is added to the Flex Application object as a child of a new SpriteUIComponent object. The MXML file is the entry point of the application. This makes modifying a Coppercube object from TweenMax simple. So the CCLight class simply keeps a reference to the SimpleAPI interface and the light that it is to modify, and class the SimpleAPI setLightColor function from within a standard set function. This is because TweenMax expects to be able to modify a property rather than supply a parameter to a function, which is how the SimpleAPI works. Public function CCLight(simpleAPI: Object, ccObject: Object)ĬCLight is a very simple class designed to expose the colour property of a Coppercube light as a pair of get/ set functions. Public function set Color(color: int): void You can use the Embed keyword to add resources into a SWF file, giving you one file to distribute, and also negating the need to load resources from external sources (along with its inherent unreliability). Public function enterFrame( event:Event): voidįirst the Coppercube SWF file is embedded. ( this.simpleAPI, simpleAPI.getSceneNodeByName( " Light2")) Public function startCCApplication(): void If (simpleAPI & simpleAPI.isLoaded() & !applicationStarted) called every frame public function onGraphicsFrame( event:Event): void swf file has been loaded and initialized private function onCoppercubeLoaded(e:Event): void load the coppercube scene from the other swf var copperCubeData:ByteArray = new EmbeddedCopperCubeSWFDataFile() as ByteArray Private var applicationStarted: Boolean = false ĪddEventListener(Event.ENTER_FRAME, onGraphicsFrame) ![]() Public static var EmbeddedCopperCubeSWFDataFile:Class Embedded into this file here // so we get only one single SWF ![]() Public class CoppercubeSprite extends Sprite We use this same formula for our class called CoppercubeSprite. To keep things simple, you can embed the Coppercube SWF inside the final SWF file. The SWF you create then modifies the elements inside the Coppercube SWF file. ![]() We will use the Flex compiler to create the final scripted application. Scripting Flash Coppercube applications basically involves loading the SWF file created by Coppercube into a new SWF created by your ActionScript compiler. This will be a web application, so we will use ActionScript. This means your target audience (web or Windows) will define what language you use. ActionScript is used to script the Flash applications, while Squirrel is used to script the Windows applications. The sample project is included in the downloads, or can create your own using the steps described on this web page (you will need to add an additional light called Light2 if following these instructions).Ĭoppercube supports two scripting languages: ActionScript (Flash or Flex) and Squirrel. We will make use of this to create a light that changes color.įirst the Coppercube application needs to be compiled. Using the CodeĬoppercube applications can be scripted through the SimpleAPI, which is a set of functions that expose the inner properties of the elements in the scene. The code presented here is used as the basis for a number of Coppercube tutorials that you can view here. The SWF files produced by Coppercube can be scripted using ActionScript. While Coppercube includes a number of behaviors, customized or complex actions still require custom code. Coppercube is a tool that can be used to create interactive 3D applications, either for Windows or for the web.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |