# Converting simple AS1 to AS3

**URL:** <https://forum.kirupa.com/t/converting-simple-as1-to-as3/322314>\
**Category:** flash\
**Created:** [May 17, 2011, 9:01pm UTC](https://forum.kirupa.com/t/converting-simple-as1-to-as3/322314 "2011-05-17T21:01:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sirlambert](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@sirlambert](https://forum.kirupa.com/u/sirlambert)\
**Post date:** [May 17, 2011, 9:01pm UTC](https://forum.kirupa.com/t/converting-simple-as1-to-as3/322314/1 "2011-05-17T21:01:08Z")

</div>

Hello, this is my first post. Thanks very much for this forum and for any answers in advance. I’ve had a search around and found that its not possible to automatically convert AS1 to AS3, so I was wondering if I could get some help converting the following code. This is the last piece of the puzzle in my flash game - then its complete.

The code is designed to load the high scores table which is based in XML.  
I’d really appreciate some help or advice.

Thanks again - Tom

```auto

	rootPath = this;
	
	// -----
	// ----- function to load PHP content in and process results
	// -----
	function loadPHP (filename, nextFunction) {
		trace("loadPHP");
		contentPHP = new LoadVars ();
		contentPHP.ignoreWhite = true;
		contentPHP.onLoad = function (success) {
			if (success) {
				delete this.onLoad;
				onEnterFrame = function () {
					if ((contentPHP.getBytesLoaded() == contentPHP.getBytesTotal()) && (contentPHP.loaded)) {
						delete this.onEnterFrame;
						PHPLoaded(nextFunction);
					}
				}
			} else {
				errorFunction();
			}
		}
		//contentPHP.ignoreWhite = true;
		contentPHP.load(filename);
	}
	// ----- function to process the results
	function PHPLoaded (nextFunction) {
		trace("PHPLoaded");
		for(prop in contentPHP) {
			_root[prop] = contentPHP[prop];
		}
		// ----- do next function
		nextFunction();
	}
	
	// ----- function to load XML content in
	function loadXML (filename, nextFunction) {
		// ----- load in XML
		trace("loadXML");
		contentXML = new XML ();
		contentXML.onLoad = function (success) {
			if (success) {
				delete this.onLoad;
				onEnterFrame = function () {
					if ((contentXML.getBytesLoaded() == contentXML.getBytesTotal()) && (contentXML.loaded)) {
						delete this.onEnterFrame;
						XMLLoaded(nextFunction);
					}
				}
			} else {
				errorFunction();
			}
		}
		contentXML.ignoreWhite = true;
		contentXML.load(filename);
	}
	// ----- function to process the XML
	function XMLLoaded (nextFunction) {
		trace("XMLLoaded");
		// ----- do next function
		nextFunction();
	}

```
