Skip to main content
Known Participant
Aug 28, 2022 10:01 AM UTC
Answered

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

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 is closed to new replies. Start a new post to keep the conversation going.
    kglad
    kgladCorrect answer
    Community Expert
    Aug 28, 2022 4:27 PM UTC

    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

    3 replies

    kglad
    Community Expert
    kgladCommunity ExpertCorrect answer
    Community Expert
    Aug 28, 2022 4:27 PM UTC

    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

    Translate
    Known Participant
    Aug 29, 2022 9:59 AM UTC

    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

    Translate
    kglad
    Community Expert
    Community Expert
    Aug 29, 2022 2:10 PM UTC

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

    Translate