A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Why use .as files

  1. #1
    Junior Member
    Join Date
    Oct 2010
    Posts
    24

    Why use .as files

    What is the difference between using .as files and including normal "actions" in FLV's?

  2. #2
    Senior Member
    Join Date
    Jul 2008
    Posts
    391
    I'm no expert on the actual amazing reasons why you should use AS files instead but I can tell you why I use them instead of the Actions panel (Is that what you meant by normal "actions" in FLV's?).

    Everything isn't packed into one single panel like the Actions panel. What if you make something that has thousands of lines of code? Trying to find one specific line when they are all in one single panel will make you want to jump out the window. With AS files you can organize different sections of code into their specific areas. So a game would have like Main.as, Shop.as, Game.as, Enemy.as, Player.as, something like that.

    You can create custom classes that you can reuse over and over again in AS files, all you have to do is create it once, then import it into every project that you need it in.

    I find it easier to debug errors with, cause the output will show like
    PHP Code:
    Term is undefined
    at this
    .addChild ()
    at Player.CreateBullet 
    This output tells me the error was caused by the CreateBullet function called by the Player class.

    And lastly if you have non-programmer friends they'll be like "wow your game loads 10 different files of code? That seems so advanced!".

  3. #3
    Senior Member
    Join Date
    May 2010
    Location
    Russia: Western Siberia
    Posts
    268
    FLV - Flash Video. You cannot include any normal "actions" into it. It's just a video.

    SWF - ShockWave File. A binary file which contains all of your code in a binary format that a CPU can understand.

    Actually, there's a lot of articles written on this matter already. Read this, for example: http://active.tutsplus.com/tutorials...lass-in-flash/

  4. #4
    Junior Member
    Join Date
    Oct 2010
    Posts
    24
    Quote Originally Posted by 5Five555 View Post
    I'm no expert on the actual amazing reasons why you should use AS files instead but I can tell you why I use them instead of the Actions panel (Is that what you meant by normal "actions" in FLV's?).
    Yes, that's what I meant by "normal actions". Thank you 5Five555 for the information.

    So, if I understood correctly, if I copy everything from my as file to "actions" panel in the first frame, it should work the same way as before............................................ .......(leaving out the "package" statements)

    Am I right?

  5. #5
    Senior Member
    Join Date
    Jul 2008
    Posts
    391
    You have to take out all the public and private keywords too. Other than that I think that's all you need to change.

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