Facebook Bookmark Bookmark Bookmark Bookmark Bookmark Bookmark Bookmark Bookmark My Bookmark

LorenzGames, All about Flash Games!

Follow me on Twitter!

Add sounds using a dynamic code with Sonoflash.

September 29th, 2009 - Category: ActionScript 3, Developers, Sounds

Sonoflash in amazing, you can basically add sounds to your flash games just writing some code, and the sounds will be distorted and changed however you want.

You can choose from a list they provide on theire site and download, for free, the sound that you need.

SonoFlash

Check this video by Ryan Stewart.



Write a comment

Moving Bones in AS3 and Flash CS4

June 19th, 2009 - Category: ActionScript 3, Developers, Flash
This tutorial will teach you the basics to add bones to an object and move them using ActionScript 3.

It is quite simple, those are the steps to do:
  1. Design something ( to test i designed something like a snake Emoticon ).
  2. Click on the button Bone Tool (X).
  3. Draw a bunch of bones on the object making sure they are attached.
OK, now you should have something like this:
A Snake moved with bones in AS3
Make sure the last bone on the head is called: ikBoneName6

As you can see in the TimeLine now you have a new layer called Armature_(Number), rename it to Armature_1 if it has another number.

Now click on the Armature_1 layer and you should see in the properties something like this:
Armature Bones setting in AS3
Make sure to change the Type in Runtime.

Now create an empty layer where to place the ActionScript on the TimeLine (to keep the tutorial short i placed everithing on the timeline).
import fl.ik.*;
 
var tree:IKArmature = IKManager.getArmatureByName("Armature_1");
var bone:IKBone = tree.getBoneByName("ikBoneName6");
 
// tailJoint will manage the point of your bone, if you want to manage the head of your bone you need to use headJoint
var tJ:IKJoint = bone.tailJoint;
var posT<img src='http://www.lorenzgames.com/smiles/P.gif' alt='Emoticon' width='14' height='14' />oint=tJ.position;
 
var ikMover:IKMover = new IKMover(tJ, posT);
 
addEventListener(Event.ENTER_FRAME, onFrame); 
function onFrame(event:Event){
	posT.x=mouseX;
	posT.y=mouseY;
	ikMover.moveTo(posT);
}


Now you are set, Test the movie and you should get something like this:



Of course spending lil bit more of time will make this a lot better! Emoticon


Write a comment

How to save a JPG or PNG image with AS3

March 9th, 2009 - Category: ActionScript 3, Flash
Today I was looking for a way to create a game that makes screenshot of the played levels and then save them as JPG on my server.
Luckly I have found a class made by STROEP at this address.
ImageSaver for AS3
This class actually works on everything and the quality of the PNG is great!
I have tried to make some screenshot while I was playing and it is pretty fast.
You can turn into a file whatever thing is happening during the game, or if you want you can decide to print on a file only a MovieClip instead of all the window.

To integrate it is very easy:
1) First of all download the class here!.
2) Put the directory 'com' and 'nl' inside you class folder or simply in the folder of your FLA.
3) Put the PHP file in your server directory, if you don't have a server install one with WAMP.

Now in your code write this wherever you need it:
import nl.stroep.utils.*;
var imageSaver:ImageSaver = new ImageSaver( "http://www.yoursite.com/save-my-image.php" );
imageSaver.save ( this, "filename.png" );


You can use it on a button and just magically an image will appear in the directory where you placed the PHP file! Emoticon
Enjoy it!


Write a comment

How to customize the SWF right click menu with AS3

March 8th, 2009 - Category: ActionScript 3, Flash
I personally don't like the context menu that appears when we right-click in our SWF, so I decided to create a class to change it with things that I like. Below you can see what I see now in my games:

It is all pretty easy, all you have to do is to create a class file AS inside your class directory and write something like this:
package {
 
import flash.events.EventDispatcher;
import flash.ui.ContextMenu;
import flash.ui.ContextMenuItem;
import flash.events.ContextMenuEvent;
import flash.net.navigateToURL;
import flash.net.URLRequest;
 
public dynamic class MyMenu extends EventDispatcher{	
	var myContextMenu:ContextMenu = new ContextMenu();
	var item1:ContextMenuItem = new ContextMenuItem("LorenzGames.Com");
	var item2:ContextMenuItem = new ContextMenuItem("Play More Games");
 
	public function MyMenu(cosa){		
    	myContextMenu.hideBuiltInItems();
		cosa.contextMenu = myContextMenu;		
   		item1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,function() { navigateToURL(new URLRequest("http://www.LorenzGames.com"), "_blank");});
		myContextMenu.customItems.push(item1);
		item2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,function() { navigateToURL(new URLRequest("http://www.LorenzGames.com"), "_blank");});
		myContextMenu.customItems.push(item2);		
	}
}
}

then you can load it in your Document Class writing:
var menu=new MyMenu(this);


Write a comment