A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Problem with a function

  1. #1
    SnarfelGraph
    Join Date
    Jul 2004
    Location
    Egersund, Norway
    Posts
    5

    Problem with a function

    Hi all. This is actually in CS4, but that option was not there.

    I created a game years back, and it was published as Flash player 6.
    Now, i want to vamp it up a bit, and republish it.

    But when i publish it in Flash player 10 (also in 7, 8 and 9 actually) the beneath code does not work. I have googled high and low, but i just cant find why this is not working.

    This is a hittest against a movie with a maze. The maze is called myMap, and this is in the movie that calls the function. The hero should stop against the walls, but he just passes over them, not seeming to pick up on the bounds.


    Actionscript Code:
    s = 2;
        u = 2;
        b = this.getBounds(this);
        function move(x, y) {
            h = false;
            if (!_root.myMap.hitTest(_x+x+b.xmin, _y+y+b.ymin+5, true)) {
                if (!_root.myMap.hitTest(_x+x+b.xmax, _y+y+b.ymin+5, true)) {
                    if (!_root.myMap.hitTest(_x+x+b.xmin, _y+y+b.ymax-5, true)) {
                        if (!_root.myMap.hitTest(_x+x+b.xmax, _y+y+b.ymax-5, true)) {
                            _x += x;
                            _y += y;
                            h = true;
                        }
                    }
                }
            }
            return h;
        }
    }


    Anyone, please help!
    Look!! A banana !! Weeeee!

  2. #2
    Member Pepember
    Join Date
    Jul 2001
    Location
    Berlin
    Posts
    886
    hum, really I think that you should post a .fla for this sort of question, since it is really difficult to determine the cause of the problem by looking at your snippet of code.

    and before posting, you should trace out every relevant variable for yourself. I think that way you will probably be able to cut to the problem yourself.
    Please sign here

  3. #3
    SnarfelGraph
    Join Date
    Jul 2004
    Location
    Egersund, Norway
    Posts
    5

    Red face I am stoopid

    After hours of googlong and twisting my brains in ways i thought was not possible, i finally found the problem.

    I wrote ymin, xmin, ymax and xmax.
    They have to be yMin, xMin, yMax and xMax in flashplayer 7>

    Whowoodoffthunkit
    Look!! A banana !! Weeeee!

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