Away 3D + Aspire UI Components = It looks great!

Software: Away3D 4.x

SourceSkyBoxer, Newbie
Posted: 30 April 2014 03:02 PM   Total Posts: 16

Hey guys,

i have created nice application with Aspire UI Components ( Trial Version ) + Away 3D libraries.
http://sourceskyboxer-webseite.gloxx.com/templates/images/cube_asui_contextmenu_01.PNG

http://sourceskyboxer-webseite.gloxx.com/templates/images/cube_asui_contextmenu_02.PNG

This is source:

package
{
 import away3d
.containers.View3D;
 
import away3d.entities.Mesh;
 
import away3d.materials.TextureMaterial;
 
import away3d.primitives.CubeGeometry;
 
import away3d.textures.ATFTexture;
 
 
import com.ghostwire.ui.containers.uiScrollPane;
 
import com.ghostwire.ui.containers.uiWindow;
 
import com.ghostwire.ui.controls.uiDialog;
 
import com.ghostwire.ui.controls.uiImage;
 
import com.ghostwire.ui.controls.uiLabel;
 
import com.ghostwire.ui.controls.uiMenu;
 
import com.ghostwire.ui.controls.uiPushButton;
 
import com.ghostwire.ui.data.uiModel;
 
import com.ghostwire.ui.enums.WINDOW;
 
import com.ghostwire.ui.events.uiMenuEvent;
 
import com.ghostwire.ui.managers.uiCursors;
 
import com.ghostwire.ui.managers.uiSkins;
 
 
import flash.display.Bitmap;
 
import flash.display.Sprite;
 
import flash.events.Event;
 
import flash.events.MouseEvent;
 
import flash.geom.Vector3D;
 
 public class 
Main extends Sprite
 {
  
  [Embed
(source="cube.atf", mimeType="application/octet-stream")]
  
private const _cube:Class;
  
  private var 
view:View3D;
  private var 
cube:Mesh;
  
  public function 
Main()
  
{
   
   
if (stage) init();
   else 
addEventListener(Event.ADDED_TO_STAGE, init);
   
stage.addEventListener(MouseEvent.RIGHT_CLICK, onRightClick);
   
stage.addEventListener(Event.RESIZE, onResizeHandler);
  
}
  
  
private function init(evt:Event = null):void
  {
   removeEventListener
(Event.ADDED_TO_STAGE, init);
   
uiSkins.initialize("classic");
   
   
uiWindow.initialize(stage);
   
uiSkins.manager.addEventListener(Event.INIT, main);
  
}
  
  
private function main(event:Event):void
  {
   addEventListener
(Event.ENTER_FRAME, onEnterFrame);
   
   
view = new View3D();
   
view.backgroundAlpha = 0.0;
   
view.backgroundColor = 0xFFFFFF;
   
addChild(view);
   
   
view.camera.position = new Vector3D(0, 0, -200);
   
view.camera.lookAt(new Vector3D(0, 0, 0));
   
   var 
_texture:ATFTexture = new ATFTexture(new _cube());
   var 
textureMaterial:TextureMaterial = new TextureMaterial(_texture);
   
   
cube = new Mesh(new CubeGeometry(), textureMaterial);
   
view.scene.addChild(cube);
  
}
  
  
private var popMenuXML:XML =
   <
menu>
    <
item label="About" />
    <
item label="Help" />
    <
item />
    <
item label="Rotate">
     <
item label="-X" />
     <
item label="+X" />
     <
item />
     <
item label="-Y" />
     <
item label="+Y" />
     <
item />
     <
item label="-Z" />
     <
item label="+Z" />
    </
item>
   </
menu>;
   
  private var 
popMenuModel:uiModel = new uiModel(popMenuXML);
  private var 
menu:uiMenu;
  
  private function 
onRightClick(event:MouseEvent):void
  {
   menu 
= uiMenu.popup(popMenuModel,stage);
   
menu.addEventListener(uiMenuEvent.MENU_SELECT, onSelect);
  
}
  
  
private function onSelect(event:uiMenuEvent):void
  {
   
switch(event.item.label)
   
{
    
case "About":
     
ShowAlert("About us", "Would you like to understand with alert?");
     break;
    case 
"Help":
     
ShowAlert("Help", "Please help me!");
     break;
    case 
"-X":
     
cube.rotationX -= 10;
     break;
    case 
"+X":
     
cube.rotationX += 10;
     break;
    case 
"-Y":
     
cube.rotationY -= 10;
     break;
    case 
"+Y":
     
cube.rotationY += 10;
     break;
    case 
"-Z":
     
cube.rotationZ -= 10;
     break;
    case 
"+Z":
     
cube.rotationZ += 10;
     break;
    default:
     break;
   
}
  }
  
  
private function ShowAlert(title:String, message:String):void
  {
   uiDialog
.instance.show(message, title);
  
}
  
  
private function onResizeHandler(event:Event):void
  {
   view
.width = stage.stageWidth;
   
view.height = stage.stageHeight;
  
}
  
  
private function onEnterFrame(event:Event):void
  {
   view
.render();
  
}
 }
} 

This is an example for test with Aspire UI Component Support :)

Now i am very happy for that. Great solution!
There are Aspire UI Components very better than MinimalComps because MinimalComps have not speical components like Menu, ItemMenu and MenuBar.

// EDIT: PS my website hangs off because it looks like website shuts down :/ I will create website another… I am sorry that.

Best regards SourceSkyBoxer

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X