All Posts in Code Sample

January 3, 2012 - No Comments!

Code Snippet – Get Day in Year

Small code snippet that calculates the number of the selected day in the overall year (e.g. 1st Feb is the 32nd day of the year).

function getDayInYear(day:int,month:int,year:int):int
{
var day:int = day;
var month:int = month;
var year:int = year;
var dias:Array = [31,28,31,30,31,30,31,31,30,31,30];
if(year%4 == 0 && month > 1)
day++;
for(var i:int = 0;i < month;i++) day+=dias[i]; return day; }

June 9, 2011 - No Comments!

WCK Pure AS3 Example with Contact Events

The WCK framework is something I used recently on the Blackberry Playbook version my Susie Starfish app. Moving into the world of physics is a big step for any flash dev and I feel the WCK framework is a good way to get up to speed on some of the basics.

Moving onwards I wanted to be able to appreciate how the framework works a little more so I could begin to program aspects myself through pure code in a way that was more familiar to me than the Box2DAS port. My reasoning is that I just wanted to be a little more in control for when I come to memory management and the general interactivity of the project. The following code snippet is a quick example of a box falling onto the ground and firing off the events related to such an activity.

Read more