"Actionscript file cannot have several external visible definitions:

Armageddon_ReHash\StateMachine.as, line 15006: an ActionScript file cannot have several definitions visible from the outside: StateMachine, detectHitLevel2

Hey thanks for checking this, I'm having an odd error that maybe just started, can you give me some comments about why this happens, here's my class and the error I get is above. Please get to me as soon as I need to know tonight.

Thanks again!

CODE:

package {}

import flash.display.MovieClip;

import flash.events. *;

import flash.utils.Timer;

import flash.display.Stage;

import flash.sampler.NewObjectSample;

SerializableAttribute public class StateMachine extends MovieClip {}

public static var player: Player;

private var scoreHUD:HUD;

public var enemyGhostTimer:Timer;

public var enemyGhost2Timer:Timer;

public var enemyGhost3Timer:Timer;

public var levelTimer:Timer;

health public var = 3;

public var score = 0;

public var timeleft = 80;

Main menu

public void StateMachine()

{

START menu

var controls: Boolean = false;

var credits: Boolean = false;

var advice: Boolean = false;

Event listeners

btn_start.addEventListener (MouseEvent.MOUSE_DOWN, start_mouseDownHandler);

btn_controls.addEventListener (MouseEvent.MOUSE_DOWN, controls_mouseDownHandler);

btn_credits.addEventListener (MouseEvent.MOUSE_DOWN, credits_mouseDownHandler);

btn_highscores.addEventListener (MouseEvent.MOUSE_DOWN, highscores_mouseDownHandler);

Stop();

Menu system

function start_mouseDownHandler(event:MouseEvent):void

{

sym_pointer.y = 315;

Stop (1, "Level 1");

Level1();

}

function controls_mouseDownHandler(event:MouseEvent):void

{

orders = true;

gotoAndStop ("controls");

sym_pointer.y = 368;

}

function credits_mouseDownHandler(event:MouseEvent):void

{

credits = true;

gotoAndStop ("credits");

sym_pointer.y = 421;

}

function highscores_mouseDownHandler(event:MouseEvent):void

{

Tips = true;

gotoAndStop ("hints");

sym_pointer.y = 474;

}

}

End of the game

public void Gameover()

{

Stop();

btn_restart.addEventListener (MouseEvent.MOUSE_DOWN, restart_mouseDownHandler);

function restart_mouseDownHandler(event:MouseEvent):void

{

Stop (1, "Level 1");

Level1();

}

}

Timers

function sendEnemy(e:Event)

{

enemy of the var = new Ghost();

stage.addChild (enemy);

}

function sendEnemy2(e:Event)

{

var enemy2 = new Ghost2();

stage.addChild (enemy2);

}

function sendEnemy3(e:Event)

{

var enemy3 = new Ghost3();

stage.addChild (enemy3);

}

function countDown(e:Event)

{

If (timeleft > 0)

{

timeLeft-;

}

ElseIf (timeleft = 0)

{

Disable()

GameOver();

}

}

//////////////////////////////////////LEVELS////////////////////////////////////////////// ////////

function Level1 (): void

{

reader = new player (internship, 400, 550);

health = 3;

stage.addChild (player);

scoreHUD = new HUD (internship);

stage.addChild (scoreHUD);

enemyGhostTimer = new Timer (500);

enemyGhostTimer.addEventListener ("timerEnemy", sendEnemy);

enemyGhostTimer.start ();

levelTimer = new Timer (1000);

levelTimer.addEventListener ("timerLevel", count);

levelTimer.start ();

stage.addEventListener (MouseEvent.MOUSE_DOWN, mouseDownHandler, false, 0, true);

stage.addEventListener (MouseEvent.MOUSE_UP, mouseUpHandler, false, 0, true);

stage.addEventListener (Event.ENTER_FRAME, detectHitLevel1);

}

function Level2 (): void

{

reader = new player (internship, 400, 550);

stage.addChild (player);

enemyGhost2Timer = new Timer (2000);

enemyGhost2Timer.addEventListener ("timerEnemy2", sendEnemy2);

enemyGhost2Timer.start ();

stage.addEventListener (MouseEvent.MOUSE_DOWN, mouseDownHandler, false, 0, true);

stage.addEventListener (MouseEvent.MOUSE_UP, mouseUpHandler, false, 0, true);

stage.addEventListener (Event.ENTER_FRAME, detectHitLevel2);

}

