Bug in Astro(Flash 10) or My mistake
Friday, August 29th, 2008Trying to rotate a cube in flash 10 with its new 3D features
I placed a movie clip at z index 1 having alpha 0.5
I placed a movieclip at z index 50 having alpha 1 and again i placed movie clip at z index 100 with alpha 1
I can view the last movie clip as because the alpha is 0.5 for the the two upper movie clip but when i rotate the movie clip and when the last movie clip comes to front then still i can view the two movie clip which is not quite natural in case of 3d objects the code goes as follows
=============================================
package
{
import flash.display.*;
import flash.events.*;
import flash.media.*;
public class Regauqablo extends MovieClip
{
private var container:MovieClip=new MovieClip();
private var glassBox:MovieClip=new MovieClip();
private var pane1:GlassPane=new GlassPane(0xffffff);
private var pane2:GlassPane=new GlassPane(0xffffff);
private var pane3:GlassPane=new GlassPane(0xffffff);
private var pane4:GlassPane=new GlassPane(0xffffff);
private var pane5:GlassPane=new GlassPane(0xffffff);
private var pane6:GlassPane=new GlassPane(0xffffff);
private var back:GlassPane=new GlassPane(0xff0000);
[Embed(source=”LILY.jpg”)]
private var Lily:Class;
// private var back:Bitmap= new Lily();
public function Regauqablo()
{
pane1.alpha=1;
pane2.alpha=0.5;
pane3.alpha=0.5;
pane4.alpha=0.5;
pane5.alpha=0.5;
pane6.alpha=0.5;
back.alpha=0.5;
glassBox.addChild(pane1);
glassBox.addChild(pane2);
pane2.rotationX=270;
glassBox.addChild(pane3);
pane3.rotationY=90;
pane4.x+=pane4.width;
glassBox.addChild(pane4);
pane4.rotationY=90;
pane5.y+=pane5.height;
glassBox.addChild(pane5);
pane5.rotationX=270;
glassBox.addChild(pane6);
glassBox.addChild(back);
pane1.z=200;
pane2.z=200;
pane3.z=200;
pane4.z=200;
pane5.z=200;
back.z=100;
glassBox.x=100;
glassBox.y=100;
this.addChild(glassBox);
this.addEventListener(Event.ENTER_FRAME,doFrame);
}
function doFrame(e:Event):void
{
this.glassBox.rotationY+=.5;
}
}
}
import flash.display.*;
class GlassPane extends MovieClip
{
public function GlassPane(color:uint)
{
this.graphics.moveTo(0,0);
this.graphics.beginFill(color,1);
this.graphics.moveTo(200,0);
this.graphics.lineTo(200,200);
this.graphics.lineTo(0,200);
this.graphics.lineTo(0,0);
this.graphics.endFill();
}
}
=====================================
please check the file below for the output (FLASH 10 player needed)