A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Why does all coding turn off in AS3 after minor error?

  1. #1
    Flasher
    Join Date
    Jun 2005
    Location
    NJ
    Posts
    8

    Why does all coding turn off in AS3 after minor error?

    Hey, just wondering why AS3 decides to stop running all scripts if something isnt right with the programming? Every time i might have a slight syntax error here or there, or a missing object, coding throughout my entire movie stops. All my stop functions cease to work, and the movie and movieclips loop continuously. This never happened in AS2. Is there anyway to prevent flash from turning off all actions because of some minuscule error?

  2. #2
    ....he's amazing!!! lesli_felix's Avatar
    Join Date
    Nov 2000
    Location
    London UK
    Posts
    1,506
    The code assumes you've done something wrong and the rest of the code is considered redundant. This is much more in line with other languages and makes debugging easier in the long run.

    use try-catch to get around this:

    PHP Code:
    try {
      
    code causing possible error here;
    }
    catch(
    errObject:Error) {
      
    trace(errObject.message);


  3. #3
    Crazy Cyborg Monkey
    Join Date
    Jan 2006
    Posts
    18
    It does that because there is no reason to test the rest of the code if a mistake has already been found, you know that something is wrong.

    Its the safer way to handle things.
    "Homer no function beer well without...."

    Homer Simpson

  4. #4
    Flasher
    Join Date
    Jun 2005
    Location
    NJ
    Posts
    8
    theres no way to disable this feature? thats just stupid. I dont see how it would make debugging easier considering now that coding has stopped completely, i cant debug the code at run time, or test other things that might help me solve my problem..

  5. #5
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    The problem is that Flash doesn't always run in a walled garden - imagine if you were testing an AIR app that wrote or deleted files and you had a bug in your code - you'd certainly want it to stop working rather than deleting a bunch of important data. Same thing with calling a php script with SQL instructions or setting shared objects. It can be inconvenient but it's a lot better than allowing you to inadvertently destroy data or worse, opening up Flash as a playground for malicious scripts.

  6. #6
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    You can inactivate strict mode in the publish settings under Actionscript 3 settings, but I don't recommend it. Also it is not true that your script is not compiled at all when you have an error. It is compiled up to the point where the error occurs and that allows debugging also, since trace statements are executed up to that point.

    The try-catch should not be used to bypass errors. That is useful when errors occur because the movie is tested outside of the html page (Flashvars) for example.
    - The right of the People to create Flash movies shall not be infringed. -

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center