Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - esrix

#1
Quote from: Snarky on Thu 28/08/2008 06:06:05
That snippet doesn't exactly make a strong case for the superiority of AS 3.0. They went from some kind of enum for the keycodes to having to manually define constants using magic numbers? Is time moving backwards in Flash-land?

Wasn't making a case for any superiority, just providing an example and stating my personal preferences.  They made changes in ActionScript in HOPES of making it better, not guaranteeing the results.

The "Magic Numbers" and the keys they stand for are listed online here:
http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001686.html

Some of them follow their ASCII counter parts, but there are some exceptions.

Yeah, having constants for the keys like they did in the past would be nice... but life goes on.

Quote from: Kinoko on Thu 28/08/2008 02:43:11
And everything has gone smoothly until it came to adding the code into the movie clip's action panel. From what I can gather, I need (with 3.0) to add the code into my main timeline in an 'actions' layer, but I need to change the code to indicate what I want it to act on.

Sorry, didn't mean to leave you hanging there...

Remember, the ActionScript is going to stop working if there is a keyframe that comes after it on the same layer.

Best to place the ActionScript on its own separate layer with the same number of frames as the entire movie, but only one keyframe at the beginning if you want it to be used throughout the entire movie.  If you want it to just apply to a few frames, put in a key frame where you want it to start, put in the actionscript, and have another keyframe at the point where you want it to stop on the same layer.  It should work for both AS2.0 and AS3.0.

Hope it helps.
#2
Quote from: Kinoko on Thu 28/08/2008 02:43:11
Oh, now I'm conflicted. I've heard a lot of people complaining about 3.0.

This is most likely due to the vast differences between AS3.0 and AS2.0.  For example, in AS2.0, if you wanted to pull an image to the front based on it's Y coordinate, you could call "SwapBuffers" and be done with it.  However, in AS3.0 the function does not exist and you have to go through the display list on the movie clip and pull some strings to get it the way you want it.

Even if you change something in hopes of making it better, there will be those that oppose it.

As for the earlier claim that the majority of people still use AS2.0... I dunno.  I'd have to see the stats, but there are a lot of people who use 3.0.

...As for the code in that tutorial:

Code: ags

    onClipEvent(enterFrame){
        if(Key.isDown(Key.RIGHT)){
            this._x += 5;
            this.gotoAndStop(”right”);
        }

        if(Key.isDown(Key.LEFT)){
            this._x -= 5;
            this.gotoAndStop(”left”);
        }

        if(Key.isDown(Key.UP)){
            this._y -= 5;
            this.gotoAndStop(”up”);
        }

        if(Key.isDown(Key.DOWN)){
            this._y += 5;
            this.gotoAndStop(”down”);
        }

    }



would become something like this:

Code: ags

    //Flash key codes constants
    const UP:int = 38 // up arrow
    const DOWN:int = 40 // down arrow
    const LEFT:int = 37 // left arrow
    const RIGHT:int = 39 //right arrow

    //You have to add event listeners to the movie clip with AS3.0
    //if you want to get key board events
    //In this case, I don't believe you need an enter frame event listener,
    //just the keyboard one...

    //Essentially, event listeners wait for an event to happen, and then call a function
    this.addEventListener(KeyboardEvent.KEY_DOWN, keyDown, false, 0, true);

    //The function it's calling
    function keyDown( e:KeyboardEvent ):void
    {
        if(e.keyCode == RIGHT){
            this.x += 5;
            this.gotoAndStop(”right”);
        }

       if(e.keyCode == LEFT){
            this.x -= 5;
            this.gotoAndStop(”left”);
       }

       if(e.keyCode == UP){
            this.y -= 5;
            this.gotoAndStop(”up”);
       }

       if(e.keyCode == DOWN){
            this.y += 5;
            this.gotoAndStop(”down”);
       }
    }


In the end, what you choose should be based on what you are comfortable with.  I do AS3.0 because that's what they use where I work and I prefer its syntax over AS2.0.  Pick your poison well :)
#3
Hm...  Well, what area of Flash are you trying to get into?  Coding or animation? And what type of game are you looking to develop?

If you are going for coding, you may want to check out Flash Develop at http://www.flashdevelop.org/community/.  It requires a bit of setup (downloading Java, the Flex Compiler, .NET runtime for Windows version) but it is free of charge.

If you are going for art/animation, then you'll probably want to stick to the Flash Professional IDE.

I actually work on Flash games for my job, and there's a lot of interesting things you can do with Flash, as well as some tricks you have to learn to make it do what you want.  Which ever route you choose to go, I'd recommend learning some code at some point.  ActionScript 3.0 will be your best bet, as it has a significant performance increase over ActionScript 2.0.

It may also help you to read some books about Flash and game development (and there are even books on developing Flash games).  You can easily find them at Barnes & Nobles or Amazon.com.
SMF spam blocked by CleanTalk