A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Drag & Drop Game - 2 issues

  1. #1
    Member
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    40

    Drag & Drop Game - 2 issues

    I thought this was going to be easy (maybe it is) but it's been giving me grief.

    I've got a drag & drop game set up and working fine but there are two finer details eluding me. First is probably simple - I need to drop the item behind the target object. I've tried using z properties on both the target and the dropped object but it didn't seem to do anything (position.Z). Also tried just overlaying artwork on a layer on top of the artwork (I'm not dynamically adding the items to the stage) as well as by loading an overlay SWF above the main SWF (this actually disabled the target areas).

    Second is also likely simple. I need multiple items to share the same hitTargets. I can duplicate targets and put them one on top of each other but there must be a better way.

    Currently all items on stage are individually coded but I'm going to switch to arrays to hold the objects and an array to hold the targets (so I can create subsequent "levels" a bit easier).

    Forgive me if I don't "get" your answer - I'm new to AS3 (but strong with Flash) I'll be sure to research your responses before I come back with more questions. I'm sure this is simple.

  2. #2
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    It should be possible to place object behind target using something like:

    container.setChildIndex(dropping_object, container.getChildIndex(target_object));

    For basic explanation of display object containers, try this:

    http://help.adobe.com/en_US/as3/dev/...0204-7e36.html

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