AS2 to AS3 conversion

Commenta 4th July , 2009
Very new to AS3. I built an application using AS2 within Flash MX in 2003. Would like to convert it to AS3 using Flex.

I am receiving 2 main errors: semicolon placement and " the public attribute can only be used inside a package"

Here are a few sets of code:

Set 1 receives the "1114: The public attribute can only be used inside a package" error. Line 3 and 5 are the problems:

1 //todaydate = fDate.getDate();
2 if (hour > 12) {
3 public var timeString = (hour – 12) + ":" + minutes +":"+seconds+" " + "PM"
4 }else {
5 public var timeString = hour + ":" + minutes + ":"+seconds+" " + "AM"
6 }

Set 2, line 4: "1084: Syntax error: expecting semicolon before var."

1 if (tUsage == "Startup"){
2 //Returns array with all data
3 mainArray = new Array();
4 for (public var a = 0; a<xmlDoc_xml.firstChild.childNodes.length; a++) {
5 recLabel = new Array();
6 for (aName in xmlDoc_xml.firstChild.childNodes[a].attributes){
7 recLabel[aName] = xmlDoc_xml.firstChild.childNodes[a].attributes[aName];
8 }
9 mainArray.push(recLabel);
10 }
11 return mainArray;
12 }

Any help is MUCH appreciated!!

Original post by secguru

Lascia un Commento