actionscript 3 - How to make a movie clip visible if only five movie clips (not more) are clicked -
i have 25 movie clips on stage , can clicked , colored. want movie clip named text_mc became visible if 5 specific buttons clicked , colored - not more. if user choose more 5 movie clips (even thought 5 movie clips included) movie clip named text_mc should stay invisible. can' t last part: if more 5 specific movie clips clicked text_mc should stay invisible. can please me? code
stop(); import flash.display.movieclip; var sximata:movieclip = square1; import flash.display.movieclip; import flash.events.mouseevent; import flash.geom.colortransform; text_mc.visible=false; square1.addeventlistener(mouseevent.click, onsquare1); function onsquare1(e:mouseevent):void { sximata = square1; } square2.addeventlistener(mouseevent.click, onsquare2); function onsquare2(e:mouseevent):void { sximata = square2; } square3.addeventlistener(mouseevent.click, onsquare3); function onsquare3(e:mouseevent):void { sximata = square3; } square4.addeventlistener(mouseevent.click, onsquare4); function onsquare4(e:mouseevent):void { sximata = square4; } square5.addeventlistener(mouseevent.click, onsquare5); function onsquare5(e:mouseevent):void { sximata = square5; } square6.addeventlistener(mouseevent.click, onsquare6); function onsquare6(e:mouseevent):void { sximata = square6; } square7.addeventlistener(mouseevent.click, onsquare7); function onsquare7(e:mouseevent):void { sximata = square7; } square8.addeventlistener(mouseevent.click, onsquare8); function onsquare8(e:mouseevent):void { sximata = square8; square8clicked = true; checkbuttons(); } square9.addeventlistener(mouseevent.click, onsquare9); function onsquare9(e:mouseevent):void { sximata = square9; square9clicked = true; checkbuttons(); } square10.addeventlistener(mouseevent.click, onsquare10); function onsquare10(e:mouseevent):void { sximata = square10; square10clicked = true; checkbuttons(); } square11.addeventlistener(mouseevent.click, onsquare11); function onsquare11(e:mouseevent):void { sximata = square11; } square12.addeventlistener(mouseevent.click, onsquare12); function onsquare12(e:mouseevent):void { sximata = square12; } square13.addeventlistener(mouseevent.click, onsquare13); function onsquare13(e:mouseevent):void { sximata = square13; square13clicked = true; checkbuttons(); } square14.addeventlistener(mouseevent.click, onsquare14); function onsquare14(e:mouseevent):void { sximata = square14; square14clicked = true; checkbuttons(); } square15.addeventlistener(mouseevent.click, onsquare15); function onsquare15(e:mouseevent):void { sximata = square15; } square16.addeventlistener(mouseevent.click, onsquare16); function onsquare16(e:mouseevent):void { sximata = square16; } square17.addeventlistener(mouseevent.click, onsquare17); function onsquare17(e:mouseevent):void { sximata = square17; } square18.addeventlistener(mouseevent.click, onsquare18); function onsquare18(e:mouseevent):void { sximata = square18; } square19.addeventlistener(mouseevent.click, onsquare19); function onsquare19(e:mouseevent):void { sximata = square19; } square20.addeventlistener(mouseevent.click, onsquare20); function onsquare20(e:mouseevent):void { sximata = square20; } square21.addeventlistener(mouseevent.click, onsquare21); function onsquare21(e:mouseevent):void { sximata = square21; } square22.addeventlistener(mouseevent.click, onsquare22); function onsquare22(e:mouseevent):void { sximata = square22; } square23.addeventlistener(mouseevent.click, onsquare23); function onsquare23(e:mouseevent):void { sximata = square23; } square24.addeventlistener(mouseevent.click, onsquare24); function onsquare24(e:mouseevent):void { sximata = square24; } square25.addeventlistener(mouseevent.click, onsquare25); function onsquare25(e:mouseevent):void { sximata = square25; } var mycolortransform:colortransform=transform.colortransform; red_btn.addeventlistener(mouseevent.click, changecolour); function changecolour(event:mouseevent):void { mycolortransform.color=0xbd8d46; sximata.transform.colortransform=mycolortransform; } resetbutton.addeventlistener(mouseevent.click, fl_mouseclickhandler); function fl_mouseclickhandler(event:mouseevent):void { gotoandplay(1); } var square8clicked:boolean = false; var square9clicked:boolean = false; var square10clicked:boolean = false; var square13clicked:boolean = false; var square14clicked:boolean = false; function checkbuttons():void { if(square8clicked && square9clicked && square10clicked && square13clicked && square14clicked) { text_mc.visible = true; } }
you add boolean variable each of other functions turns true if of other squares clicked. example:
var isclicked:boolean = false; square1.addeventlistener(mouseevent.click, onsquare1); function onsquare1(e:mouseevent):void { sximata = square1; isclicked = true; }
and in check buttons function, check see if "isclicked" still false:
function checkbuttons():void { if(!isclicked && square8clicked && square9clicked && square10clicked && square13clicked && square14clicked) { text_mc.visible = true; } }
Comments
Post a Comment