Tuesday, November 17, 2009

PRELOADER CODE:

//Import the required assets
import flash.display.*;
//Stop the playhead while loading occurs
this.stop();

//Create a listener to call the loading function as the movie loads
this.loaderInfo.addEventListener (ProgressEvent.PROGRESS, PL_LOADING);

/*This is the main function, basically it grabs the total and loaded bytes,
calculates a percentage, and displays it by stretching the bar and adjusting
the textfield display. If your bar/textbox instancenames are NOT lbar/lpc,
you'll need to adjust this code to match your instance names*/

function PL_LOADING(event:ProgressEvent):void {
var pcent:Number=event.bytesLoaded/event.bytesTotal*100;

//Stretch the bar
lbar.scaleX=pcent/100;
//Display the % loaded in textfield
lpc.text=int(pcent)+"%";
//If the movie is fully loaded, kick to the next frame on the main timeline
//You may wish to change the
gotoAndStop(2) to a gotoAndPlay(2)

if(pcent==100){
this.gotoAndStop(2);
}
}

Tuesday, November 3, 2009

Addition to Your Index Pages:

Please post a link from your index page to your Net Art History Blog by today, Tuesday, November 3.
(This is a POP quiz)

UNLOAD that EXTERNAL FILE

newBtnInstance2.addEventListener(MouseEvent.CLICK, mouseClickHandlerY);
function mouseClickHandlerY(myevent5:MouseEvent):void {
removeChild(myLoader1);
}

LOADING External FLASH Files

var myLoader1:Loader=new Loader ();
newBtnInstance1.addEventListener(MouseEvent.CLICK, mouseClickHandlerZ);
function mouseClickHandlerZ(myevent1:MouseEvent):void {
var myURL1:URLRequest=new URLRequest("additionalMovieFile.swf");
myLoader1.load(myURL1);
addChild(myLoader1);
}

CODE to LINK from FLASH Project to an External URL

buttonInstanceName.addEventListener(MouseEvent.CLICK, mouseClickHandler1);
function mouseClickHandler1(event:MouseEvent):void {
var pixelcolaURL:URLRequest = new
URLRequest("http://pixelcola.net");
navigateToURL(pixelcolaURL); }