A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: [RESOLVED] [HELP] Make sure it is up?

  1. #1
    I'm not Crazy :D
    Join Date
    Nov 2015
    Location
    Brazil [<o>]
    Posts
    86

    resolved [RESOLVED] [HELP] Make sure it is up?

    Hello guys, how do I check if an object is on top of another?

  2. #2
    Tim (Super Moderator) Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    Use movieclip.getDepth() to get the depth and compare it to the depth of any other clip on the stage.

    See https://www.kirupa.com/developer/act...pt/depths2.htm for more information.
    When your swf2exe tool just HAS to work
    there's only one choice... SWF Studio

  3. #3
    Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    1,089
    sometimes getdepth wont work without this at the top:
    import mx.managers.DepthManager;
    I was born with a camera in my eyeball maybe

  4. #4
    I'm not Crazy :D
    Join Date
    Nov 2015
    Location
    Brazil [<o>]
    Posts
    86
    Hmm.. I will chek it, thank you guys.

  5. #5
    I'm not Crazy :D
    Join Date
    Nov 2015
    Location
    Brazil [<o>]
    Posts
    86
    Sorry for the spam, but, I dont understand how to compare the Depth of two objects. What I try is simple, check if the player is up of a ball, if this is true, enable a var and the function to enter in the tank when click the space key.

  6. #6
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,785
    Hi,

    You can try to get what you need from this.

    PHP Code:
    trace("Orignal Depths\nball: " ball.getDepth() + " \nplayer: " player.getDepth());

    function 
    newDepths():Void
    {
        
    ball.swapDepths(this.getNextHighestDepth());
        
    player.swapDepths(this.getNextHighestDepth());

        var 
    a:Number ball.getDepth();
        var 
    b:Number player.getDepth();

        
    trace("\n\nNew Depths\nball: " " \nplayer: " b);

        if (
    a)
        {
            
    trace("\nYou can now set your var");
        }
    }

    newDepths(); 

  7. #7
    I'm not Crazy :D
    Join Date
    Nov 2015
    Location
    Brazil [<o>]
    Posts
    86
    Hello guy, I test this code but dont work correctly. I want this:

    img_01.png
    img_02.png

    Understand?

  8. #8
    I'm not Crazy :D
    Join Date
    Nov 2015
    Location
    Brazil [<o>]
    Posts
    86

    resolved [SOLVED] [HELP] Check if we are standing?

    Man, I was working with the wrong code. The correct is use the hitTest function. Thanks anyway!

Tags for this Thread

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