Hi everybody,
I have made a 3D model of a cube and imported it into Flash Builder with preFab and away3d as follows:
package
{
import away3d.cameras.HoverCamera3D;
import away3d.containers.*;
import away3d.events.MouseEvent3D;
import com.greensock.TweenLite;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.utils.*;
import models.cube;
[SWF(width=“600”, height=“600”, frameRate=“60”, backgroundColor=”#000000”)]
public class model extends Sprite
{
public var view:View3D;
private var cam:HoverCamera3D;
private var move:Boolean = false;
private var lastPanAngle:Number;
private var lastTiltAngle:Number;
private var lastMouseX:Number;
private var lastMouseY:Number;
public var model_cube:cube = new cube;
public var side:cube; //?
public function model()
{
start();
view.scene.addChild(model_cube);
turn(); //?
}
public function start(): void
{
cam = new HoverCamera3D({zoom:1, focus:7});
cam.panAngle = cam.panAngle = 25;
cam.tiltAngle = cam.tiltAngle = 25;
cam.hover(true);
view = new View3D({x:300,y:300,camera:cam});
addChild(view);
view.camera.y = 300;
view.camera.zoom = 50;
this.addEventListener(Event.ENTER_FRAME,update);
stage.addEventListener(MouseEvent.MOUSE_DOWN, MouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP, MouseUp);
}
public function turn():void
{
// ? TweenLite.to(side.Obj_000002_Bitmap_Bitmap, 1, {rotationZ:90, timeScale:0.5, scaleX:1, scaleY:1});
}
public function update(e:Event):void
{
var cameraSpeed:Number = 0.5;
if (move)
{
cam.panAngle = cameraSpeed*( stage.mouseX - lastMouseX) + lastPanAngle;
cam.tiltAngle = cameraSpeed*(- stage.mouseY + lastMouseY) + lastTiltAngle;
}
cam.hover();
view.render();
}
private function MouseDown(event:MouseEvent):void
{
lastPanAngle = cam.panAngle;
lastTiltAngle = cam.tiltAngle;
lastMouseX = stage.mouseX;
lastMouseY = stage.mouseY;
move = true;
}
private function MouseUp(event:MouseEvent):void
{
move = false;
}
}
}
The 3D model of the cube consists of 6 sides with each their own texture (jpg). You can find the script of the cube in the attachment.
Is it possible to turn around one of the 6 sides of the cube with a tween from the script above?
So is it possible to do tweens into an external file (attached file) from another file?