Results 1 to 5 of 5

Thread: Question for Medyman

  1. #1
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default Question for Medyman

    Catchy title eh?

    Since the onset of AS 3.0 I figured I best get with the program. I use 2.0 scripting in 1.0 techniques. This means basically I use new code in the old ways (Me you stick with, much you will learn, padawan) and thus have stayed away from .as files.

    But I don't want to be the old dog without new tricks, so I began doing some .as files. Problem is something you can put in there, some things you can not.

    I know basic order of inputs, and how to set it up (note the word basic). I have tried looking for mentions of howto's for this and they are sparse if anything.

    Would you happen to have any basic run downs for utilizing .as files? How to write them properly, how/when to call them, etc.

    I would be interested in learning such things.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Yup, sure is catchy!

    It's good that you're moving to write your AS externally. From a programming perspective, it really doesn't make that much of a difference. There are certain things that are done differently but it's the same code (for the most part) and the same behaviors.

    The benefit of external AS comes in increased effeciency, workflow and flexibility. Using an external editor (I use SE|PY, the best free one by my standards) makes life 10x easier...you can concentrate on logic and not worry about syntax as much.

    Also if you're moving towards OOP or even simple AS3, you'll become familiar with some of the techniques you'll have to use.

    The only think you need to know about using external AS, you probably already do...
    Code:
    #include "file.as"
    Those ARE the basics. There really isn't much more to it, especially if you only have one external AS file. (If you have multiple, you have to consider when you're calling variables accessed in other AS files, etc...).

    Anything that you're able to code within the Flash IDE, you can do in external AS. There really aren't any limitations.

    The major differences, though, are:
    1) Buttons, etc...
    I've noticed that you put button actions on the actual button. You should really get in the habit of scripting that from a seperate layer or external file. I don't think that CS3 even lets you do that.

    So...

    Code:
    on (release) {
       do this
    }
    would become

    Code:
    button.onRelease = function() {
       do this
    }
    2) Paths
    The biggest change are the paths you use to call MCs. You have to remember that all of your AS now resides on frame 1 of your root timeline. So, everything must be called relative to that. (Another tip: get away from using _root...again, not very AS3/CS3 friendly).


    Keeping those two things in mind, you're golden. Not much more to it really. I do all of my AS coding externally. Most of my recent projects (mostly websites) have 1 frame, with an actions layer linked to an external AS file....that's it. Everything is done from that point. That's the implementation that I recommend. I've seen some other link to various AS files from different points on the timeline. This can get very tricky as you have to maintain relative paths to MCs.

    I'm not sure if that answers anything for you. Hope it does. Let me know if you have more questions.

  3. #3
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Thanks, that's about what I needed.

    Makes me wish for Flash 5. I probably won't change anything about the way I code for a while, the "old way" is still better in almost every respect, especially for teaching. It's comfortable and I don't have to rely on missing comas or semi-colons to ensure my box moves to the left 3 pixels. LOL.

    But it is always good to know new things. And to Adobe's credit they do keep up the Flash mantle of 1+ version back compatible. Even the AS3 that wasn't going to work with AS2 still does. And I have redone all my movies in CS3 using Flash 7 coding and they work perfectly, so I won't hear any AS2 bashing (not from you, just saying).

    Just like other languages Flash is making the easy more difficult and they should knock that crap off.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  4. #4
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Okay, going for a live test of this now...

    I made a flash movie (a new intro page for my site) and I did it the way I normally do it. Now I am going to take all my AS off the action frame and place it in an .as file.

    In it's place I am going to put

    Code:
    #include "mymenu.as"
    Publish, upload the .swf and it should work like normal, yes?

    We shall see....
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  5. #5
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Quote Originally Posted by BLiZZaRD View Post
    Okay, going for a live test of this now...

    I made a flash movie (a new intro page for my site) and I did it the way I normally do it. Now I am going to take all my AS off the action frame and place it in an .as file.

    In it's place I am going to put

    Code:
    #include "mymenu.as"
    Publish, upload the .swf and it should work like normal, yes?

    We shall see....
    As long as the movieclip paths are all relative to the root timeline, yes..it should work exactly as when you coded within the Flash IDE

Bookmarks

Posting Permissions

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