Tuesday, March 30, 2010

Flipping 2 images on a background

When I unit test this code in Flash CS4 the code performs just fine. I click the button and the two image flips 180 degrees.

Publish it and all okay in IE8.

Try this in Firefox or Google Chrome and it flips once and then just flashs. My Flash debugger is not working on the file so I need some help from you.

The AS code:

import fl.transitions.Tween;

import fl.transitions.easing.Strong;

import fl.transitions.TweenEvent;

con.sidea.flip.addEventListener(MouseEvent.CLICK,onflip);

con.sideb.flip.addEventListener(MouseEvent.CLICK,onflip);

addEventListener(Event.ENTER_FRAME,loop);

var isStill:Boolean=true;

var arraytween:Array = new Array();

function onflip(e:Event) {

if (isStill) {

?arraytween.push(new Tween(con,'rotationY',Strong.easeOut,con.rotationY,con.rotationY+180,1,true));

?arraytween[0].addEventListener(TweenEvent.MOTION_FINISH,reset);

?isStill=false;

?}

}

function reset(e:Event) {

isStill=true;

arraytween=[];

}

function loop(e:Event) {

?if (con.rotationY%26gt;=90 %26amp;%26amp; con.rotationY%26lt;=270) {

?con.addChild(con.sideb);

?con.scaleX=-1;

?} else {

con.addChild(con.sidea);

con.scaleX=1;

?}

?if (con.rotationY%26gt;=360) {

?con.rotationY=0;

?}

}

Thanks, need your help.....

No comments:

Post a Comment