Hi kglad. Thank you very much for that. I get the logic of the code but I'm still not sure how to integrate the code I've used for the buttons with the code above. The code I've used makes a button disappear, once clicked, to reveal an object which is on a separate layer directly underneath the button. I've attached a screen recording as well to help explain what I mean.
Following is the code used for the buttons:-
var _this = this;
_this.Day1_btn.on('click', function(){
_this.Day1_btn.visible = false;
});
var _this = this;
_this.Day2_btn.on('click', function(){
_this.Day2_btn.visible = false;
});
var _this = this;
_this.Day3_btn.on('click', function(){
_this.Day3_btn.visible = false;
});
Day1_btn.mouseEnabled = false;
Day2_btn.mouseEnabled = false;
Day3_btn.mouseEnabled = false;
image1.visible = false;
image2.visible = false;
image3.visible = false;
// checking once per hour in case someone has their browser open and your site is loaded for hours.
var checkDateI = setInterval(checkDateF,3600000);
function checkDateF(){
var date = new Date();
if(date.getMonth()==10 && date.getDate()==15){
trace("15");
Day1_btn.mouseEnabled = true;
} else if(date.getMonth()==10 && date.getDate()==15){
Day2_btn.mouseEnabled = true;
} else if(date.getMonth()==10 && date.getDate()==15){
Day3_btn.mouseEnabled = true;
}
}
checkDateF();
Day1_btn.addEventListener(MouseEvent.CLICK, fn1);
function fn1(event:MouseEvent){
trace("hi1");
Day1_btn.visible = false;
image1.visible = true;
}
Day2_btn.addEventListener(MouseEvent.CLICK, fn2);
function fn2(event:MouseEvent){
trace("hi2");
Day2_btn.visible = false;
image2.visible = true;
}
Day3_btn.addEventListener(MouseEvent.CLICK, fn3);
function fn3(event:MouseEvent){
Day3_btn.visible = false;
image3.visible = true;
}
Add 3 images to your stage and name them image1, image2, image3.
Maybe not the best way to write AS3, but it works.
Change the date of the functions. They are now set to today.
November = 10
December = 11