function Level3 (): void

{

reader = new player (stage, 25, 550);

stage.addChild (player);

enemyGhost3Timer = new Timer (5000);

enemyGhost3Timer.addEventListener ("timerEnemy3", sendEnemy3);

enemyGhost3Timer.start ();

stage.addEventListener (MouseEvent.MOUSE_DOWN, mouseDownHandler, false, 0, true);

stage.addEventListener (MouseEvent.MOUSE_UP, mouseUpHandler, false, 0, true);

stage.addEventListener (Event.ENTER_FRAME, detectHitLevel3);

}

function detectHitLevel1(e:Event):void

{

Limits

If (Player.hitTestObject (boundsright))

{

trace ("Bounds");

Player.x = player.x-10;

}

If (Player.hitTestObject (boundsleft))

{

trace ("Bounds");

Player.x = player.x + 10;

}

If (Player.hitTestObject (boundstop))

{

trace ("Bounds");

Player.y = player.y + 10;

}

If (Player.hitTestObject (boundsbottom))

{

trace ("Bounds");

Player.y = player.y-10;

}

Traps

If (Player.hitTestObject (Lava1) | player.hitTestObject (Lava2) | player.hitTestObject (Lava3) | player.hitTestObject (Lava4) | player.hitTestObject (Lava5): player.hitTestObject (Lava6): player.hitTestObject (Lava7))

{

trace ("Lava");

If (health < 0)

{

stage.removeEventListener (MouseEvent.MOUSE_DOWN, mouseDownHandler);

stage.removeEventListener (MouseEvent.MOUSE_UP, mouseUpHandler);

stage.removeEventListener (Event.ENTER_FRAME, detectHitLevel1);

stage.removeChild (player);

for (var i in Ghost.list)

{

Ghost.list [i]. Kill();

}

Stop (1, "GameOver");

Gameover();

}

-health;

scoreHUD.updateLives(-1);

Player.x = 400;

Player.y = 550;

}

Output

If (Player.hitTestObject (lvl1exit))

{

lvl1exit.x = - 10;

trace ("Exitlvl1");

score += 10;

health ++;

scoreHUD.updateLives (1);

stage.removeEventListener (MouseEvent.MOUSE_DOWN, mouseDownHandler);

stage.removeEventListener (MouseEvent.MOUSE_UP, mouseUpHandler);

stage.removeEventListener (Event.ENTER_FRAME, detectHitLevel1);

stage.removeChild (player);

for (var i in Ghost.list)

{

Ghost.list [i]. Kill();

}

}

Stop (1, "Level 2");

Level2();

}

Points

If (player.hitTestObject (civa))

{

CIVA.x = - 10;

trace ("bonus!");

score + 5;

scoreHUD.updateScore (5);

}

If (player.hitTestObject (civb))

{

CIVB.x = - 10;

trace ("bonus!");

score + 5;

scoreHUD.updateScore (5);

}

If (player.hitTestObject (vicc))

{

CIVC.x = - 10;

trace ("bonus!");

score + 5;

scoreHUD.updateScore (5);

}

}

function detectHitLevel2(e:Event):void

