Hi Flasher’s

Much of the time I was away, but soon I am back and I will make some useful AS3.0 Classes and tutorials for creating rich flash and desktop applications.
Some of the tutorials are:  How insert photoshop layout in flash and make website, How create Flash Classes, How create your own framework for faster developing.

A few months ago I made Accordion Class for Flash (AS3.0) which is totally custom. I will upload the class when I finish tutorial and documentation for the class.

See ya soon flashers.

Mirko Fisic

How to load external XML in Flash?

If you want to load external XML file in flash, first you will need to import certain flash Classes.

Let’s see which kind of flash classes we need:

– URLLoader Class — With this class we can download data from url as Text or binary data or URL-encoded variables. Now in this tutorial we will load our XML file with this Class.

– URLRequest Class — This class is also important in this process because this class will initiate our URLLoader Class to start load file.

– Event Class — Event class will notify us when the URLLoader is finished with loading or if we have the error in loading process.

– XML Class — XML class we dont need to import because this is a TOP Level class such as Array,Number,Boolean,Object.

TIP: See more detail in flash help about this Classes for better understanding!!!

Ok Let’s start with the coding:

//import necessary classes
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;

var _xml:XML;
var xmlLoader:URLLoader = new URLLoader();
var xmlURL:URLRequest = new URLRequest(“sources/xml/datas.xml”);

//now I will add event listener to URLLoader Class, first parameter in addEventListener function indicate event type, second parameter refer on function which will handle our “complete” event
xmlLoader.addEventListener(Event.COMPLETE, _completeXML);

//event handler will be called when URLLoader finished loading process.
function _completeXML(event:Event):void {

//now I will forward data from URLLoader class to XML Class
//event.target is class what is dispatch “complete” event, in our example that is URLLoader Class
_xml = new XML(event.target.data);
_xml.ignoreWhitespace = true; //igore white space in xml
_xml.ignoreComments = true; //ignore comments in xml

That is that external XML file is now loaded in flash and we can now start to get data from XML.

You can download source file here with previous tutorial(How to create Document Class).

TIP: See more detail in flash help about this Classes for better understanding!!!

How create Document Class?

In a few steps I will show you how to create Document Class(MainClass) for your flash project.

First off I will create new flash document with a name _root.fla .

Now I will create my package folders in which I will add my document class named Application.as .

It is very important that the class must be extended like a MovieClip. When we extend our class like MovieClip that means that our Application.as Class is now sub class of the MovieClip Class and this means that the class inherited all properties and functions from MovieClip Class.

Application.as code:

package com.myname {

import flash.display.MovieClip;

public class Application extends MovieClip {

public function Application() {
trace(“Root of our Application”);


Now we need insert path of Application.as Class inside of document properties in Document Class Field:com.myname.Application

Now when you test your _root.fla you will see in output this message : Root of our Application
That is that now you are ready to build your application next.