Sunday, September 13, 2009

How Aperture Works?

For now just how Aperture Works


var whiteCircle_mc:whiteCircle = new whiteCircle();
var leafA_mc:mcNewLeaf = new mcNewLeaf();
var leafB_mc:mcNewLeaf = new mcNewLeaf();
var leafC_mc:mcNewLeaf = new mcNewLeaf();
var leafD_mc:mcNewLeaf = new mcNewLeaf();
var leafE_mc:mcNewLeaf = new mcNewLeaf();

var leafAInit:Number = new Number(0);
var leafInitial:Number = new Number(0);
var leafRotation:Number = new Number(-72);
var leafA_mcX:Number = new Number(53);
var leafA_mcY:Number = new Number(175);

addChild(whiteCircle_mc);
whiteCircle_mc.x = 200;
whiteCircle_mc.y = 219;

addChild(leafA_mc);
leafA_mc.x = leafA_mcX;
leafA_mc.y = leafA_mcY;
leafA_mc.rotation = leafInitial;

addChild(leafB_mc);
leafB_mc.x = 112;
leafB_mc.y = 346;
leafB_mc.rotation = leafInitial + leafRotation;

addChild(leafC_mc);
leafC_mc.x = 292;
leafC_mc.y = 346;
leafC_mc.rotation = leafInitial + (leafRotation * 2) ;

addChild(leafD_mc);
leafD_mc.x = 347;
leafD_mc.y = 173;
leafD_mc.rotation = leafInitial + leafRotation * 3 ;

addChild(leafE_mc);
leafE_mc.x = 200;
leafE_mc.y = 65;
leafE_mc.rotation = leafInitial + leafRotation * 4 ;


////// Circle on The Top /////
var topCircle_mc:topCircle = new topCircle();
addChild(topCircle_mc);
topCircle_mc.x = 200;
topCircle_mc.y = 220;
topCircle_mc.alpha = 1;


///// Aperture Buttons /////
fOneFour.addEventListener(MouseEvent.MOUSE_OVER, oneFourF);
fTwo.addEventListener(MouseEvent.MOUSE_OVER, twoF);
fTwoEight.addEventListener(MouseEvent.MOUSE_OVER, twoEightF);
fFour.addEventListener(MouseEvent.MOUSE_OVER, fourF);
fFiveSix.addEventListener(MouseEvent.MOUSE_OVER, fiveSixF);
fEight.addEventListener(MouseEvent.MOUSE_OVER, eightF);
fEleven.addEventListener(MouseEvent.MOUSE_OVER,elevenF);
fSixteen.addEventListener(MouseEvent.MOUSE_OVER, sixteenF);
fTwentytwo.addEventListener(MouseEvent.MOUSE_OVER, twentytwoF);
show_mc.addEventListener(MouseEvent.CLICK, showCircle);
hide_mc.addEventListener(MouseEvent.CLICK, hideCircle)

show_mc.buttonMode = true;
hide_mc.buttonMode = true;

function oneFourF(event:MouseEvent):void
{
leafInitial = 0;
rotateLeaf();
}

function twoF(event:MouseEvent):void
{
leafInitial = -3.8;
rotateLeaf();
}

function twoEightF(event:MouseEvent):void
{
leafInitial = -7.6;
rotateLeaf();
}

function fourF(event:MouseEvent):void
{
leafInitial = -11.4;
rotateLeaf();
}


function fiveSixF(event:MouseEvent):void
{
leafInitial = -15.2;
rotateLeaf();
}

function eightF(event:MouseEvent):void
{
leafInitial = -19;
rotateLeaf();
}

function elevenF(event:MouseEvent):void
{
leafInitial = -22.8;
rotateLeaf();
}

function sixteenF(event:MouseEvent):void
{
leafInitial = -26.6;
rotateLeaf();
}


function twentytwoF(event:MouseEvent):void
{
leafInitial = -30.4;
rotateLeaf();
}


function rotateLeaf():void
{
leafA_mc.rotation = leafInitial;;
leafB_mc.rotation = leafInitial + leafRotation * 1;
leafC_mc.rotation = leafInitial + leafRotation * 2;
leafD_mc.rotation = leafInitial + leafRotation * 3;
leafE_mc.rotation = leafInitial + leafRotation * 4;
}

function hideCircle(event:MouseEvent):void
{
topCircle_mc.alpha = .0;
}

function showCircle(event:MouseEvent):void
{
topCircle_mc.alpha = 1;
}

/// I also used a class file to create Mouse Over effect. If you need that file, email me...