Hi there,
Basically I’m creating an application using AS3, its a group project at uni, and I was putting everyone’s code together into the one file. The tinkering still isn’t complete so I know there are other errors in my code to be found. But anyway.
After copying the snippets across. Error 5006, was spat out at me: An ActionScript file can not have more than one externally visible definition: mainClass, moveForwardLeft
was spat out at me, I’ve searched for answers, most of the people I’ve seen with the same error seems to be do with their curly brackets (what I call { } brackets )
Anyway here’s my code.
Im sorry for the amount just I have no idea how to fix this. I’ve checked all my functions over and over again, my “moveFowardLeft” function enough times as well, I just cant find the problem.
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.text.*;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class mainClass extends MovieClip
{
//declared variables (so you dont have to scroll through all of this bit)
public function parseXML(event:Event):void
{
//XML stuff (so you dont have to scroll through all of this bit)
public function moveForward0(e:MouseEvent)
{
removeChild(mainFoyer);
removeChild(forward);
addChild(corridor1);
addChild(forward1);
addChild(back3);
addChild(topBanner);
addChild(areaInfo);
addChild(intoCM26);
intoCM26.x = 300;
intoCM26.y = 100;
forward1.x = 900;
forward1.y = 300;
back3.x = 900;
back3.y = 900;
corridor1.x = 0;
corridor1.y = 0;
addChild(MainFoyerText);
areaInfo.x = 0;
areaInfo.y = 0;
areaInfo.width = 1200;
areaInfo.height = 100;
//areaInfo.text = ("Room Info - Corridor: CM25 Linux Lab, CM26 Forensics Lab, Staff Offices");
}
}
public function moveForwardLeft(e:MouseEvent)
{
removeChild(mainFoyer);
removeChild(forward);
addChild(mainFoyerLeft);
addChild(forwardRight);
addChild(forward5Left);
addChild(roomArrowCM06);
mainFoyerLeft.x = 100;
mainFoyerLeft.y = 300;
forwardRight.x = 1500;
forwardRight.y = 300;
forwardRight.rotation = 175;
forward5Left.x = 1000;
forward5Left.y = 800;
forward5Left.rotation = 15;
roomArrowCM06.x = 1000;
roomArrowCM06.y = 300;
roomArrowCM06.rotation = -75;
mainFoyerLeft.x = stage.stageWidth / 2;
mainFoyerLeft.y = stage.stageHeight / 2;
forward5Left.addEventListener(MouseEvent.CLICK, moveCorridor1Left);
roomArrowCM06.addEventListener(MouseEvent.CLICK, enterCM06);
/*forwardRight.addEventListener(MouseEvent.CLICK, moveForward0); problem going back to foyer*/
}
public function enterCM06(e:MouseEvent)
{
removeChild(mainFoyerLeft);
removeChild(forwardRight);
removeChild(forward5Left);
removeChild(roomArrowCM06);
addChild(roomCM06);
addChild(roomArrowExitCM06);
roomCM06.x = 3000;
roomCM06.y = 3000;
roomArrowExitCM06.x = 1200;
roomArrowExitCM06.y = 500;
roomArrowExitCM06.rotation = 90;
roomCM06.x = stage.stageWidth / 2;
roomCM06.y = stage.stageHeight / 2;
/*roomArrowExitCM06.addEventListener(MouseEvent.CLICK, moveForwardLeft);*/
}
public function moveCorridor1Left(e:MouseEvent)
{
removeChild(mainFoyerLeft);
removeChild(forwardRight);
removeChild(forward5Left);
addChild(corridorLeft1);
addChild(back7Left);
addChild(forward6Left);
addChild(roomArrowCM11);
corridorLeft1.x = 100;
corridorLeft1.y = 2000;
back7Left.x = 1300;
back7Left.y = 500;
back7Left.rotation = -75;
forward6Left.x = 1000;
forward6Left.y = 1000;
forward6Left.rotation = 15;
roomArrowCM11.x = 900;
roomArrowCM11.y = 500;
roomArrowCM11.rotation = -75;
corridorLeft1.x = stage.stageWidth / 2;
corridorLeft1.y = stage.stageHeight / 2;
forward6Left.addEventListener(MouseEvent.CLICK, moveCorridor2Left);
roomArrowCM11.addEventListener(MouseEvent.CLICK, enterCM11);
back7Left.addEventListener(MouseEvent.CLICK, moveForwardLeft);
}
public function enterCM11(e:MouseEvent)
{
removeChild(corridorLeft1);
removeChild(back7Left);
removeChild(forward6Left);
removeChild(roomArrowCM11);
addChild(roomCM11);
addChild(roomArrowExitCM11);
roomCM11.x = 3000;
roomCM11.y = 3000;
roomArrowExitCM11.x = 1000;
roomArrowExitCM11.y = 400;
roomArrowExitCM11.rotation = -75;
roomCM11.x = stage.stageWidth / 2;
roomCM11.y = stage.stageHeight / 2;
/*roomArrowExitCM11.addEventListener(MouseEvent.CLICK, moveForwardLeft);*/
}
public function moveCorridor2Left(e:MouseEvent)
{
removeChild(corridorLeft1);
removeChild(back7Left);
removeChild(forward6Left);
addChild(corridorLeft2);
addChild(back8Left);
addChild(forward7Left);
addChild(roomArrowCM16);
addChild(roomArrowCM17);
corridorLeft2.x = 100;
corridorLeft2.y = 300;
back8Left.x = 600;
back8Left.y = 400;
back8Left.rotation = 30;
forward7Left.x = 1000;
forward7Left.y = 1050;
forward7Left.rotation = 10;
roomArrowCM16.x = 1400;
roomArrowCM16.y = 800;
roomArrowCM16.rotation = 105;
roomArrowCM17.x = 1100;
roomArrowCM17.y = 300;
roomArrowCM17.rotation = 105;
corridorLeft2.x = stage.stageWidth / 2;
corridorLeft2.y = stage.stageHeight / 2;
roomArrowCM16.addEventListener(MouseEvent.CLICK, enterCM16);
roomArrowCM17.addEventListener(MouseEvent.CLICK, enterCM17);
/*back8Left.addEventListener(MouseEvent.CLICK, moveForwardLeft); same problem going function above */
}
public function enterCM16(e:MouseEvent)
{
removeChild(corridorLeft2);
removeChild(back8Left);
removeChild(forward7Left);
removeChild(roomArrowCM16);
removeChild(roomArrowCM17);
addChild(roomCM16);
addChild(roomArrowExitCM16);
roomCM16.x = 3000;
roomCM16.y = 3000;
roomArrowExitCM16.x = 1000;
roomArrowExitCM16.y = 400;
roomArrowExitCM16.rotation = -75;
roomCM16.x = stage.stageWidth / 2;
roomCM16.y = stage.stageHeight / 2;
}
public function enterCM17(e:MouseEvent)
{
removeChild(corridorLeft2);
removeChild(back8Left);
removeChild(forward7Left);
removeChild(roomArrowCM16);
removeChild(roomArrowCM17);
addChild(roomCM17);
addChild(roomArrowExitCM17);
roomCM17.x = 3000;
roomCM17.y = 3000;
roomArrowExitCM17.x = 1000;
roomArrowExitCM17.y = 400;
roomArrowExitCM17.rotation = -75;
roomCM17.x = stage.stageWidth / 2;
roomCM17.y = stage.stageHeight / 2;
}
public function CM26(e:MouseEvent)
{
removeChild(corridor1);
removeChild(back3);
removeChild(forward1);
removeChild(intoCM26);
addChild(linuxLab);
}
public function CM33(e:MouseEvent)
{
removeChild(corridor2);
removeChild(forward2);
removeChild(back2);
removeChild(intoCM33);
}
public function CM18(e:MouseEvent)
{
removeChild(mainFoyer);
removeChild(forward);
removeChild(intoCM18);
}//
public function moveBack3(e:MouseEvent)
{
removeChild(corridor1);
removeChild(forward1);
removeChild(back3);
addChild(forward);
addChild(forward4Left);
addChild(topBanner);
addChild(areaInfo);
forward.x = 900;
forward.y = 300;
forward4Left.x = 500;
forward4Left.y = 500;
forward4Left.rotation = -90;
mainFoyer.x = 0;
mainFoyer.y = 0;
areaInfo.x = 0;
areaInfo.y = 0;
areaInfo.width = 1200;
areaInfo.height = 100;
areaInfo.text = ("Room Info - Corridor: CM25 Linux Lab, CM26 Forensics Lab, Staff Offices");
}
public function moveForward1(e:MouseEvent)
{
removeChild(corridor1);
removeChild(forward1);
addChild(corridor2);
addChild(forward2);
addChild(back2);
addChild(topBanner);
addChild(areaInfo);
addChild(intoCM33);
intoCM33.x = 750;
intoCM33.y = 50;
back2.x = 500;
back2.y = 500;
forward2.x = 900;
forward2.y = 300;
forward2.rotation = -90;
corridor2.x = 0;
corridor2.y = 0;
areaInfo.x = 0;
areaInfo.y = 0;
areaInfo.width = 1200;
areaInfo.height = 100;
areaInfo.text = ("Room Info - Corridor: CM33 General Computer Lab, CM34 Multimedia Lab");
trace("move foward 1");
}
public function moveForward2(e:MouseEvent)
{
removeChild(corridor2);
removeChild(forward2);
addChild(mmDoor);
addChild(forward3);
addChild(topBanner);
addChild(areaInfo);
forward3.x = 900;
forward3.y = 300;
mmDoor.x = 0;
mmDoor.y = 0;
areaInfo.x = 0;
areaInfo.y = 0;
areaInfo.width = 1200;
areaInfo.height = 100;
areaInfo.text = ("Room Info - Multimedia Lab: Higher Specification Computers");
trace("move foward 2");
}
public function moveForward3(e:MouseEvent)
{
removeChild(mmDoor);
removeChild(forward3);
addChild(mmLab);
addChild(back6);
addChild(topBanner);
addChild(areaInfo);
forward3.x = 900;
forward3.y = 300;
back6.x = 900;
back6.y = 500;
mmLab.x = 0;
mmLab.y = 0;
areaInfo.x = 0;
areaInfo.y = 0;
areaInfo.width = 1200;
areaInfo.height = 100;
//areaInfo.text = ("Room Info - Multimedia Lab: Higher Specifications Computers - all run Adobe Master Collected CS6");
trace("move foward 3");
function moveBack0(e:MouseEvent)
{
//removeChild(mmLab);
//removeChild(back);
addChild(mmDoor);
addChild(forward3);
addChild(back6);
addChild(topBanner);
addChild(areaInfo);
back.rotation = 180;
back.x = 900;
back.y = 300;
forward3.x = 900;
forward3.y = 300;
mmDoor.x = 0;
mmDoor.y = 0;
areaInfo.x = 0;
areaInfo.y = 0;
areaInfo.width = 1200;
areaInfo.height = 100;
//areaInfo.text = ("Room Info - Corridor: CM25 Linux Lab, CM26 Forensics Lab, Staff Offices");
}
}
public function moveForwardLeft(e:MouseEvent)
{
removeChild(mainFoyer);
removeChild(forward);
addChild(forwardRight);
addChild(mainFoyerLeft);
addChild(topBanner);
addChild(areaInfo);
mainFoyerLeft.x = 500;
mainFoyerLeft.y = 300;
forwardRight.x = 900;
forwardRight.y = 500;
forwardRight.rotation = 90;
mainFoyerLeft.x = 0;
mainFoyerLeft.y = 0;
areaInfo.x = 0;
areaInfo.y = 0;
areaInfo.width = 1200;
areaInfo.height = 100;
//areaInfo.text = ("Room Info - Corridor: CM25 Linux Lab, CM26 Forensics Lab, Staff Offices");
}
function moveBack0(e:MouseEvent)
{
removeChild(mmLab);
removeChild(back);
addChild(mmDoor);
addChild(forward3);
addChild(back6);
addChild(topBanner);
addChild(areaInfo);
back.rotation = 180;
back.x = 900;
back.y = 300;
forward3.x = 900;
forward3.y = 300;
mmDoor.x = 0;
mmDoor.y = 0;
areaInfo.x = 0;
areaInfo.y = 0;
areaInfo.width = 1200;
areaInfo.height = 100;
//areaInfo.text = ("Room Info - Corridor: CM25 Linux Lab, CM26 Forensics Lab, Staff Offices");
}
//theres an error in this bit of code, ill try and fix it when everything is pulled together.
/*public function moveBack0 (e:MouseEvent)
{
removeChild(mmLab);
removeChild(back);
addChild(mmDoor);
addChild(forward3);
addChild(back1);
back.rotation = 180;
back.x = 1340;
back.y = 300;
forward3.x = 1340;
forward3.y = 300;
mmDoor.x = stage.stageWidth / 2;
mmDoor.y = stage.stageHeight / 2;
}*/
public function mainClass()
{
// constructor code
addChild(mainFoyer);
addChild(topBanner);
addChild(forward);
addChild(forward4Left);
addChild(areaInfo);
addChild(intoCM18);
intoCM18.x = 900;
intoCM18.y = 600;
areaInfo.x = 0;
areaInfo.y = 0;
areaInfo.width = 1200;
areaInfo.height = 100;
if (languageOn_EN = true)
{
areaInfo.text = ("Main Foyer ENGLISH");
}
else if (languageOn_FR = true)
{
areaInfo.text = ("Main Foyer FRENCH");
}
else if (languageOn_SP = true)
{
areaInfo.text = ("Main Foyer SPANISH");
}
else if (languageOn_GE = true)
{
areaInfo.text = ("Main Foyer GERMAN");
}
else if (languageOn_IT = true)
{
areaInfo.text = ("Main Foyer ITALIAN");
}
//areaInfo.text = ("Room Info - Main Foyer: CM19 24 Hour Access Room, CM18 Orace Labs");
forward.x = 900;
forward.y = 300;
forward4Left.x = 500;
forward4Left.y = 500;
forward4Left.rotation = -90;
mainFoyer.x = 0;
mainFoyer.y = 0;
intoCM18.addEventListener(MouseEvent.CLICK, CM18);
forward.addEventListener(MouseEvent.CLICK, moveForward0);
intoCM26.addEventListener(MouseEvent.CLICK, CM26);
forward1.addEventListener(MouseEvent.CLICK, moveForward1);
intoCM33.addEventListener(MouseEvent.CLICK, CM33);
forward2.addEventListener(MouseEvent.CLICK, moveForward2);
forward3.addEventListener(MouseEvent.CLICK, moveForward3);
forward4Left.addEventListener(MouseEvent.CLICK, moveForwardLeft);
back6.addEventListener(MouseEvent.CLICK, moveBack0);
back2.addEventListener(MouseEvent.CLICK, moveBack3);
//IntroScreen.addEventListener(MouseEvent.CLICK, startApp);
xmlLoader.addEventListener(Event.COMPLETE, parseXML);
}
}
Sorry about the amount, I’ve tried to take out of this code that I’m possitive isn’t causing a problem…at the moment :P.
Thanks in advance Matt.
P.S I know my coding is terrible and a bad way of doing the kind of application im doing but it’s not a big concern for me at the present.