Archive for May, 2008

22May

Flash Variables from an HTML Page

No comments

Just realized in Actionscript 3 that a parameter of FlashVars can be used to feed variables to our Flash movie.
<param name=”FlashVars” value=”variableName=variableValue” />

a2a_linkname=”Flash Variables from an HTML Page”;
a2a_linkurl=”http://manewc.com/2008/05/22/flash-variables-from-an-html-page/”;
a2a_color_main=”D7E5ED”;a2a_color_border=”AECADB”;a2a_color_link_text=”333333″;a2a_color_link_text_hover=”333333″;

Categories: Actionscript 3
21May

Array.map

No comments

This was a lifesaver for me. Array.map will run a function on every item of an array and construct a new array based on what is returned from the function call. I don’t have a demo, but this is from Adobe:

package {
import flash.display.Sprite;
public class Array_map extends Sprite [...]

Categories: Actionscript 3
20May

Display Hand Cursor On MouseOver Of Sprite/MovieClip

2 comments so far

I have been using MovieClips and Sprites that have MouseEvents bound to the objects. My issue was the mouse cursor would not change to a hand when rolled over the object. Fortunately there is a quick fix for this, you can mouse over the circle below for a demonstration.


Here is the [...]

Categories: Actionscript 3
19May

BitmapData Noise

No comments

Add some BitmapData noise to your Bitmap.

package
{
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.BitmapDataChannel;

public class BitmapDataNoise extends Sprite
{
var bmd:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight);

public function BitmapDataNoise()
{
var noiserate:int = int(Math.random() * int.MAX_VALUE);
bmd.noise(noiserate, 0, 0xFF, BitmapDataChannel.RED, false);

var bitmap:Bitmap = new Bitmap(bmd);
addChild(bitmap);
}
}
}

a2a_linkname=”BitmapData Noise”;
a2a_linkurl=”http://manewc.com/2008/05/19/bitmapdata-noise/”;
a2a_color_main=”D7E5ED”;a2a_color_border=”AECADB”;a2a_color_link_text=”333333″;a2a_color_link_text_hover=”333333″;
[...]

16May

Preloading Multiple Images with Actionscript

6 comments so far

Please view my updated code
One of my new projects involves a lot of imagery so I decided to write a class that I could send it an array of images and preload them with a loading bar. The code below doesn’t have a loading bar, but if you trace out the code you can see [...]