an enterFrame event and a timer conflict


i have hittest on enterframe event adds movieclip.

i want movie clip on timer changes movieclip.

 

as can imagine, there conflict because hittest finds original mc over-rides timer.

i know logic problem cant seem figure out.i pretty sure thinking wrong way.

any suggestions?

 

here of code:

//this hittest

 

this.addeventlistener(event.enter_frame,leftpillarhit);

function leftpillarhit(ev:event):void {

if (drawer.mycursor.hittestobject(leftpillarhittest)) {

rightpillar.visible=false;

leftpillar.visible=true;

if(leftpillar.visible=true){

moviecliptimer.start();

}

 

this timer:

 

rightpillar.visible=false;

 

//swap 2 movie clips on timer

var moviecliptimer:timer=new timer(5000,0);

moviecliptimer.addeventlistener(timerevent.timer, changeimage);

function changeimage(evt:timerevent):void {

 

leftpillar.visible=! leftpillar.visible;

rightpillar.visible=! rightpillar.visible;

}

 

i don't know solve problem (i don't understand problem), following line not correct:

 

if(leftpillar.visible=true){

 

should either

 

if(leftpillar.visible==true){

 

or

 

if(leftpillar.visible){



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

Joomla site hacked, cant see front and - Joomla! Forum - community, help and support

Christian Home School Programs - Joomla! Forum - community, help and support

Trouble with PF_OutFlag_I_USE_AUDIO and PF_CHECKOUT_LAYER_AUDIO