Skip to main content
Known Participant
August 28, 2022
Answered

Visibility or opacity not working in a set interval function in HTML5

  • August 28, 2022
  • 1 reply
  • 220 views

Dear all, thank you for your time

I have a strange problem with visibility and opacity in a set interval function , every time i put

the code in I get an error in the console "Uncaught SyntaxError: invalid assignment left-hand side".

I tried putting == instead of =  error cleared but the visibility would not work.All other operations work inside the function, I also tried opacity as well but the results were the same.

 

function control(){

//abs reset
if ( this.swpanel_main.alt_mc.currentFrame == (0)&& this.swpanel_main.bat_mc.currentFrame == (0)&& this.main_mc.mainstart_mc
. currentFrame == (0))(
//Schematic

this.enginst_mc.amp_mc.gotoAndStop(0)&
this.enginst_mc.fqind_mc.gotoAndStop(0)&
this.enginst_mc.vac_mc.gotoAndStop(0)&
this.enginst_mc.fflow_mc.gotoAndStop (0)&
this.enginst_mc.oil_mc.gotoAndStop (0)&
this.bata_mc.visible = false &

this.tach_mc.tacind_mc.gotoAndStop(0)&

this.warnpnl_mc.wvac_mc.gotoAndStop(0)&
this.warnpnl_mc.wvolts_mc.gotoAndStop(0)&
this.warnpnl_mc.woil_mc.gotoAndStop(0)

)

//ABS
if ( this.swpanel_main.alt_mc.currentFrame == (5)&&this.swpanel_main.bat_mc.currentFrame == (5)
&&this.main_mc.mainstart_mc. currentFrame ==(20) )(

//Schematic

this.enginst_mc.amp_mc.gotoAndStop(33)&
this.enginst_mc.fqind_mc.gotoAndStop(15)&
this.enginst_mc.vac_mc.gotoAndStop(19)&
this.enginst_mc.fflow_mc.gotoAndStop (9)&
this.enginst_mc.oil_mc.gotoAndStop (19)&

this.tach_mc.tacind_mc.gotoAndStop(19)&

this.warnpnl_mc.wvac_mc.gotoAndStop(0)&
this.warnpnl_mc.wvolts_mc.gotoAndStop(0)&
this.warnpnl_mc.woil_mc.gotoAndStop(0)
this.bata_mc. visible = true;
)

}

setInterval(control.bind(this),100);

 

Full code 360 lines

 

I do not know what I am doing wrong ?

Best regards

Spycatcher

    This topic has been closed for replies.
    Correct answer kglad

    did the forum mess up your code?  (use the insert code option to prevent that)

     

     

    if not, you're using the bitwise ampersand (=&) operator, and you're using it in a way that does not make sense to me.  plus the formatting of your if-statement is incorrect.  that should be:

     

    if(a&&b&&c){  // left curly bracket

    // do whatever

    }  // right curly bracket

    1 reply

    kglad
    Community Expert
    kgladCommunity ExpertCorrect answer
    Community Expert
    August 28, 2022

    did the forum mess up your code?  (use the insert code option to prevent that)

     

     

    if not, you're using the bitwise ampersand (=&) operator, and you're using it in a way that does not make sense to me.  plus the formatting of your if-statement is incorrect.  that should be:

     

    if(a&&b&&c){  // left curly bracket

    // do whatever

    }  // right curly bracket

    Known Participant
    August 29, 2022

    Thank you very much my mistake when used the & the code worked so led me down a tunnel of adapting the code

    to work now changed the if statement it worrks ok . Dont understand why the wrongnbrackets did not bring a consle error.

    Best Regards

    Peter

    kglad
    Community Expert
    Community Expert
    August 29, 2022

    you're welcome.  (but you're making the same mistakes today in another post).