{

Limits

If (Player.hitTestObject (boundsright))

{

trace ("Bounds");

Player.x = player.x-10;

}

If (Player.hitTestObject (boundsleft))

{

trace ("Bounds");

Player.x = player.x + 10;

}

If (Player.hitTestObject (boundstop))

{

trace ("Bounds");

Player.y = player.y + 10;

}

If (Player.hitTestObject (boundsbottom))

{

trace ("Bounds");

Player.y = player.y-10;

}

Traps

If (Player.hitTestObject (Lava1) | player.hitTestObject (Lava2) | player.hitTestObject (Lava3) | player.hitTestObject (Lava4) | player.hitTestObject (Lava5): player.hitTestObject (Lava6): player.hitTestObject (Lava7))

{

trace ("Lava");

If (health > 0)

{

stage.removeEventListener (MouseEvent.MOUSE_DOWN, mouseDownHandler);

stage.removeEventListener (MouseEvent.MOUSE_UP, mouseUpHandler);

stage.removeEventListener (Event.ENTER_FRAME, detectHitLevel2);

stage.removeChild (player);

Stop (1, "GameOver");

Gameover();

}

-health;

scoreHUD.updateLives(-1);

Player.x = 400;

Player.y = 550;

}

Output

If (Player.hitTestObject (lvl2exit))

{

lvl2exit.x = - 10;

trace ("Exitlvl2");

score += 10;

health ++;

scoreHUD.updateLives (1);

stage.removeEventListener (MouseEvent.MOUSE_DOWN, mouseDownHandler);

stage.removeEventListener (MouseEvent.MOUSE_UP, mouseUpHandler);

stage.removeEventListener (Event.ENTER_FRAME, detectHitLevel2);

stage.removeChild (player);

Stop (1, "Niveau3");

Level3();

}

Points

If (player.hitTestObject (civa))

{

CIVA.x = - 10;

trace ("bonus!");

score + 5;

scoreHUD.updateScore (5);

}

If (player.hitTestObject (civb))

{

CIVB.x = - 10;

trace ("bonus!");

score + 5;

scoreHUD.updateScore (5);

}

If (player.hitTestObject (vicc))

{

CIVC.x = - 10;

trace ("bonus!");

score + 5;

scoreHUD.updateScore (5);

}

}

function detectHitLevel3(e:Event):void

{

Limits

If (Player.hitTestObject (boundsright))

{

trace ("Bounds");

Player.x = player.x-10;

}

If (Player.hitTestObject (boundsleft))

{

trace ("Bounds");

Player.x = player.x + 10;

}

If (Player.hitTestObject (boundstop))

{

trace ("Bounds");

Player.y = player.y + 10;

}

If (Player.hitTestObject (boundsbottom))

{

trace ("Bounds");

Player.y = player.y-10;

}

Traps

If (Player.hitTestObject (Lava1) | player.hitTestObject (Lava2) | player.hitTestObject (Lava3) | player.hitTestObject (Lava4) | player.hitTestObject (Lava5): player.hitTestObject (Lava6): player.hitTestObject (Lava7))

{

trace ("Lava");

If (health > 0)

{

stage.removeEventListener (MouseEvent.MOUSE_DOWN, mouseDownHandler);

stage.removeEventListener (MouseEvent.MOUSE_UP, mouseUpHandler);

stage.removeEventListener (Event.ENTER_FRAME, detectHitLevel3);

stage.removeEventListener (Event.ENTER_FRAME, loop);

stage.removeChild (player);

Stop (1, "GameOver");

Gameover();

}

-health;

scoreHUD.updateLives(-1);

Player.x = 400;

Player.y = 550;

}

Output

If (Player.hitTestObject (lvl3exit))

{

lvl2exit.x = - 10;

trace ("Exitlvl3");

score += 10;

health ++;

scoreHUD.updateLives (1);

stage.removeEventListener (MouseEvent.MOUSE_DOWN, mouseDownHandler);

stage.removeEventListener (MouseEvent.MOUSE_UP, mouseUpHandler);

stage.removeEventListener (Event.ENTER_FRAME, detectHitLevel2);

stage.removeEventListener (Event.ENTER_FRAME, loop);

stage.removeChild (player);

Stop (1, "GameOver");

Gameover();

}

Points

If (player.hitTestObject (civa))

{

CIVA.x = - 10;

trace ("bonus!");

score + 5;

scoreHUD.updateScore (5);

}

If (player.hitTestObject (civb))

{

CIVB.x = - 10;

trace ("bonus!");

score + 5;

scoreHUD.updateScore (5);

}

If (player.hitTestObject (vicc))

{

CIVC.x = - 10;

trace ("bonus!");

score + 5;

scoreHUD.updateScore (5);

}

}

}

I believe that the error is indicating that your class file structure is not formatted properly as it seems to be trying to define several classes in one file.  I suspect it's going to be because of incorrect provision of braces.  Unfortunately, the pileup of the code is a bit much to go through you.

