JOIN OVER 31,000HAPPY CUSTOMERS AND GET ACCESS TO OUR FULL COLLECTION OF SENSATIONAL THEMES - 33 FOR THE PRICE OF ONE!

Flash AS3 Tutorial: Simple Calendar part 2

Our WordPress minimalistic Calendar has been very well received so we decided to share some of the knowledge behind it. In our first edition of Calendar tutorial we implemented a simple calendar that showed the current month and highlighted the current day. We will make a step further and add forward and backward buttons that will allow us to scroll through months. Calendar will be redrawn each time so the positioning of days is always correct.

We will now draw the backward button also, the only difference is that the rotation is now -90. We will call the function ForwardMonth each time a user clicks on the forward button and function BackwardMonth each time user clicks on backward button.

STEP 3: SCROLLING THROUGH MONTHS

Function ForwardMonth is actually pretty simple. We will first empty all sprite containers so we always start drawing from point zero. We now have to either add or substract one month. When we move forward we have to add one year once we reach the last month. Now we get the position of first day and call the main function again. Function ForwardMonth now looks like this:

FunctionBackwardMonth is pretty much the same apart from the part where we substract months and years:

if (month == 0){
year–;
month = 12;
}
month–;

CONCLUSION

We will not list all the changes made to the source file from the previous version since I would like this tutorial to be as clear and straightforward as possible. Each part is explained in the source files and you shouldn’t have any problem following the mechanics behind the calendar. Our final edition of Flash Calendar Tutorial will implement a simple event on a certain day, similar to our WordPress Multi Events Calendar Plugin.

MARKET FOR CREATIVES

OPTIN MONSTER NEWSLETTER

Our Sponsors

Popular posts

OUR NEWSLETTER

Subscribe to our newsletter to receive news, updates, freebies and new WordPress Themes releases by email. We never spam.

Enter your email address...

Premiumcoding offers premium WordPress themes for corporate and personal use. From clean and minimal, to complex and multi-functional, every one of our themes is professional, responsive and beautiful.