ActionScript: Protect your Flash games on the web, sitelock all your games.
If you want to submit your games on one game portals DO NOT UPLOAD YOUR GAMES WITHOUT A SITELOCK SCRIPT.
WHY ?
Your games can be “stolen” by game portals. Or if you didn’t finish your game it’s a really a “pain in the ass” to update your games spread on all the web.
I tried lot of code for sitelocking my games but some of them are in ActionScript 2.0 or totally out of date. Some of them can’t work with the “https” or without the “www” characters.
Another example when you to want to test your game on your local computer you have to comment the script. And you can forget to uncomment the sitelock script when you submit your game on the web.
So I decided to create my own script.
This is a short version of my script.
But this one is perfect for all uses.
Installation
Copy and Paste this code and add your domains into the array “[ ]” separated by commas :
["kongregate.com", ..., ...]
You can lock the local mode by adding a second parameter : false
The default value is set to true.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | sitelock(["kongregate.com","benoitfreslon.com"]) /** * Sitelock your swf file on domains * * @param arrDomain List of all authorized domains * @param local This swf can be played on local computer ? */ function sitelock(arrDomain:Array, local:Boolean = true):void { var isAut:Boolean = false; var url:String = root.loaderInfo.url; var arr:Array = root.loaderInfo.url.split("://"); var domain:String = arr[1].split("/")[0]; // localmode if (url.split("file://").length > 1) { if (local) { //trace("Local mode is autorized"); return } else { destroy(); return; } } for (var i:String in arrDomain) { arr = domain.split(arrDomain[i]); if (arr.length > 1) { isAut = true; domain = arrDomain[i]; //trace("*** Sitelock: Domain found"); break; } } if (! isAut) { //trace("*** Sitelock: Not authentified"); destroy(); } return; } /** * This function is called when the game is locked. */ function destroy() { // Domain error trace("*** Domain Error ***"); root.alpha = 0 } |
In: ActionScript3 as3, Tip · Tagged with: domain, flash, game, lock, protection, site, sitelock
ActionScript: Good practices in Flash developement
Here some tips and a list of good practices in Flash developement.
These tips are usefull for coders and designers.
Prepare your layers
When you create a new .fla file prepare your layers like this :
Add a new layers “Actions” on the top of the list. This layer will be dedicated to ActionScript.
Then lock this layer to avoid adding graphic elements here.
Lock the main script
In order to keep in sight your main script, I recommend to lock this script by clicking on the pin on the bottom of the Actions pannel like this :
Permit debugging
Enabled the Flash debugger to display more efficient error messages.
File> Publish settings… > Permit debugging
You can find this kind of message if you got an execution error : (My Flash player is in french language)
1 2 | TypeError: Error #1009: Il est impossible d'accéder à la propriété ou à la méthode d'une référence d'objet nul. at Untitled_fla::MainTimeline/frame1()[Untitled_fla.MainTimeline::frame1:3] |
This error is located on the 1st frame on line 3. So useful !
However you must uncheck this option before publishing your swf on the web.
The library
Order you symbols and your medias in folders. Name your folders with explicit names.
Name your folders by using the prefix “_”.
This tip can keep all your folders in the top of the list.
And you can name a symbol or a media like your foler.
Example: _Ball Folder own the Ball symbol.
The library orders elements and folders by alphabetical order.
Your library is now more lisible.
Name your symbols and your medias correctly
When you name your symbols or you media, particularly MovieClips, Istrongly recommand using a capital letter on the first character.
Why ?
When flash adds a new MovieClip with ActionScript he uses the class name exported for ActionScript.
By convention a class name has always a capital letter on the first character.
var mc = new BlueScreenOfTheDeath(); addChild(mc)
However the symbol name match with the class name when you link the symbol for ActionScript. So keep the same name.
Naming convention
ActionScript looks like Java so use the Java naming convention.
http://en.wikipedia.org/wiki/Naming_convention_(programming)#Language-specific_conventions
In: ActionScript3 as3, Tip
Rolling Jump – iOS highly addicting game
Hello, I’m proud to present you my last game on iOS: Rolling Jump. The Flash version was designed and developed in may 2009.
The new version is co-published by Chugulu.
You can download the free version here. The free version is limited by the score : 10 000 pts max. Or buy the full version here for $1.49.
Enjoy! And thanks to the Chugulu Team.
Description
Help Lighty save the light of the world by escaping from the dark evil creatures in this incredibly FUN and ADDICTING game! Simply jump from each wheel up into the sky and stars to protect the light of the world.
In Rolling Jump, your goal is to help the hero, Lighty, jump up into the sky and away from the dark evil creatures as fast as possible. Learn secrets of the game like double tapping, jumping onto walls, and discover how to attain the rainbow path to help Lighty save the light of the world, and ultimately prove his worth.
★ 7 levels to discover the stars
★ Increasing difficulty and real challenge for the hardcore gamers
★ Multiply your score x5 with perfect jumps
★ Use wall to bounce and reach upper wheels
★ Compete in a worldwide ranking via Game Center
★ Compare your score with your friends and challenge them !
★ Cute Retina graphics
Get free tips and be the first to hear updates about Rolling Jump on Facebook :
http://www.facebook.com/rollingjump
In: Games, iPhone, News
Nano War 2 finally playable
Finally the sequel of Nano War 1 released in november 2007.
I hope that new game will be a great success llike the first episode.
Every humans own billons of nanoscopic cells.
Some of these cells are doomed to protect our organism and fight foreign organisms.
Even confined to smaller and unlikely places the war is present.
Welcome on Nano War 2.
Play Nano War 2 on Kongregate.
What’s news ?
- Solo mode
- 25 levels: play against 1, 2 or 3 computers.
- Upgrade your cells
- 3 difficulty levels
- Multiplayer: play against 1, 2 or 3 players.
- Skirmish mode
- 21 Achivements
- The White blood cell: Increase your cells and capture opponent’s cells.
- The Fat cell: Protect your cells or infect opponent’s cells
- The Antibody cell: The most powerfull cell, increase your production or capture opponent’s cells and units instantly.
Have fun!
In: Flash, Games, Nano War · Tagged with: flash, game, multiplayer, nano war 2, nanowars, rts
Garden Rush : Facebook time management game
If you like or if you don’t like vegetables, fruits, salads you can play Garden Rush on Facebook.
Garden Rush is a time management game but don’t worry it isn’t a percistant game like City Ville.
And if you like Alice Greenfingers you will also like Garden Rush.
The gameplay loop look like this one :
Plant > Arose > Weed > Seasonal illnesses > Prune > Collect > Sell
The game is actually fun and addictive and the graphics are pretty. Nice work team!
The game was ordered by MesmoGames, the owner of Bouncing Balls or Gems II.
Exkee developed the game and I worked as an ActionScript coder and as a lead director for the first period.
In: Flash, Games, News · Tagged with: casual, facebook, flash, garden game, time management
Roll n Jump : iphone free on the app store
If you liked doodle jump you will love Roll n Jump.
Tap to jump from a wall or a circle or do a double jump in the air.
In: Games, iPhone, News · Tagged with: 4, cocos2d, ios, iPhone, jump, roll
Roll n Jump : android, on the market
You are welcome to download my game Roll n Jump for free from the Android Market:
https://market.android.com/details?id=air.com.benoitfreslon.rollnjump
Game Description
Roll n Jump is a skill game where the goal is to climb as high as possible.
Roll and Jump is a skill game where the goal is to climb as high as possible by jumping from a rolling circle to another.
Tap to jump from a wall or a circle or do a double jump in the air.
Clim and do the highest score as possible.
Screenshots
In: Android, Games · Tagged with: air, Android, game
Nano War 2 : Gameplay video, singleplayer
In: Flash, Games, Nano War · Tagged with: demo, gameplay, nano war 2, nanowar 2, singleplayer
Poker Geeks Left Out in the Cold by Apple (but Loving Android)
Apple’s iPhone has been a huge success and its iPad tablet has gotten off to a hot start as well, but Apple’s strict policy towards gambling apps in the App Store have left a lot of poker geeks out in the cold. In many ways the iPhone and iPad are the poker players’ dream device, letting them enjoy all the action on the fly and cram in a few hands here and there when they have some spare time, whether at work, waiting for friends, or working on ActionScript projects like how to create a gravity like a Mario platformer.
The only hitch in those plans is while there are a ton of poker apps available for the iPhone and iPad, none of them let poker fans play on the two major online sites — Full Tilt and PokerStars. Apple has adopted a strict policy to the types of apps it approves for listing in the App Store and so far any app that can be used for real money wagering at a site that accepts US players has gotten the cold shoulder. Throw in Apple’s refusal to support Flash (which rules out the possibilities of players using any of the available Flash-based no-download poker rooms or casinos) and you’ve got a lot of frustrated poker players ready to chunk their iPhone out the window.
Frustration with Apple isn’t new for poker players, as it took years for all the major sites to provide Mac poker clients for players. While there’s no great solution to the current problem, it’s an area in which owners of Android devices are having the last laugh. With much looser restrictions on what can be distributed in the Android Market, many poker app developers are focusing on Android apps instead. Full Tilt has already made some of its real money games accessible through an Android app, with other online poker sites to follow shortly.
As was the case when developing poker sites for Mac clients, online operators have to balance a lot of factors when developing clients and apps, and potential market size is an important one. While some have held back on developing Android apps for poker and casino gaming, the rising popularity of Android devices is making it a market that can no longer be ignored, likely resulting in more and more poker apps coming to the Android Market soon.
Olivier MacLennan
In: News · Tagged with: Android, iPhone, mac, poker
ActionScript: Tutorial How to create a gravity like a Mario platformer
In this little tutorial you will learn how to create a gravity like a Mario platformer.
Let’s start!
Get files
- Save these 2 sprites (Right click > Save as)


- Open Flash and create a new ActionScript 3.0 document.
- Document properties: 24 fps, 550×400 by default.
Create the Hero MovieClip
- Create a new Symbol: Insert > New symbol > MovieClip
- Symbol name: Hero
- Check Export for ActionScript
- And Click OK
- Now you are in you Hero symbol! Perfect!
- Import the first sprite: mario_stand.png on the first frame:
- File > Import > Import to stage > mario_stand.png
- Set the sprite just on the top of the little black cross (pivot point)
- Now create an empty keyframe on the timeline:
- Timeline > 2nd frame on the timeline > Right Click > Create empty Keyframe
- Import the second sprite: mario_jump.jpg on the second keyframe
- Then create a new layer on the top and set 2 labels names
- Insert > Timeline > New layer
- And add 2 labels names:
- On the timeline click on the first key frame with the mario_stand.png sprite and go to the Properties pannel > Label > Name > stand
- On the timeline click on the second key frame with the mario_jump.png sprite and go to the Properties pannel > Label > Name > jump
Add the jump script
- Back to the main scene: Click on the Scene 1
- Add a new layer named “Actions”: Insert > Timeline > New layer
- And open the Actions pannel: Timeline > Actions Layer > Keyframe > Right click > Actions
- Finally copy and paste this code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | // The game gravity var gravity = 0.8; // The floor position (y) var floor = 300; // Add the hero MovieClip var hero = new Hero(); // Set the x position hero.x = 550/2; // Set the y position on the floor hero.y = floor; // Set the hero state to "stand" hero.gotoAndStop("stand"); // Add hero on the display list addChild(hero); // Create and set the speedY property to 0 hero.speedY = 0 // Create and set the jump impulsion to 10 hero.impulsion = 10; // Add an enter frame event hero.addEventListener(Event.ENTER_FRAME, heroEnterFrame) function heroEnterFrame (pEvent) { // On each frames... // Set the world gravity hero.speedY += gravity; // Move the hero with his speedY hero.y += hero.speedY; // If the y property is larger than the floor position if (hero.y > floor) { // Set the hero on the floor hero.y = floor // Cancel the current speed hero.speedY = 0; // Change the state to stand hero.gotoAndStop("stand"); } } // Add a mouse event on the stage stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown) function mouseDown (pEvent) { // When the user click on the stage... // If the hero is standing if (hero.currentLabel == "stand") { // Set the new speedY with the hero impulsion hero.speedY = -hero.impulsion; // And change the state to jump hero.gotoAndStop("jump"); } } |
Download sources: www.benoitfreslon.com_Create_gravity_like_a_mario_plateformer
In: ActionScript3 as3, Game Design, Tip, Tutorial · Tagged with: acceleration, as3, bounce, gravity, jump, mario, physic, plateformer, sonic
