I noticed that you have many nested named functions (functions within other functions) which causes problems as well.  All functions should stand on their own.

Maybe you need to really do is to find a way to break this class file into separate files based on the feature class.

Tags: Adobe Animate

Similar Questions

  • Error 5007: an actionscript file must have...

    Hi all, I am new to AS3 and just ran this problem.
    I try to have actionscript 3 and tweenlite greensocks change the alpha hover over another file properties on.

    I can do this using only pure actionscript 3; However, when I try to use Tweenlite I performed for this error:

    5007: an ActionScript file must have at least a visible definition of outside

    The code I used is:

    image = mc which has the function of turning added to it;
    info = mc who is alpha equal to 0 and I'm trying to get it to interpolate to 1 in 0.5 seconds.


    import com.greensock;
    com.greensock.easing import. *;

    image.addEventListener (MouseEvent.MOUSE_OVER, over);
    image.addEventListener (MouseEvent.MOUSE_OUT, out);

    function over(event:MouseEvent):void {}

    TweenLite.to (news, 0.5, {alpha: 1});

    }

    function out(event:MouseEvent):void {}

    TweenLite.to (news, 0.5, {alpha: 0});

    }

    What I am doing wrong?
    Thanks in advance!

    You are welcome.

  • I have several items in my trash that I can't remove. I get the message "the operation cannot be completed because one or more required elements could not be found. (Error code - 43) "when I try to do.

    The operation cannot be performed because one or more required items be found.

    (Error code - 43)

    I have several items in my trash that will not delete. I get the message that precedes, when I try to do. I deleted successfully other files using "delete immediately", but these just won't. I also can not move out of the trash to another folder.

    I'm using an iMac with OS X El Capitan 10.11.6 operating system

    Have you tried the instructions in the order that they are arranged in you may not empty the trash or move a file to the Trash - Apple Support?

  • After I restart my iMac and double-click on the hard drive, a pop up appears with this message: 'the 'Hard drive' file cannot be opened because you don't have permission to view its contents.'.  What is the problem?

    After I restart my iMac and double-click on the hard drive, a pop up appears with this message: 'the 'Hard drive' file cannot be opened because you don't have permission to view its contents.'.  What is the problem?

    Is the name of an external drive or internal one?

  • How to access the tab 'Save all' when I close several jpeg files that have been adjusted with the "color adjust tool? He is currently making me close and save one at a time. Thanks for any help :)

    How to access the tab 'Save all' when I close several jpeg files that have been adjusted with the "color adjust tool? He is currently making me close and save one at a time.  I've just upgraded to El Capitan.  Thanks for any help :)

    I assume that you use the application overview.

    I can't find an answer to back up everything, but a workaround could be while the file menu options are visible, press the option key

    and the point of the window will become close, if you click on that dialogue will ask you if you want to restore the changes or save

    pressing Save will close the image with the changes and then move to the next image and so on.

  • When I try to copy a file to an external device using Windows Explorer I get the following error message: "cannot copy. The directory or file cannot be created. »

    original title: could not copy files

    When I try to copy a file to an external device using Windows Explorer I get the following error message: "cannot copy.  The directory or file cannot be created. "I understand that I may have the physical limit of USB keys for the root directory.  How can I fix it?

    Hi GloriaZF,

    What is the size of your external hard drive and what is the available free space? Open my computer-> right click on the external hard drive-> properties. You will not be able to copy more data if the disk is full, or who have less space compared to the size of the file you are trying to copy.

    You need to remove the order data to make the space more. Deleted data from the device USB will be permanently deleted and will not be stored in your Inbox, so take care while eliminating unnecessary data.

    I hope this helps.

  • Save a PDF file cannot be modified, losing the file HAVE changed.

    It's great that illustrator can edit PDF files and it's great that Illustrator can record on a non editable PDF. But why, for the love of sanity, I would like to save a PDF file cannot be modified, but then have the original file, currently open HAVE disappear leaving only this little pointless PDF file? I STILL want the file HAVE to remain the main current job file original. But it doesn't work.

    Or if, for some reason I can't understand, this behavior is necessary, and right, then at least it should show unequivocally that I am to modify a PDF file cannot be modified and strongly suggest to me that I might want to save an editable PDF or HAVE a file, or even do it automatically until I close the file (or Illustrator crashes as it is wont to do).

    I'm working on a file HAVE and I need to save a small file of WIP not editable for the customer display. I go to file - save as-> PDF / smaller file size / uncheck "preserve Illustrator editing capabilities". I send the PDF file to the client and continue to work and save, assuming that I'm working on the original. The file looks and behaves exactly as it did until I taped that, intuitively, I guess that is the file HAVE same, original, with the PDF file in a copy. However, when I come back the next morning, after having closed the file, only the low resolution not editable PDF file remains. The file doesn't help, and I have to redo all the work all the way back to the last time, I saved the file I saved the PDF.

    Much trouble, loss of hair, the time wasted, face Palm trees, etc.

    The thing is, I now /know/ does and I'm going out of my way to avoid it happening, but in the race at the end of the work and send commands to the client and manage multiple versions of files, it still happens. Now clearly this is my fault, but heck, Illustrator could behave much more usefully in this regard!

    Well, I must be missing something, I guess.

    I asked how "save a copy...". "is the way lasts, and you replied that you were referring to not using Save a Copy... So I re - submit that by using Save a Copy is the solution to your original problem.

    • Work in Illustrator; number of objects; several layers, live effects, etc.
    • Want a copy of WIP for the customer as you have described originally...
    • Choose file > save a copy... Format is not question could make no editable PDF, raster format, whatever...
    • Continue to work in Illustrator... under a State record which is absolutely no different than if I had never done the Save a Copy... There is no "silent dump' edit-ability or any such similar event. If I record, I save it HAVE original, or a new if the State was not saved.
  • Given the migration from Outlook to Thunderbird. I have several pst files that I want separated in thunderbird, because they are separate files in Outlook.

    I have several (about 12) PSTs in Outlook, each more than 500 MB. I want to migrate to Thunderbird, but don't want all merged in a database of wholesale Thunderbird pst files. Is this possible? Currently I use rules to move messages from the Inbox Outlook in those separate pst files, based on the subject. Also, I drag messages into my Inbox in these separate files for archival purposes, which preserves values my 'active' main email box.
    Thank you
    John

    Let's start from the beginning. Thunderbird has a single file by file. From the next release (about a month) you will be able to have a file by email.

    There is nothing in Thunderbird as a PST file. So before you start, you have to accept the changes in mind that goes with mail. Records are the only delimiter in Thunderbird. You do not get to attach and detach folders or files. They are in Thunderbird or deleted.

  • I have several hundred bookmarks. Now, I need to make the files/folders and em put all in each of the files/folders. How these files?

    I have several hundred bookmarks in mozilla. Now, I would like to save in the file/folder. How can I make 15 or if the folders/files to my favorites?

    See this article:
    https://support.Mozilla.com/en-us/KB/bookmark+folders

  • Is it possible to erase or reset the old iPhones without internet service? We have several old ones that no longer have a contract of service, then the identifier Apple cannot be authenticated.

    Is it possible to erase or reset the old iPhones without internet service? We have several old ones that no longer have a contract of service, then the identifier Apple cannot be authenticated.

    If it's the activation lock prevents you from setting them up, no..

    Without a connection to Apple and Enterprise servers, no..

  • My PC does not allow me to down load anything, that is to say that the files cannot be verified, and he also says that my certificate is not valid. does anyone have ideas, what it means

    I am trying the load Kaspersky Pure, but it says that the file cannot be verified

    I am trying the load Kaspersky Pure, but it says that the file cannot be verified

    Two questions for you:

    1. Please quote the exact verbatim of the message you get.

    2. you say "Download", but don't you mean "Download" or "install"? Don't miss the download or installation fails after you have successfully downloaded the file.

    Just in case you are confused as to what the words mean, please read the following:

    The word 'Download' means to copy a file (perhaps a program file, but not necessarily) from a server somewhere on the internet for your computer. Please invert not that Word with 'install', which means to load a program on your hard disk in a form from which it can be executed.

    Generally, you install a program from a CD, a floppy disk or on the internet. Only in the latter case, the internet, is there any download involved, but even then, it's a two step process: first download you from the internet, and then you install it.

  • Can I restore my laptop hard drive files that have been moved to my external hard drive (who subsequentally has stopped working)?

    I cut and pasted and then a few important files from my laptop on an external hard drive. Since the external hard drive stopped working. Is it possible to find the files that have been moved?

    Thank you!

    (More info: I tried to recover the files from external hard disk but it requires a physical recovery and would cost over $ 1000, which I did not; also unfortunately I don't think I created backup via the "backup and Restore Center" files in the control panel).

    It depends on how long you have moved the files, and how the computer has been used since.

    If you have Vista Business, Ultimate or enterprise, you can use the previous versions.

    http://Windows.Microsoft.com/en-us/Windows-Vista/previous-versions-of-files-frequently-asked-questions

    Try these programs:

  • All help & support files have disappeared. I get the message "help and support files cannot start."

    Original title: help & support files

    Windows 7 Professional. All help & support files have disappeared. I get the message "help and support files cannot start."

    How to return please?.

    Perhaps.  An analysis of file system I think would replace the help files, but you can try it, there is no harm.  Just open a command prompt (right click and "open as Administrator"), and then type sfc/scannow

  • Return of the mistake of MUSE: why do we not have several files with the same name?

    Well - I thought I had all this worked and fixed, but I met the download error 'Why do we have several files with the same name' once again.  (I downloaded all the files several times today in order to 1) works the way it worked the last time and 2) get an OAM file that is not loading for some reason any load again and the download takes about an hour to transfer all the files manually.

    To recap:

    (1) an option "Upload only modified files" returns the 'Muse has encountered an error and closes.  Why do we have several files with the same name? "error just as before.

    (2) a full download will work but takes forever and is NOT a substitution for work changed files option.

    Please advise with possible solutions!

    -Dave

    Is it possible to have two .oam different files in different folders on your computer where the .oam files have the same name? I'm theorizing that there may be a bug in the treatment to ensure the folder created for a .oam placed on the server receives a unique name, particularly in the case of a partial update of the site on the server.

    Please send us the .muse file and all the files in .oam related to [email protected] along with a link to this topic for the context so we can attempt to reproduce this error and isolate the root cause. If files are larger than 20 MB, you'll need to use a service such as Adobe send & Track, Dropbox, creative cloud, WeTransfer, etc. file sharing. Thank you.

  • Can you have multiple packages in a source code file, or you have several files?

    Can you have multiple packages in a source code file, or you have several files?

    ExampleClass must be saved in a directory as well as your main fla.

    This directory must have a subdirectory named samples containing SampleCode.

