Thank, it's just a test for now, hopefully it will result in something cool 
:)

Heres my PlaneCreator:
package com.custommesh.plane {
import com.greensock.easing.Bounce;
import com.bjrnbrg.utils.graphic.DrawGraphic;
import away3dlite.core.base.Object3D;
import away3dlite.events.MouseEvent3D;
import away3dlite.materials.*;
import away3dlite.primitives.*;

import com.custommesh.Main;
import com.custommesh.grid.CustomEvent;
import com.greensock.TweenLite;
import com.greensock.plugins.ColorTransformPlugin;
import com.greensock.plugins.TintPlugin;
import com.greensock.plugins.TweenPlugin;

import flash.display.*;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.utils.ByteArray;

public class CustomPlaneAwayLite extends Object3D{
private var $parent:Main;
private var $material:BitmapMaterial;
private var $size:Rectangle;
private var $d:BitmapData;
public var $verticles0:Vector.<Number> = new <Number>[];
 public var pointInGrid:Point;
public var plane:Plane;
public var id:int;
private var active:Boolean = false;
 TweenPlugin.activate([ColorTransformPlugin, TintPlugin]);
 public function CustomPlaneAwayLite(_parent:Main, _id:int, _size:Rectangle, 
_pointInGrid:Point, _bitmapData:BitmapData = null):void{
this.id = _id;
this.$parent = _parent;
this.$size = _size;
this.pointInGrid = _pointInGrid;
this.$d = _bitmapData;
 this.build();
}
 private function build():void{
this.$material = new BitmapMaterial(this.$d);
this.plane = new Plane();
 with(plane){
material = this.$material;
width = this.$size.width;
height = this.$size.height;
yUp = false;
bothsides = false;
 }
 plane.layer = DrawGraphic.RECTANGLE(140, 140, Math.random()*0xffffff);
this.$parent.$view.addChild(plane.layer);

this.$parent.$scene.addChild(plane);
  var btArray:ByteArray = new ByteArray();
  btArray.writeObject(plane.vertices);
btArray.position = 0;
 this.$verticles0 = btArray.readObject() as Vector.<Number>;
 this.plane.addEventListener(MouseEvent3D.MOUSE_DOWN, onMouseDown);
this.plane.addEventListener(MouseEvent3D.ROLL_OVER, onRollOver);
// this.plane.addEventListener(MouseEvent3D.ROLL_OUT, onRollOut);
}

private function onRollOver(e : MouseEvent3D) : void {
 TweenLite.to(this.plane.layer,.3,{colorTransform:{tint:0xffffff, 
tintAmount:.6}, onComplete:onRollOut, ease:Bounce.easeOut});
 this.$parent.$view.setChildIndex(plane.layer, 
this.$parent.$view.numChildren-1);
}

private function onRollOut() : void {
TweenLite.to(this.plane.layer,.1,{colorTransform:{tint:0xffffff, 
tintAmount:0}});
}
 ////////////////////////////
// EVENTS
////////////////////////////
 private function onMouseDown(e:MouseEvent3D):void {
    if(this.active){
     TweenLite.to(this.plane.layer,.5,{colorTransform:{tintAmount:0}});
    this.active = false;
    }else{
   
 TweenLite.to(this.plane.layer,.5,{colorTransform:{tint:Math.random()*0xffffff, 
tintAmount:1}});
    this.$parent.$view.setChildIndex(plane.layer, 
this.$parent.$view.numChildren-1)
    this.active = true;
    }
//    
    
this.dispatchEvent(new CustomEvent(CustomEvent.ON_ACTIVATE_PLANE, this));
}
}
}

Reply via email to