Category Archives: AS3

Alef is out!

Hey there,

It has been a long time since I wrote my first game, Kinessia, with the Citrus Engine (and start contributing), one and a half year. Less than one year ago, I made an other one, Tribus, using a Citrus Engine’s port in Objective-C. That was my first project in Objective-C so the source code of the port shall not be very clean, that’s why I’ve never released it officially.

We all know the problem making a framework / library and never use in real context project. That’s why I started my carreer as a freelancer 4 months ago, to be able to make applications / games for companies and show what can be done with the Citrus Engine. And now I’m proud to add a new reference to the engine: Alef.

Continue reading Alef is out!

AIR and iOS app options (cutsom url scheme, hidden)

Each day we discover new options and features giving the developer life more exciting!

Today I’m sharing some options for iOS development. Let say you have a main application including links to several games. You don’t want to include all this games into the main application because there are more like independant mini-games, or you don’t want to clean everything as it should when you leave your game (the lazy way), or there are several developers involved in this different games and they don’t use the same technology!

Anyway, you want to create a main application able to navigate to an other one. In other terms: communicate with other apps (Apple references check Communicating with Other Apps part and below).

Continue reading AIR and iOS app options (cutsom url scheme, hidden)

Android 4.2.2. resolve problem with AIR mobile deployment

Google has recently pushed a new Android version: 4.2.2. Concerning the new features, this update brings about a new security feature in regards to USB debugging: now there is a gatekeeper on your phone! You will have to accept the RSA key before being able to deploy on your device. More information concerning this update there.

If you have made this update on your device, you won’t be able to deploy your application, even if you’ve accepted the RSA key. Your IDE won’t success to connect to the device and push on it.
When I tried to resolve the problem, it quickly appears it wasn’t related to the IDE but directly from the AIR SDK. Then I tried to deploy on my tablet with a Unity project: same problem. Using Unity, you work directly with the Android SDK. I just needed to download its latest version and replace the previous one, and it works!

Concerning AIR, we also use the Android SDK but not with its original structure. You need to replace some files on this folder: YourSDK/lib/android/bin. Replace those files: aapt, adb and dx.jar with files coming from the latest Android SDK: sdk/platform-tools aapt, adb and its lib folder with the dx.jar file. Using Windows you will also need to replace the dll files.

That was easy! I hope Adobe will quickly deploy an AIR SDK update for everyone.

Take photo with AIR on iOS

Hey guys,

Recently, I’ve worked on a mobile project and camera use drives me crazy about performances. On iOS, after taking a photo and validate it, it freezes the application during one minute to be able to encode it.
I’ve made lots of tests with several libraries, using Alchemy ones, and finally the fastest way (less than 5 seconds) is to use the new BitmapData encode method, available since Flash Player 11.3 and AIR 3.3.

Here is the code (lots of code come from this excellent post) :

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
if (CameraUI.isSupported) {
	viewsAC.addItem({label:"Take Photo", icon:cameraIcon});
	myCam = new CameraUI();
	myCam.addEventListener(MediaEvent.COMPLETE, onCameraComplete);
}
 
protected function onCameraComplete(evt:MediaEvent):void
{
	sqlStatement = new SQLStatement();
	sqlStatement.sqlConnection = model2.connection;
	sqlStatement.text =
		"INSERT INTO albumItems (album, photoFile, dateAdded) " +
		"VALUES (:album, :photoFile, :dateAdded)";
	sqlStatement.parameters[":album"] = model2.selectedAlbum;
 
	var mediaPromise:MediaPromise = evt.data;
	if (mediaPromise.file == null) {
 
		// For iOS we need to load with a Loader first
		_loader = new Loader();
		_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageloader_complete, false, 0, true);
		_loader.loadFilePromise(mediaPromise);
 
		return;
	} else {
 
		// Android & BlackBerry
		registerPhoto(mediaPromise.file.url)
	}
}
 
private function imageloader_complete(event:Event):void {
 
	_loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, imageloader_complete);
 
	var loaderInfo:LoaderInfo = event.target as LoaderInfo;
 
	if (CameraRoll.supportsAddBitmapData) {
 
		var bitmapData:BitmapData = new BitmapData(loaderInfo.width, loaderInfo.height);
		bitmapData.draw(loaderInfo.loader);
		var file:File = File.applicationStorageDirectory.resolvePath("image" + new Date().time + ".jpg");
		var stream:FileStream = new FileStream()
		stream.open(file, FileMode.WRITE);
		var bytes:ByteArray = bitmapData.encode(bitmapData.rect, new flash.display.JPEGEncoderOptions());
		stream.writeBytes(bytes, 0, bytes.bytesAvailable);
		stream.close();
 
	}
	registerPhoto(file.url)
 
}
 
