Featured FLA
» Author: Bugra Ozden
» Title: Skatalog v9 - product catalog
» Description: Create your product catalog easly and publish on your website or Create your image gallery, documents list, portfolio. Fully XML Driven
» More by Bugra Ozden
Featured Site
» Posted in the Flash Kit Links section
» Title: Creative DW Image Show PRO
» Description: Creative DW Image Show PRO is a Dreamweaver extension which enables the user to create multimedia presentations. It combines the features of the popular Creative DW Image Show with the ability to add professional text effects to slides (similar to After Effects). The product is very customizable: the user can choose the duration of the transition effects, the slide motion start and end position, zoom and panning type for both images and texts.
function Human (name,sex) {
this.name = name;
this.sex = sex;
this.fReferers();
this.head = {hairColour : 0x663399, bigNose : true};
this.body = {};
//introducing class methods
this.fCreateArms(false,true);
this.fCreateLegs(true,true);
}
Human.prototype.fCreateArms = function (leftArmWaving,rightArmWaving) {
this.arms = {};
//short cut
var sc = this.arms;
sc.armLeft = { bWaving:leftArmWaving }
sc.armRight = { bWaving:rightArmWaving }
}
Human.prototype.fReferers = function () {
if(this.sex == "male") {
this.referers = {n1 : "He", n2 : "His"};
}
else{
this.referers = {n1 : "She", n2 : "Her"};
}
}
function fWaveArms(obj,bWaving){
for(var i in obj.arms){
obj.arms[i].bWaving = bWaving;
}
}
function fTraceRightArmWaving(obj) {
var rightArmWaving = (obj.arms.armRight.bWaving) ? " is " : " isn't ";
trace(obj.name+ " is a "+obj.sex+". "+ obj.referers.n1 + rightArmWaving+"waving with " + obj.referers.n2.toLowerCase() + " right hand.")
}
function fInitArmy () {
var arrMales = ["Nick","Yan","Pete","Andrew","Stelios","Niklas"];
var arrFemales = ["Camy","Jessica","Anna","Nicole","Jane","Helen"];
var maxLoop = arrMales.length;
for(var i=0;i<maxLoop;i++){
this[arrMales[i]] = new Human (arrMales[i],"male");
this[arrFemales[i]] = new Human (arrFemales[i],"female");
}
fWhosWaving (arrMales);
fWhosWaving (arrFemales);
}
function fWhosWaving (arrTroop) {
var maxLoop = arrTroop.length;
for(var i=0;i<maxLoop;i++){
fTraceRightArmWaving(this[arrTroop[i]]);
}
}
fInitArmy ();
If you found this useful please let me know as I'll write another 'chapter' demonstrating how to use these principals when creating components in Flash MX.
I am a Flash Developer with 3 years commercial experience programming database-driven games and applications. I am currently working on a contract job developing e-learning software for UK schools.