Hi everyone,
I have a rotating 3d cube on frame 1. I have it rotating on a loop through addlistener and if we go to another frame I remove the listener. However, the problem is when I return to frame 1 the cube is not rotating anymore. How can I “re-add” a listener (if that makes any sense). Why is it not launching?
Here is the code I have for the cube:
import com.theflashblog.fp10.SimpleZSorter;
import com.theflashblog.fp10.SimpleZSortVO;
import flash.display.DisplayObject;
import flash.geom.Point
con.getChildAt(0).rotationY = 90;
con.getChildAt(0).x = -140;
con.getChildAt(1).rotationY = 90;
con.getChildAt(1).x = 140;
con.getChildAt(2).z = 140;
con.getChildAt(3).rotationX = 90;
con.getChildAt(3).y = 140;
con.getChildAt(4).rotationX = 90;
con.getChildAt(4).y = -140;
con.getChildAt(5).z = -140;
addEventListener(Event.ENTER_FRAME, loop);
function loop(e:Event):void {
if(this.currentFrame ==1)
{
SimpleZSorter.sortClips(con);
con.rotationY -= (mouseX - stage.stageWidth / 2) * 0.003;
con.rotationX += (mouseY - stage.stageHeight / 2) * 0.003;
e.currentTarget.removeEventListener(Event.ENTER_FR AME, loop);
}
}