Maybe you are looking for

  • 2. separate Apple ID.

    We have 2 separate Apple ID. We don't want a family sharing. We want to share iCal and Contacts but keep private all the rest. In my view, there is a way we can have that. I have an iPhone 6s and an iMac running the latest version of the software. Sh

  • Satellite Pro P100: Where to find recovery CD/DVDs

    We have a 2 year old child "Satellite PRO P100 (model No. PSPA4E-00N00KED) and it does not work very well and now I want to use the recovery CD, but miss me it. Is it possible for anyone to help them with this issue with a link to an approved place o

  • Impossible to compile for different JRE versions

    Dear friends, I'm trying to compile for different versions of JRE Blackberry that is 4.5, 4.6, 4.7 and 5.0. I chose the JRE version in a Configuration set, but when it is compiled is showing version 5.0 in deliverables/Standard. That's why on the ins

  • RDY % <>- "VM CPU Ready Time (ms)"

    HelloI have a question resulting from the conversion of the value of loan from cpu.When I use extop, cpu ready is shown as % rdy, but when I am trying to create an alarm trigger, it is shown as "VM CPU Ready Time (ms)".Can you tell me, how can I conv

  • Can I transfer CS5 that was purchased for the price "student"?

    I have photoshop CS5 since I am a student at the Fotoacademie in Amsterdam. I bought it for the price 'student '. Now, I want to move to the CC.  Can I sell and transfer my CS5 license?