Using SpinSurfaceBoard Class: Four Customized Instances

In this and in the next example, we illustrate the methods of SpinSurfaceBoard class. In the applet below we create four instances of the class, named spBoard1, spBoard2, spBoard3, and spBoard4 and customize each of them.

Download

  • Download all Flash CS3 'fla' files and AS3 'as' class file: surfaces.zip

The source files for the applet above, surfaces_app1.fla and SpinSurfaceBoard.as are contained in the zip file. They have to be in the same folder for the fla file to compile.

The Code

As you will see after openning the fla file, the code for the applet is very simple and short. We create four instances of SpinSurfaceBoard, add them as children of the Maintimeline, position them and then customize using the methods of the class. Here is the code for the first and the third instance:

var spBoard1:SpinSurfaceBoard=new SpinSurfaceBoard(120);

this.addChild(spBoard1);

spBoard1.x=50;

spBoard1.y=55;

//We changing the deafult mesh of 20 to 15.

spBoard1.changeMesh(15);

//We are choosing example number 7 (out of 11 in the class) which is the Mobius band.

spBoard1.changeExampleNum(7);

//The default opacity is 1.0 -- completely opaque. Mobius band looks better

//slightly opaque.

spBoard1.changeOpacity(0.8);

spBoard1.enableMessageBox();

spBoard1.setMessageBoxPos(3,1);

spBoard1.setMessageBoxFormat(0xCCCCCC,10,"Mouse over.");

//By default wireframe is on. For this surface we want it off.

spBoard1.frameOn(false);

//We are changing the default white background to black.

spBoard1.changeBackColor(0x000000);

 

.......................

 

var spBoard3:SpinSurfaceBoard=new SpinSurfaceBoard(100);

this.addChild(spBoard3);

spBoard3.x=70;

spBoard3.y=205;

spBoard3.changeMesh(15);

spBoard3.changeExampleNum(5);

spBoard3.enableMessageBox();

spBoard3.setMessageBoxPos(3,1);

spBoard3.setMessageBoxFormat(0x000099,10,"Mouse over.");

spBoard3.changeBorderColorAndThick(0x000099,1);

spBoard3.changeOpacity(0.0);

spBoard3.changeFrameColor(0x000099);

spBoard3.changeBackColor(0xE4E4E4);

 

On the next page, we show a simple example in which we use only one instance of SpinSurfaceBoard class.

Back to Advanced Tutorials              Back to Flash and Math Home

We welcome your comments, suggestions, and contributions. To contact us, email Barbara Kaskosz at barbara@flashandmath.com, Doug Ensley at doug@flashandmath.com, or Dan Gries at dan@flashandmath.com.

Adobe®, Flash®, Flex® are registered trademarks of Adobe Systems Incorporated.