Hey kids. :]
At 7/19/09 01:39 PM, turtleco wrote:
I bet K-guare had to use all of his action script talent to make it.
Yeah, really.
I finally have the bios finished, the biggest chunk of time.
Alright so, for the bios,
each one of you has your own array of photos
that you submitted in the forum. Some of you didn't do that,
so I took at least 1 screenshot of something else you submitted
so you had at least something.
It took me really long to organize all the code, but now it's set up so
that it's very easy to add in more pictures for each of you,
so if you have any specific pictures you would like me to
add in there for you to appear on your bio page, just
send it to me and I'll add it in in a flash. :D
Heh, flash. Haha.
I've been gone.
Family stuff, relationships, PO3 coding (Kart-Man and I are totally dominating. :D,)
and a whole ton of other useless excuses.
I've been doing this for the past couple hours, and I'm so
extremely excited that it's working now...
How's my driving?
/* -- USERNAMES & IDS - CHART -- */
///////////////////////////////////
// K-Guare ---------------| kg - */
// MichaelHurst ----------| mh - */
// turtleco --------------| tc - */
// Deathcon7 -------------| dc - */
// Magical-Zorse ---------| mz - */
// RobertJ ---------------| rj - */
// TehSlapHappy ----------| th - */
// Fiziks ----------------| fz - */
// Ironosaur -------------| ir - */
// NOBODY ----------------| XX - */
const WIDTH_FIT:int = 365;
const HEIGHT_FIT:int = 240;
var curAID:String = "kg";
var oldAID:String;
var thePic:Number = randArtistPic();
var oldPic:Number = thePic;
var artistPics:Object = new Object();
var hasNoPictures:Boolean = false;
back.addEventListener(MouseEvent.MOUSE_DOWN, toMenuListener);
names.bioN.addEventListener(MouseEvent.MOUSE_UP, nextBio);
names.bioP.addEventListener(MouseEvent.MOUSE_UP, prevBio);
holderOverlay.nextPic.addEventListener(MouseEvent.MOUSE_UP, nextBioPic);
holderOverlay.prevPic.addEventListener(MouseEvent.MOUSE_UP, prevBioPic);
function nextBio(e:MouseEvent):void {
if (names.totalFrames == names.currentFrame) {
names.gotoAndStop(1);
} else {
names.nextFrame();
}
addEventListener(Event.ENTER_FRAME, checkNameChange);
function checkNameChange(e:Event):void {
if (curAID != names.curName) {
oldAID = curAID;
curAID = names.curName;
removeEventListener(Event.ENTER_FRAME, checkNameChange);
oldPic = thePic;
thePic = randArtistPic();
hasNoPictures = false;
populateArtistArray();
fadeTo("next", oldAID);
}
}
}
function nextBioPic(e:MouseEvent):void {
fadeTo("next");
}
function prevBio(e:MouseEvent):void {
if (names.currentFrame == 1) {
names.gotoAndStop(names.framesLoaded);
} else {
names.prevFrame();
}
addEventListener(Event.ENTER_FRAME, checkNameChange);
function checkNameChange(e:Event):void {
if (curAID != names.curName) {
oldAID = curAID;
curAID = names.curName;
removeEventListener(Event.ENTER_FRAME, checkNameChange);
oldPic = thePic;
thePic = randArtistPic();
hasNoPictures = false;
populateArtistArray();
fadeTo("prev", oldAID);
}
}
}
function prevBioPic(e:MouseEvent):void {
fadeTo("prev");
}
// ARTIST PICTURE HOLDER CRAP
populateArtistArray();
picHolder.addChild(artistPics[curAID][thePic]);
artistPics[curAID][thePic].x = artistPics[curAID][thePic].width/2 * -1;
artistPics[curAID][thePic].y = artistPics[curAID][thePic].height/2 * -1;
// This counts how many pictures there are for a given AID
function countPicsBy(artist:String):Number {
var b:int = 1;
try {
while (getDefinitionByName(artist+b)) b++;
} catch (e:ReferenceError) {
return b - 1;
}
return 0;
}
// If the current AID doesn't have anything in his/her array, populate it!
function populateArtistArray():void {
var uppercaseID:String = curAID.toUpperCase();
if (!artistPics[curAID]) {
artistPics[curAID] = new Array(countPicsBy(uppercaseID));
}
for (var i:Number = 0; i<countPicsBy(uppercaseID); i++) {
var classToConstruct:Class = Class(getDefinitionByName(uppercaseID+(i+1)));
artistPics[curAID][i] = new Bitmap(new classToConstruct(0,0),"auto",true);
artistPics[curAID][i].name = curAID+(i+1);
var bit:BitmapData = artistPics[curAID][i].bitmapData;
// Adjust the size to fit inside the screen.
if (artistPics[curAID][i].width > WIDTH_FIT) {
artistPics[curAID][i].width = WIDTH_FIT;
artistPics[curAID][i].height = bit.height * WIDTH_FIT / bit.width;
}
if (artistPics[curAID][i].height > HEIGHT_FIT) {
artistPics[curAID][i].height = HEIGHT_FIT;
artistPics[curAID][i].width = bit.width * HEIGHT_FIT / bit.height;
}
}
}
function randArtistPic():Number {
var numPics:Number = countPicsBy(curAID.toUpperCase());
return Math.floor(Math.random() * numPics);
}
// Fades to the specified number picture of the current curAID
function fadeTo(which:String, lastAID:String = null):void {
var goNext:Boolean = (which == "next") ? true : false;
var thisFadeIn:BiosFadeIn = new BiosFadeIn();
var opAID:String = (!lastAID) ? curAID : lastAID;
var numPics:Number = countPicsBy(curAID.toUpperCase());
var num:Number;
var picToGet:Number = new Number();
var prevPic:Number = new Number();
if (goNext) {
num = thePic+1;
picToGet = (num>=numPics) ? 0 : num;
prevPic = (num-1 < 0) ? numPics : num-1;
} else {
picToGet = (thePic-1<0) ? numPics-1 : thePic-1;
prevPic = thePic;
}
if(lastAID) prevPic = oldPic;
thePic = picToGet;
holderOverlay.addChild(thisFadeIn);
thisFadeIn.addEventListener(Event.ENTER_FRAME, checkIfHalfDone);
function checkIfHalfDone(e:Event):void {
if (e.target.currentFrame == Math.ceil(e.target.framesLoaded/2)) {
picHolder.removeChild(artistPics[opAID][prevPic]);
trace(curAID + " - " + picToGet);
picHolder.addChild(artistPics[curAID][picToGet]);
artistPics[curAID][picToGet].x = artistPics[curAID][picToGet].width/2*-1;
artistPics[curAID][picToGet].y = artistPics[curAID][picToGet].height/2*-1;
}
if (e.target.currentFrame == e.target.framesLoaded) {
thisFadeIn.removeEventListener(Event.ENTER_FRAME, checkIfHalfDone);
thisFadeIn.stop();
holderOverlay.removeChild(DisplayObject(e.target));
}
}
}