Archive for the ‘ActionScript 3’ Category

Tutorial: Command Line Parameters in an AIR Application

Wednesday, August 20th, 2014

In this tutorial you will learn how to pass command line arguments to your Adobe AIR applications and how to retrieve those values from within your program. In order to demonstrate this, I'll be sharing a small program I wrote recently to assist in screencasting. The program simply displays a webcam feed in a window that gets its size via command line arguments that are passed in when the program starts. This allows for a simple picture-in-picture effect, and thus, I've named the program PiP. Let's get started. (more…)

AIRGamepad Example

Tuesday, August 19th, 2014

The recently released AIR 15 beta includes an updated AIRGamepad class that lets you use your mobile Android device as a controller for your desktop AIR applications and games. I spent a little bit of time messing around with it and created the demo shown below.

I've uploaded the project to github if you want to check it out. Note that it requires the gamepad.swc from the AIR 15 sdk (located in frameworks/libs/air).

File Loading Bug with Google Chrome (Flash Pepper API)

Thursday, July 24th, 2014

Apparently this has been an issue for a long while now, but I only came across it today. Google's custom Flash Pepper API has issues loading local files. I just wanted to throw this out there in case someone else runs into this issue and is at a loss (as I was).

Here's the deal: if you have a swf file that loads external files (images, other swfs, etc) and attempt to run it in Chrome on your local machine, the files may not load. Below are two screenshots showing this in action. Note that in Firefox, the image loads. In Chrome we just get the black swf background. Boo!

It is worth noting that this only happens when testing locally; everything works fine on a server. It seems that the Pepper API doesn't respect the global Flash Player settings for trusted locations. You can read more about the bug here.

Text Formatting (Italics, Bold) Bug and Solution in Flash Pro CC

Monday, July 7th, 2014

I recently worked on a project that required formatted text (italics) to be read in from a file and placed into a textfield that was using an embedded font. "No problem," I thought, "I can just use the htmlText attribute." Well, it turns out that isn't the case. Flash Pro CC seems to have trouble handling italics/bold when compared to Flash CS6. To demonstrate this, let's take a look at a very simple .fla file.
(more…)

Tutorial: High Score Table with Flash and PHP

Sunday, May 11th, 2014

In this tutorial we'll take a look at how to build your own high score system using Flash ActionScript 3.0 on the client side and PHP on the server side to handle database tasks. This is meant only as a starting point as we do not do much, if any, error checking or security checks on the data submitted to the database. I am not well-versed in PHP so if you are and notice some mistakes, feel free to point them out! (more…)

Crash Planet Released

Sunday, March 16th, 2014

I am happy to announce the release of Crash Planet! It's been a long road creating this game, but I am really pleased with the way it came out. I've always liked the classic NES style games and I think Crash Planet successfully blends that classic gameplay style with modern hooks such as medals/achievements. Check the game out on Newgrounds and Kongregate using the links below!

Crash Planet on NewGrounds

Crash Planet on Kongregate

Crash Planet Screenshot

Video Tutorial: Intro to Away3D

Sunday, June 9th, 2013

In this tutorial you will learn how to set up a basic, 3D scene using Away3D. You will load and display terrain, a skybox, an animated 3D model and add user controls for the character and the camera from a 3rd person perspective. Full source code is also available here. (more…)

Flash: Direct Memory Access via Native Extension

Sunday, April 28th, 2013

A couple weeks before the Flash Gaming Summit I found an interesting blog post from Colin Northway about managing texture memory in Starling applications. In this post he describes how he forces an error in ActionScript to receive an object's memory address which he then uses as a unique id. I thought this was a pretty cool trick and was discussing it with our engine developer at the office when we suddenly had a thought: if you can get the memory address of an object in ActionScript, what's to stop you from passing that address into native code and doing whatever you want with it? (more…)

Scout Survival Kit

Friday, February 1st, 2013

If you aren't using Adobe's Scout profiling tool yet, you should be. Scout is a fantastic tool for debugging your code and finding performance bottlenecks. You can get basic data by simply running Scout and then launching Flash content. However, for more in-depth profiling you must enable advanced telemetry in your swf (the actionscript stack is only available for AS3-based projects). To assist with this, I've put together a Scout Survival Kit that contains all the tools necessary to get you up and running.

The pack includes the Scout set up executable, this FlashDevelop plugin, this Scout enabler program and a helpful html readme document describing how to use the plugin. All of these items can be downloaded individually elsewhere, but I figured it made sense to put them all in one place. Click the image below to download the kit!

Airxbc Update

Monday, December 10th, 2012

Woohoo! I finally had time to sit down and update the Airxbc native extension for Windows! If you aren't familiar with the extension, it allows you to accept input via an Xbox 360 controller for your Adobe AIR games.

With this latest release, my major goal was to wrap up the controller definition in a real class. If you'll recall, the original version simply gave back a generic ActionScript object. The new version returns a com.rhuno.X360Gamepad object that wraps up a lot of the controller functionality nicely, exposes some helpful methods and contains some constants for controller buttons. New functionality includes the ability to check if a button was just released and also to get the trigger values as a percentage or as a value. Below is an example of how to use the new extension.

import com.rhuno.Airxbc;
import com.rhuno.X360Gamepad;

var ext:Airxbc = new Airxbc();
var gpad:X360Gamepad;

// pollGamePad now returns an X360Gamepad object
gpad = ext.pollGamePad();

// various ways of checking for button presses
gpad.isXButtonDown();
gpad.isButtonDown(X360Gamepad.GAMEPAD_X);

// ways of checking for button releases
gpad.wasLeftShoulderReleased();
gpad.wasButtonReleased(X360Gamepad.GAMEPAD_LEFT_SHOULDER);

// get trigger value
var value:int = gpad.leftTrigger;

// get trigger percentage (0 thru 1)
var percent:Number = gpad.leftTriggerAsPercent;

// NOTE: you still use the extension to set vibration
ext.setVibration(30000, 30000);

You can download an updated example project and the new ANE below. Enjoy!

NOTE: This post is out of date, for latest on Airxbc, go here!

Airxbc 0.9 example project
Airxbc 0.9 ANE

Subscribe to RSS feed FGS5 Badge