Recent posts by zdbzd on Kongregate

Flag Post

Topic: Game Programming / AS3 matrix handler

AS3 has a built in 2d matrix class. If you’re targeting flash 10 then there is also a built in 3d matrix class

 
Flag Post

Topic: Game Programming / checking if a swf is hosted by kongregate

It’s almost as simple as just comparing stage.loaderInfo.url

This article provides a good explanation of how to site lock. Just follow the basics in it and instead of site locking alter the preloader code in use.

If you want a really easy solution you could just use:

if (stage.loaderInfo.url.indexOf("kongregate.com") != -1)
{
    // kong preloader
}
else
{
    // mochi preloader
}

However that does leave a loop hole where a malicious portal owner can disable the ads by simply adding “kongregate.com” to the url. For example under this method the url:

http://www.example.com/graygers_game/kongregate.com/file.swf

Would display the kong preloader, not the mochi one

 
Flag Post

Topic: Game Programming / <SOLVED> Clear an array???

In addition to what saybox said: if you want to check if a specific position in an array is empty then use

if (myArray[index] == undefined)
{
   // no contents at position index
}