Tile Based movement in AS3

Hello I always try to create tile-based movement. I hear by the character can move smoothly but will always end up in the middle of the slab (just like the games of Pokémon). I managed to make it work if the player only uses one key, but in combination with other keys it does not work. I was hoping someone could give me advise how to fix the code or maybe a better/more easy way to do it.

Here is my code so far (it's only for the left and right touch) my character movieclip is the instance name tank

import flash.ui.Keyboard;

import flash.events.KeyboardEvent;

import flash.events.Event;

Fl.transitions.easing import. *;

import com.greensock;

var pixelsMoved:Number = 0;

var pixelsLeft:Number = 0;

var tweening:Boolean = false;

var rightKeyDown:Boolean = false;

var leftKeyDown:Boolean = false;

addEventListener (Event.ENTER_FRAME, Loop);

stage.addEventListener (KeyboardEvent.KEY_DOWN, KeyPress);

stage.addEventListener (KeyboardEvent.KEY_UP, KeyRelease);

function Loop(event:Event):void

{

If (interpolation is false)

{

If (rightKeyDown is true)

{

Char.x += 1;

pixelsMoved += 1;

}

Else if (leftKeyDown == true)

{

Char.x-= 1;

pixelsMoved += 1;

}

If (pixelsMoved > = 25)

{

pixelsMoved = 0;

pixelsLeft = 25;

}

}

}

function KeyPress(event:KeyboardEvent):void

{

If (event.keyCode is Keyboard.RIGHT)

{

rightKeyDown = true;

}

If (event.keyCode is Keyboard.LEFT)

{

leftKeyDown = true;

}

}

function KeyRelease(event:KeyboardEvent):void

{

pixelsLeft = 25 - pixelsMoved;

If (event.keyCode is Keyboard.RIGHT)

{

If (interpolation is false)

{

var moveRight:TweenLite = new TweenLite (char, pixelsLeft, {x: char.x + pixelsLeft, ease:None.easeNone, useFrames: true, onComplete: resetVars});

}

rightKeyDown = false;

interpolation = true;

}

If (event.keyCode is Keyboard.LEFT)

{

If (interpolation is false)

{

var moveLeft:TweenLite = new TweenLite (char, pixelsLeft, {x: char.x - pixelsLeft, ease:None.easeNone, useFrames: true, onComplete: resetVars});

}

leftKeyDown = false;

interpolation = true;

}

}

function resetVars (): void

{

interpolation = false;

pixelsLeft = 0;

pixelsMoved = 0;

}

Any help is much apreciated!

You can use the left/right and up/down if-else statements, but not right, left, up, down in your loop function.

You also will find it easier to use only four Boolean values to determine what action to take in a loop.

Tags: Adobe Animate

Similar Questions

  • Loading movies with AS3

    I'm trying to understand how works AS3 than AS2 when using the navigation buttons to load external .swf files.

    In AS2, I have 5 menu buttons. Each button contained a script to load an external .swf file into layer 2 (on top of my existing film). It also contains a line of code to unload a movie that was already in layer 2. This way new movies arrived head and are easy to identify when it came time for them to be discharged.

    Now in AS3, I can't find a similar way to work with external movies, since there is no more layers. I create a movieLoader and add a child so it loads my external .swf - that works very well.

    But how can I say each button to remove all children already exist before loading the new child? The way it works now, the movies just keep stilts above the other whenever I click on a button.

    Here is the code that I put with each key, activated by a mouse event listener. "requested_movie_name" would be different for each button.

    var movieRequest:URLRequest = new URLRequest ("' requested_movie-name.swf" ");

    var movieLoader:Loader = new Loader ();

    movieLoader.load (movieRequest);

    addChild (movieLoader);

    Thanks for any help

    You do not need to identify what film to unload, a charger can contain only a single child display both object.  To unload the loader for the code you showed that you would simply use...

    movieLoader.unload ();

    Because you load swf files, you should look through the help documentation for the Loader class and the unload method because it has a few special remarks that might help your scenario.

  • Vertical movement the AS3 Carat

    Earlier, I struggled with moving the horizontal Carat now I need to move it to the top and to the bottom of the text box.

    It is a keyboard virtual so all arrow controls are made with coded buttons.

    Here's an example: I have a text field contains two rows with varrying amount of text, and our carat is at the end of the bottom line. My goal is to move the carat up to the end of the first line.

    Boop var = textSelect.text.length;

    Snoop var = boop;

    the arrow controls to move left and right

    function larw(event:MouseEvent):void

    {

    Snoop = 1;

    internship. Focus = Texteselectionnez;

    textSelect.setSelection (snoop, snoop);

    }

    function rarw(event:MouseEvent):void

    {

    Snoop += 1;

    internship. Focus = Texteselectionnez;

    textSelect.setSelection (snoop, snoop);

    }

    move up

    function uarw(event:MouseEvent):void

    {

    }

    find this position (at the help of maxScrollV and a loop) and reuse setSelection:

    var index: int = indexF(your_tf,1);  to find the end of line 1 in your_tf.  You may want some massage more if you do not want to choose a white space.

    your_tf.setSelection (index, index)

    do not change this feature:

    function indexF(tf:TextField,lineNumber:int):int {}

    var h:int = tf.height;

    TF. Height = 5;

    var s:String = tf.text;

    TF. Text = "";

    trace (TF.maxScrollV);

    for (var i: int = 0; i<>

    If (tf.maxScrollV<>

    tf.appendText (s.charAt (i));

    } else {}

    break;

    }

    }

    TF.text = s;

    TF. Height = h;

    Return i-1;

    }

  • How (re) move a tile?

    I could be just that I came across a bug real here.

    When tapping & holding a diamond, I can * sometimes * are able to move it around on the screen. But usually I can't get hold of any tile.

    When tapping & holding, the tile moves down and for a moment, and that's just it. After this, moving my finger right scrolls to the home screen. It seems that I can get a tile to move more easily in the first up and down, but it must pass my finger almost to the top or the bottom of the screen before its elastic invisible snaps and it begins after my finger.

    Also, I don't understand where to knock down to remove a tile. Largely used for Android, I'm expecting a trash or something appears, knock on.

    I used Windows 8 on a normal computer, using a mouse and then I can just right click and then click on delete (which is completely at the bottom of the screen, strangely). Yet once the mouse to move a tile, click on & drag ALWAYS works, what is good. But it's not the same for the touchscreen, or Windows RT.

    BTW, I use the Surface RT (should work, right?) without the flap of the keyboard.

    The best way to remove a tile is to right click on the window until the menu appears. Click then on "delete from the beginning."

    To move a tile, place your cursor on the tile, press / hold down the button to click left and do drag the tile to the chosen location.

  • Put a layer on the Web - design Tile map

    I want to make sure a layer will be above the card when its drawn.

    I want a layer on it, cause im making a menu for the game, but the game is above the layer.


    var tiles: Object = new Object ({width: 52, size: 26}); The size of the tile "tired." Tiles can be of different sizes, to give the "3-d".
    var offset: Object = new Object ({x: 130, y:100});}) This object allows to center the "hero" of the scene.
    hero of the var: Object = new Object ({x: 1, y:5});}) The starting position of the "hero".
    var canvas: Object = new Object ({mc:_root.createEmptyMovieClip ("canvas", _root.getNextHighestDepth ())}); Contains the information of clip and the map of the main movie.

    Canvas.map = new Array (/ / dictates the topography of the environment)
    The reason why I decided to use 200 for walls and 100 for ground must leave
    Open the option add more tiles, such as 86 for another type of tile that is
    within walking distance. Given that the collision detection code checks if the slab is
    less than 200 then (less is within walking distance, 200 or above is not), there is no need to change
    the tiles again toenable code, simply their name a number between 0 and 200.
    new Array (200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200),
    new Array (200,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,200),
    new Array (200,100,100,100,100,100,100,100,100,100,100,100,193,196,196,196,196,189,100,200),
    new Array (200,100,100,100,100,100,100,100,100,100,100,100,194,187,182,182,179,190,100,200),
    new Array (200,100,100,199,199,199,199,199,199,199,199,199,199,186,183,183,180,190,100,200),
    new Array (201,199,199,199,100,100,100,100,100,100,100,100,194,186,183,183,180,190,100,200),
    new Array (200,100,100,100,100,100,100,100,100,100,100,100,194,186,183,183,180,190,100,200),
    new Array (200,100,100,100,100,100,100,100,100,100,100,100,194,186,183,183,180,190,100,200),
    new Array (200,100,100,100,100,100,100,100,100,100,100,100,194,185,181,181,178,190,100,200),
    new Array (200,100,100,100,100,100,100,100,100,100,100,100,192,195,195,195,195,188,100,200),
    new Array (200,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,200),
    new Array (200,100,100,100,100,100,200,200,200,200,200,200,200,200,200,200,200,200,200,200),
    new Array (200,200,200,200,200,200,200)
    );

    _root. OnLoad = function (): Void
    {
    InitMap (Canvas.Map); Draw the card
    initplayer(); Attract the player

    return;

    };

    _root.onEnterFrame = function (): Void
    {
    Input(); The keyboard move handle

    return;

    };

    input function (): Void / / modifies the object of 'Hero', manages the collision detection ('Hero' and the wall)
    {
    No matter what tile under 200 and is within walking distance, all the foregoing is not.
    No need to change this code manages more tiles, just name the tiles a number.
    (not the best way to do this but simple, quick and easy to do)
    If (Key.isDown (Key.Left) & & canvas.map [hero.y - 1] [hero.x] < 200) hero.y -;
    another if (Key.isDown (Key.RIGHT) & & canvas.map [hero.y + 1] [hero.x] < 200) hero.y ++;
    another if (Key.isDown (Key.UP) & & canvas.map [hero.y] [hero.x - 1] < 200) hero.x -;
    another if (Key.isDown (Key.DOWN) & & canvas.map [hero.y] [hero.x + 1] < 200) hero.x ++;

    Move();

    return;

    };

    function move (): Void / / move the bottom and the hero
    {
    These three lines manage exchanging the depths of the tile to give the "3D" effect
    var d: Number = (hero.y * tiles.height) + (hero.x * tiles.width) + hero.y;
    hero.mc.swapDepths (d);
    Canvas.MC ["tile_" hero.y + '_' + hero.x "] .swapDepths (d - 1);

    Move the hero in the opposite direction, as the environment moves
    Hero.MC._x = (tiles.width / 2) * (hero.y - hero.x) + offset.x;
    Hero.MC._y = (tiles.height / 2) * (hero.y + hero.x) + offset.y;

    Move the environment
    Canvas.MC._x = (tiles.width / 2) * (- hero.y - hero.x) + offset.x;
    Canvas.MC._y = (tiles.height / 2) * (- hero.y + - hero.x) + offset.y;

    return;

    };

    function initplayer (): Void / / Self-expalanatory
    {
    var d: Number = (hero.y * tiles.height) + (hero.x * tiles.width) + hero.y;

    Hero.MC = canvas.mc.attachMovie ("hero", "hero_mc", d + 1, {_x:hero.x * tiles.width, _y:hero.y * tiles.height});

    Move();

    return;

    };

    function initmap(map:Array):Void / / map rendering
    {
    var map_height:Number = map.length; Determine the height of the map
    var map_width:Number = card [0] .length; Determine the width of the map

    for (var y = 0; y < map_height; y ++)
    {
    for (var x = 0; x < map_width; x ++)
    {
    MovieClip depth is all that when you make an isometric game
    var depth: Number = (y * tiles.height) + (x * tiles.width) + y;

    Attach the tile to the "Web".
    var tile: MovieClip = canvas.mc.attachMovie ("tile" + map [y] [x], "tile_" + y + "_" + x, depth);

    Tile._x = (tiles.width / 2) * (y - x) + offset.x;
    Tile._y = (tiles.height / 2) * (y + x) + offset.y;

    };

    };

    return;

    };

    When your fla is published (or tested), there is no layers.  all displayobjects receive depths based on the code used to assign depths and code of the compiler which attributes from the depths to the objects that put you on the stage in the authoring environment.

    all objects placed on the stage in the authoring environment are placed at depths of negative from about of-16, 380.   That's why your menu (which is probably added to a layer in the authoring environment is below the movieclip you place to nextHighestDepth() (which adds to no less than zero depth))

    to change a movieclip depth use the method swapDepths() of movieclips.

  • How to change the new tab Page in the menu of tiles?

    I want tiles on my new page tabs instead of page white or any other search engine. Help, please

    "Out of the box", new Firefox tab page shows tiles, based on your history, and you can replace with other sites if you wish.

    Here's how you can change your new tab page:

    (1) in a new tab, type or paste Subject: config in the address bar and press ENTER. Click on the button promising to be careful.

    (2) in the search above the list box, type or paste newtab and make a pause so that the list is filtered

    (3) double-click the preference browser.newtab.url and enter your favorite page:

    • (Default) page thumbnails = > subject: newtab
    • Blank tab = > subject: empty
    • Built-in Firefox homepage = > topic: welcome
    • Any other page = > full URL of the page

    Press Ctrl + t to open a new tab and check that it worked. Fixed?

    The new integrated tab page, the "gear" icon should provide both classic and enhanced, that show tiles.

    If the problems persist, some potential diagnoses and remedies:

    If Firefox will not let you change this setting: you can have what is called SearchProtect on your system. This must be removed the control panel.

    Firefox if allows you to save your changes, but he doesn't know: one of your extensions may be the substitution of her. You can consult, disable and/or remove extensions on page modules. Either:

    • CTRL + SHIFT + a
    • "3-bar" menu button (or tools) > Add-ons

    In the left column, click Extensions. Then, take a critical look on the list on the right and turn off (or remove) something unknown.

    If the modification works during your session, but during the next startup is return to the unwanted page: you could have a user.js file in your personal settings Firefox (your Firefox profile folder). This article describes how to track down and delete the file: How to fix preferences that will not save.

    A little luck?

  • How can I move Flash CS6 from an old computer to a new one?

    I installed CC and CS6 on my computer when it was introduced years ago. Now, I need to upgrade to a new computer. The CC on the new computer does not support Flash CS6 display. I need AS2 since I created a lot of apps with it for my clients and must continue to support them. I don't want to move to AS3 because I have too many legacy applications to.

    How it installs Flash CS6 on my new computer, so I can remove my old and get rid of it?

    Thank you!

    You can install Flash CS6 on your new machine with your creative cloud subscription.

    Sign in using your Adobe ID on the page https://creative.adobe.com/products/flash. You can then toggle CC to CS6 version and click on the blue Download button. This will make the creative cloud app download and install the version of CS6.

  • Stop(); Action does not work in AS3?

    I am a designer and usually work in AS2.

    But I created a movie in as3 (to use the function of the BONE), and now my actions to stop do not work.

    What I usually do for my movies, it's breaking down the film in some parts of the main timeline (content, start, end), place stops on each of these frameworks.

    And in the clips that play on these labels, I put a call:

    Stop();

    _root.gotoAndPlay ('content') etc...

    in any case none fixed this in AS3?

    I use CS4 if it matters.

    The stop() command works as well in AS3 as it does in AS1/2.  What does work is to use AS2 terms such as "_root".  In general, if a stop() command does not is because another code's fault or otherwise of the substitution of the stop().

  • Unable to see the video content on the keyframe in concert at mode for AS3 Documents created in CS5

    Using CS5 I encounter a weird bug trying to 'author' as3 documents in cs5.

    For some strange reason, I am unable to 'visually' see anything either shot or dragged from the library to the stage in design mode. However I was able to observe that the timeline seems to indicate that something does not exist on a keyframe. I also see when I test the movie. Note that this happens for only AS3 files version / documents (not the .AS files)

    I however visually see whats on stage if I create a file as2 or convert as2 documents said a3 documents

    http://pastebin.com/0jRuPLm4

    the above output is automatically generated whenever I run a test of movies and as3 document regardless of its content

    What in the blazes is happening?

    I have the same problem!

    Remove the addon firebug flash (not disable but delete) and the error will be gone.

  • My Flash movie stops for no apparent reason.

    With the help of Flash Professional CS5. Publication of Flash Player 9 and ActionScript 3. I also tried to publish for Flash Player 8 and 10.  My film is made up of several short scenes and has minimal animation. It lasts for about 12 minutes and once published and he played stops in a scene, 2 minutes to the end, without apparent reason. There is no script in the entire film except a stop(); at the end. There are scenes with a lot more animation than it stops at. It stops there when I play the swf file on my local computer so when I publish online, it is not a problem of buffering. It happens on two different computers.  I have Flash Player 10 installed.  I deleted all of the scenes except the audo on the stage stop, and it freezes again.  I deleted the audio and the rest and it freezes again.  I'm on the trial of Flash; no limits the length of the movies?


    http://www.republiccapitalgroup.com/DEFA...

    The animation has more than 16,000 pictures in? If so, it is likely to be the cause of the gel. (And if it is 2 minutes, then I ask you do animation at 120 fps?) It's a little too high...)

    To resolve this problem, you may break your film in parts? You can, for example, split into 10 parts each with a minute and load the next film at the end of each part.

    To load movies with AS3, see:

    http://groups.Adobe.com/index.cfm?event=post.display&PostID=9501

  • Detect the loose groups in the tile game

    Hello world

    I wonder if someone can point me in the right direction on this...

    I have a set of tiles based on the Scrabble where tiles are placed on the Board... during the game tiles must all be in contact with, and there should be no group of tiles anywhere else on the Board...

    I can find the tiles off unique and check to surrounding tiles easily enough but how I'd go about checking if each tile is touching on a horizontal or vertical axis, and if there are loose groups of tiles on the Board?

    Thanks in advance

    Martin

    Solved, used a table with several dimensions.

  • Problem with AS3 &amp; quot; ExternalInterface.call("saveglobalscore",score) &amp; quot; in Internet Explorer

    Hello

    Explain how the page is set up:

    I have a HTML page with 2 different movies Flash AS3.

    The first flash movie is the main entertainment and is located in the middle of the screen with a large background image defined in the body of the HTML.

    The second flash movie spans 100% width/height of the size of the screen and acts as a black fade > invisible.

    What I'm doing:

    Once the second Flash animation has gone from black to invisible it calls a JavaScript function on the HTML page to hide the div element, the second flash movie is integrate in (it's like the first flash movie displays a set of input boxes, which the user must be able to type-which will not be able to click on if there is another flash animation that just overlap the first film).

    My initial solution:

    In the second Flash movie is the following code:

    ////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
    Stop();

    This will load the API needed to communicate with external entities
    to import flash.external.ExternalInterface;

    call the JavaScript function
    ExternalInterface.call("saveglobalscore",score) ('myJavaScriptFunction');
    ////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////

    .. .and it works fine in Mozilla Firefox/Safari. The actionscript code successfully the JavaScript function in the HTML page and this JavaScript function simply calls (to this poster from the scene an alert() message to show that it has been called successfully).

    Problem with IE:

    But, at the time when I try this in Internet Explorer, I get an alert() message but a JavaScript error message that says:

    ////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
    Code: Select all
    Line: 1
    Char: 106
    Error: 'null' is null or not an object
    Code: 0
    ////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////

    As you would expect I am totally confused as to what could be the problem.

    It's really urgent because it is a living project which must be completed immediately, any help you might have would be greatly appreciated!

    Kind regards

    Select this option.

    GWD salvation,

    Who did it! :)

    I applied the attribute id = "fTrans" to the tag and IE worked well.

    I disparage me my brain one, thank you very much!

    Kind regards
    Mark

  • Store properties dynamically according to the position

    Well, I created a tile based game, whenever I have move the character I want to store its direction on foot for example dirx = 1, diry = 0. The idea being that when my enemies reach a tile where the character was, it can load the directions and go the same way. How to associate the directions with the current tile?

    Something like this is my idea, but I don't know how to program in fact.

    private var giveTileDirections (): void

    {

    Xdir var = this.dirx;

    ydir var = this.diry;

    }

    Thanks in advance

    How do you write that code depends on what class the code is associated.  'This' is going to be identifying the subject of the class, which according to your description will be a tile, so if you want to assign management of another object (the character) then you want to target this character, not 'that'

    When you declare the function, you use the "word", not "var".

    When you declare variables, you must designate what class they are, and they must be declared outside the function if you intend that you get them out of the classroom.

    So the code might look something like this, but only you can figure out how you want to program it and what you really wanted for every single thing you did...

    public var xdir:int;

    public var ydir:int;

    private function giveTileDirections (): void

    {

    XDIR = character.dirx;

    ydir = character.diry;

    }

  • Repeat functions, will not change variable. Confused Reeeallly

    OK... So yes, I'm rehearsing a function that will essentially attachmovie on a 'field', an image based on the parameter.

    It's called AddID (i), and currently there are only 2 valid options, 0 and 1, showing the images, X and O.

    There is a button and theres a table and a function that shows a picture of the tile based on its ID value loaded from the table.

    My problem is:

    Everything works just great as if you repeat the function by clicking again, but...

    When we repeat the code function, all the tiles will be the Image of the last tile added.

    It's my script actionscript code.

    IDonTile = new Array();

    IDonTile = [0,0,1,0,0,1];

    _Global. Tile = 0;

    And that's my buttoncode.

    {We (Release)}
    AddID (IDonTile [_global. Tile]);                 This function adds the tile on my screen
    TileList.Text += TileSlot [_global. Tile];         It's actually a textfield debug to see what value is supposed to be responsible

    _Global. Tile += 1;                                    Therefore, the next time that the slab is added, the following value will be used as an identifier.

    }

    It works very well!

    If I click on this button 6 times, I'll have in the following order: X, X, O, X, X, O

    The debugging text field displays: 0,0,1,0,0,1

    BUT

    I want to add all 6 tiles instantly, I would just use the function in a loop for, or repeat 6 times, the code like this:

    {We (Release)}

    for (i = 0; i < 5; i ++) {}
    AddID (IDonTile [_global. Tile]);                 This function adds the tile on my screen
    TileList.Text += TileSlot [_global. Tile];         It's actually a textfield debug to see what value is supposed to be responsible

    _Global. Tile += 1;                                    Therefore, the next time that the slab is added, the following value will be used as an identifier.

    }

    }

    Text field to debug the poster: 0,0,1,0,0,1

    Which is in fact correct

    BUT ALL 6 TILES WILL BE: O, O, O, O, O, O

    It is 6 O

    AddID (i) function is only 10 lines long.

    I don't want to manually add my 6 windows, what should I do if I had 100 tiles

    I was wondering, is there something wrong on Actionscript 2?

    Should I switch to Actionscript 3 maybe this will work?

    Because if I can manually click on the button, and it works, it must be exactly the same if I have the Correct code by a loop of foor?

    I'm reaaaallly confuseddd T, T he shouldn't BAA like this

    Help, please!

    I thanks in advance for any response...

    Cause the last time I tried to ask for help, I had no...

    Here's a solution... If I have the function of rewriting and eliminate the use of the binding of the tile, it works.

    function AddID (iID) {}
    If (tiles<>
    {Switch (IID)}
    case 0:
    attachMovie ("X", "Tile", tilelayer, {+(iconwidth*tX), _y:ky+(iconheight*tY)}) _x:kx;})
    break;
    case 1:
    attachMovie ("O", "Tile", tilelayer, {+(iconwidth*tX), _y:ky+(iconheight*tY)}) _x:kx;})
    break;
    }
    addTile();
    }
    {if(Tiles==tilesets)}
    MsgBox.text = "You have nowhere to store. »
    }
    }

    If for some reason that is not desirable, then here's an alternative.  I think I've narrowed the problem to be one of the timing... something in the loop cannot react quickly enough to changing _global. Value of the tile and I suspect it's the attachMovie activity.  This solution involves slowing the speed at which the file is trying to reach movies...  The button that launches adding tiles place the following...

    {We (Release)}
    myInterval = setInterval (fillTiles, 10);
    }

    And in the code of the timeline, add the following...

    var myInterval;

    function fillTiles() {}
    If (_Global. Tile<>
    AddID (IDonTile [_global. Tile]);
    TileList.Text += IDonTile [_global. Tile]
    _Global. Tile += 1;
    } else {}
    clearInterval (myInterval);
    }
    }

  • limit the area of circulation MC

    I have a MC tank, then a background of tiles. Some of the areas on the scene (or tiles) I don't want the tank to be able to walk on. My first idea failed, that is:
    -put several MCs called Block1-7 on the stage where I really didn't float walk and then in my script of movement test any collision with one of the blocks and stop the movement. However this failed because it went so slow that flash couldn't handle.
    -My second attempt was to combine all the 'block' STM in a big clip the shape of the region, I wanted to unwalkable. It did not work because hitTest apparently through the bounding box and no where is the actual content of the clip. So the tank could never work because he was STILL inside the bounding box.

    So, how would limit the area that he could walk? Any ideas would be very appreciated. My code (which runs an enterframe by a white MC off the screen) is attached below.

    NOTE: the bottom, well made of tiles, is not created by actionscript
    NOTE ALSO: This isn't a game of tiles based with and map array, my character is more important than each tile so what im that is not an option
    What do you think?

    It's exactly what you're doing. you might knock block1, set your speed to zero and then continue to check the other blocks, repeatedly reset your speed. only the last block will have the desired effect.

    to remedy, if you hitTest() is set to true, use the break; to leave your loop hitTest() for.

Maybe you are looking for