private function registerPhoto(url:String):void {
 
	sqlStatement.parameters[":photoFile"] = url;
 
	sqlStatement.parameters[":dateAdded"] = new Date();
	sqlStatement.execute();
 
	viewsList.selectedIndex = -1;
}

Citrus Engine V3 and a new website!

Hey there,

I’m glad to announce the V3 release and a new website for the Citrus Engine! It has been a long and hard work. Most of the new tutorials and news will be displayed on this new website. Don’t know how I will manage this blog on Citrus Engine subject due to the new website, I will certainly replicate some contents.

Anyway I let you explore the new website 🙂 Don’t hesitate to give some feedback.

Playing with Cadet Editor 3D and AwayPhysics

The 3D part is a bit in stand-by this last weeks on the Citrus Engine, because I’m polishing the engine for the V3 which should be out this week!

I’ve never clearly introduced AwayPhysics in the Citrus Engine, so it’s the day! The idea is to have a similar pre-built platformer objects that we already have with Box2D and Nape but with AwayPhysics this time for 3D stuff! This work and Away3D support will evolve during the V3.

Now that 3D views and physics are supported, it’s time to give a look on which tool we can use as a 3D game Level Editor. At first, I thought to Prefab. This is the best tool to create a scene with Away3D, importing assets, add lights… But too complex for a simple level design, I mean : hey the Citrus Engine is not a concurrent to Unity3D (which I started to learn thanks to this awesome tutorial) 😀 Its 3D physics part is just here to create basic 3D game / puzzle. Also the level editor has to support object creation (physics object), this isn’t obvious with Prefab.
Then I gave a look to Cadet Editor, the 3D editor is very easy to handle. You can create quickly sphere, cube and plane objects, add lights… That’s the right tool to see what can be done!

Continue reading Playing with Cadet Editor 3D and AwayPhysics

Create combination of physics objects in Citrus Engine

Some days ago, I said that November will be an awesome month for the Citrus Engine. So what is coming?

We’re the 2nd, November is already here and something huge is already happened to the CE : a tutorial on gotoandlearn made by Lee Brimelow, an Adobe Game Developer Evangelist! Definitely, an excellent tutorial to get start with the Citrus Engine. There’ll be other tutorials later, a new website and the forum’ll move on Starling website. Most of the future game will use Starling so that’s a good move! We’re not forgetting the 3D part, don’t worry 😉

Everything should be ready for the next Adobe Game Jam in Chicago. So that’s the plan. Now let’s go for a small tutorial.

Continue reading Create combination of physics objects in Citrus Engine

Create a game like Tiny Wings

Tiny Wings is really a cute game and very fun to play thanks to physics content! It uses Box2D. If you’ve never played the game, give it a quick look :

Generate those type of hills with a physics engine is complicated for a novice. You’ll find cool tutorials on Emanuele Feronato’s website using Box2D and an other on Lorenzo Nuvoletta’s website using Nape.

Someone asks me if it was possible to create this type of game with the Citrus Engine, absolutely! So let’s go for a quick tutorial.

Continue reading Create a game like Tiny Wings

Moved from Box2D Alchemy to Box2D AS3

In the Citrus Engine, people knows that I’m very attached to the Box2D Alchemy version. Thanks to Alchemy we should have better performance than the pure AS3 version. Also this Alchemy version had some cool features mostly on the way you could manage collision : you don’t use a gobal contact listener like in any Box2D version, you use something very closer to AS3 event management. Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
override protected function createFixture():void
{
	super.createFixture();
 
	_fixture.m_reportBeginContact = true;
	_fixture.addEventListener(ContactEvent.BEGIN_CONTACT, handleBeginContact);
}
 
protected function handleBeginContact(e:ContactEvent):void
{
	_contact = e.other.GetBody().GetUserData() as Box2DPhysicsObject;
	if (!e.other.IsSensor())
		explode();
}

I love this way. Anyway, many users ask me to change it… let’s go!

Continue reading Moved from Box2D Alchemy to Box2D AS3