warning: Creating default object from empty value in /home/mlange/codes.widged.com/modules/taxonomy/taxonomy.pages.inc on line 34.

AS3

States in components inheriting from a custom class

A standard recommendation is to separate view from controlling code. A good way to achieve this in Flex is to have a mxml class that contains nothing but view and to move all the controlling code to a superclass.

LoginScreen.mxml


<p:LoginScreenClass xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:p="path.to.LoginScreenClass.*" />

LoginScreenClass.as


package path.to.LoginScreenClass
{
import mx.containers.VBox;
public class LoginPanelClass extends VBox {}
}

Cutouts and Blends

Exploration of Blend effects and how they apply on a cutout masking an image.

This is a strictly actionscript project. Control panels come from the minimalComps library by Keith Peters.



Demo | Source

Terrain Editor

Something I had wanted to figure out. The LandscapeMapEditor on wondefl provided all that was required to get started. The original code was under a MIT license and that license is therefore carried on.

This is a strictly actionscript project. Label and InputText controls come from the minimalComps library by Keith Peters.

You are missing some Flash content that should appear here! Perhaps your browser cannot display it, or maybe it did not initialize correctly.

NOTE. It looks like I changed the controls for the diameter of the circle. Use the up arrow and down arrow to increase/decrease the radius of the circle.

Demo | Source

Terrain generation in Flash

Background Information

Generating Random Fractal Terrain by Paul Martz. A good overview of the theory behind terrain generation (midpoint displacement and other techniques).

Actionscript 3

An extensive list of links on terrain rendering in Flash by Bruce Jawn

Impressive ones at wonderfl

Code found on wondefl can be executed within Flex Builder. Create a project File > New ... > Actionscript Project. Make sure that you have the Flex SDK 3.5 installed and that this project makes use of it (Project > Properties > Actionscript Compilers > Flex SDK Version). If Base64Decoder is required for the project to run, download the SDK source for 3.5. Locate mx.utils.Base64Decoder. In your project, create a folder mx/utils/ and copy there the class Base64Decoder. Delete the line that define the resource metadata as this requires the Flex framework (not included in an Actionscript project). Run your project,

DiscoGrid, Pure Actionscript 3 project in FlexBuilder

You are missing some Flash content that should appear here! Perhaps your browser cannot display it, or maybe it did not initialize correctly.

Demo | Source

Sprite Animation, update. Movement along a line defined at runtime

You are missing some Flash content that should appear here! Perhaps your browser cannot display it, or maybe it did not initialize correctly.

Demo | Source

Avoiding sandbox violation in AIR when using DragManager on locally stored images

For a mini AIR project I had some issue with sandbox security violation warnings that kept coming up any time I was using DragManager on images for which the source had been set to some locally held images (within the User Directory).

To bypass these warning, it is required to load the bytes into a bitmap and to get the image component display the bitmap. Code below.

Simplistic map maker

Expand on the tileset example to provide a map editor

(The download functionality requires flash player 10)

You are missing some Flash content that should appear here! Perhaps your browser cannot display it, or maybe it did not initialize correctly.

Demo | Source

Free to re-use tilesets can be found on the Reiners website. As per Reiners Readme Page "All the graphics and meshes are freeware. Even for commercial Games. I just want my name in the Credits in the commercial case: Reiner "Tiles" Prokein. You can modify my graphics in every needed way to fit it to your needs: size, colour, fileformat, etc., you can reuse the textures ... . "

Further resources are listed on the widged wiki, under game content and game tiles. (Note however that these links were collected 2-5 years ago, some may be broken)

Mini tileset/chipset parser in Flex.

Tile manipulation via a SpriteSheet (grid that defines the location of the tiles) and TileSet (combination of grid and image data) abstraction


/**
* Get the bitmap for a tile at a given [row,column]
* @param rowId row index (starts at 0)
* @param columnId column index (starts at 0)
*/
public function getTileBitmap(rowId:int,colId:int):Bitmap
{
var bitmapData:BitmapData = new BitmapData(_sheet.tileWidth,_sheet.tileHeight, false, 0xFFFFFF);
bitmapData.copyPixels(_bitmap.bitmapData, _sheet.getTileRectangle(rowId, colId), new Point(0, 0));
return new Bitmap(bitmapData);
}

You are missing some Flash content that should appear here! Perhaps your browser cannot display it, or maybe it did not initialize correctly.

Demo | Source

Syndicate content
Powered by Drupal, an open source content management system