Tuesday, March 20, 2007

Gradient Masks in Flash 8

Make two movieclips:

1. The "maskee" which is just a regular MovieClip containing a picture.
2. The "mask" which is also a movieClip but contains some blends that fade to a solid color to clear

maskee.cacheAsBitmap=true
mask.cacheAsBitmap=true
mask.setMask(maskee)

Monday, March 19, 2007

MovieClip Depth Property

mc.getDepth();

Remember the parens

Saturday, March 17, 2007

Call a JavaScript function from Flash

This Flash function calls a Javascript and sends a string to be displayed in an alert window.

import flash.external.*;
btn.onPress = function() {
ExternalInterface.call("playmovie", "hi Matt");
};


Put this Javascript function in the html file
function playmovie(theMessage){   
alert(theMessage)
}

Friday, March 09, 2007

sIFR

This tool uses css, flash, and Javascript to embed non-web fonts in a browser.

http://www.mikeindustries.com/sifr/

SlideShowPro

http://www.slideshowpro.net/

String Search and Replace


String.prototype.replace = function(str, rep) {
return this.split(str).join(rep);
};


//use it like this
var myStr:String = "Hello earth!"
trace(myStr.replace("earth","world")

Timer Countdown


displayTime = 10;
countDown = function () {
displayTime--;
if (displayTime == 0) {
clearInterval(timer);
}
};
timer = setInterval(countDown, 1000);

Change MovieClip Color


colorTo = function (theHex, theMc) {
colorful = new Color(theMc);
colorful.setRGB(theHex);
};
colorTo(0x00FFFF, theMc);

Wednesday, March 07, 2007

Simple Tween Equation

this._y += (newPos - this._y) * .5;