Home | Flash AS3 Tutorials | Flash Animation Tutorials | Store

Make a Very Basic Flash ActionScript Website Tutorial

This Flash tutorial series show how to make a simple and basic Flash web site with ActionScript 3. The first Flash tutorial shows how to make a very basic Flash web site with ActionScript 3. Although it is a very basic Flash web site, it has almost all the basic features.

Please update flash player to view this Flash ActionScript tutorial!

Flash Tutorial Content:

Making a Flash ActionScript web site is very easy and fun. In order that users can maintain the website without any knowledge of Flash, this is better to use external text files for the web contents.

The first Flash Movie of this tutorial is shown as above. You may play around to see how it works.

Flash ActionScript Codes:

//Create a new loader to load the text file
var myURLLoader = new URLLoader();

//Specify the data format
myURLLoader.dataFormat = URLLoaderDataFormat.TEXT;

// Call function homePage when Flash Movie loads
homePage(null);

//Listen to when the loading COMPLETE
myURLLoader.addEventListener(Event.COMPLETE, loadTextFile);

 

function loadTextFile(evt:Event) {

//Already set in the Parameters window
//content_txt.wordWrap = true;

//Load the text file to TextArea
//replace double empty line with a single empty line
content_txt.text = evt.target.data.replace(/\r/g,"");

}

 

///////////////////////////////////////////
////////// Buttons and Functions //////////
//////////////////////////////////////////

//Add event listener to the Home button
home_btn.addEventListener(MouseEvent.CLICK, homePage);

//Add event listener to the About Us button
aboutUs_btn.addEventListener(MouseEvent.CLICK, aboutUs);

//Add event listener to the Contact Us button
contactUs_btn.addEventListener(MouseEvent.CLICK, contactUs);

 

function homePage(evt:MouseEvent):void {

//Load the text file (home.txt)
myURLLoader.load(new URLRequest("home.txt"));

}

 

function aboutUs(evt:MouseEvent):void {

//Load the text file (about-us.txt)
myURLLoader.load(new URLRequest("about-us.txt"));

}

 

function contactUs(evt:MouseEvent):void {

//Load the text file (contact-us.txt)
myURLLoader.load(new URLRequest("contact-us.txt"));

}

Download Flash Source File:

Flash Source File Simple-Website-1.fla

External Text Files (Webpages)

home.txt

about-us.txt

contact-us.txt

Remarks:

This Flash ActionScript tutorial shows how to make a very simple Flash website. You should notice that the format of text is lack of control. In the next Flash ActionScript tutorial, we will show how to use a stylesheet to control the text format.