Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7914191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:01:48+00:00 2026-06-03T14:01:48+00:00

Currently i am now working on a drag drop application in pure action script

  • 0

Currently i am now working on a drag drop application in pure action script project. Now the problem i have is , I have some PNG bitmaps with some transparent background around it.The bitmap may collide each other.User may be able to drag any of these bitmap. if the user clicks on the transparent area , user should not be able drag and vice versa.which means user should be able to drag the top most bitmap ignoring the transparent bitmap..

Can anyone help on this.

Thanks and regards.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:01:49+00:00Added an answer on June 3, 2026 at 2:01 pm

    It is possible. you need to read more documentation about the possibilities of the AS.

    here is just a quick and dirty prove of concept:

    package
    {
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.DisplayObject;
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    import flash.geom.Point;
    
    /**
     * ...
     * @author Jevgenij Dmitrijev ( http://www.ifmi.lt )
     *
     */
    public class DragTransparentBitmaps extends Sprite
    {
        private var _dragMC:Sprite;
    
        public function DragTransparentBitmaps()
        {
            var sp:Sprite;
            var bmp:Bitmap;
    
            for (var i:uint; i < 10; ++i)
            {
                sp = new Sprite();
                sp.name = 'item_' + i.toString();
                bmp = new Bitmap(new Close()); // add your bitmapData
                sp.addChild(bmp);
                sp.x = 20*i;
                sp.y = 20*i;
                addChild(sp);
            }
    
            stage.addEventListener (MouseEvent.MOUSE_DOWN, handleMouseDown )
        }
    
        function handleMouseDown(e:MouseEvent):void
        {
            /*
    
            // OPTIONAL:
    
            // if you need the mouse to be in a specific region:            
            if ( mouseX > 400 || mouseY > 400 )
            {
                return;
            }
    
            // or you can just check if mouse is on your needed mc:
            if ( !someSprite.hitTestPoint(mouseX, mouseY) )
                return;
            */
    
    
            // cheking how much objects are under the mouse
            var objectsUnderMouse:Array = getObjectsUnderPoint (new Point (mouseX, mouseY));
    
            var length_i:uint = objectsUnderMouse.length;
    
            if ( length_i > 0 )
            {
                // if only one then no checking needed just parsing it to the drag function.
                if ( length_i == 1 )
                {
                    drag(objectsUnderMouse[0].parent);
                    return;
                }
            }
            else
                return; // if nothing under the mouse just end the function
    
            var sp:Sprite;
            var bmpData:BitmapData; 
    
            for (var i:uint; i < length_i; i++) 
            {
                // taking a sprite where bitmap is positioned
                sp = objectsUnderMouse[i].parent as Sprite;
    
                // taking the bitmap data
                bmpData = objectsUnderMouse[i].bitmapData;
    
                // taking the pixel information ( see the docu about it )
                // if the value is > 0 it means that the bitmap is not transparent and we can move it
                if ( bmpData.getPixel32(sp.mouseX, sp.mouseY ) > 0 )
                {
                    drag (objectsUnderMouse[i].parent);
                    return;
                }
            }
        }
    
        // just drag functions
        private function drag(value:DisplayObject):void 
        {
            _dragMC = value as Sprite;
            _dragMC.startDrag();
    
            stage.addEventListener (MouseEvent.MOUSE_UP, handleMouseUp);
        }
    
        private function handleMouseUp(e:MouseEvent):void 
        {
            stage.removeEventListener (MouseEvent.MOUSE_UP, handleMouseUp);
            _dragMC.stopDrag();
        }
    }
    }
    

    let me know if it was helpful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am now currently working on a grails project . I have a problem
I am currently working in this problem for hours now. I have to create
I'm currently working on web application using VB in ASP.NET. Right now I have
I'am currently working on GWTs Activity-Place implementation. Now I have found problem with the
I am working on a large application and am adding some drag/drop functionality to
Currently I am working on a cocos2d+Box2D project so I have deal with some
I have a problem with this script : click here . Currently it's working
I am currently working on kerberos, and for now have this doubt on PAC
I'm currently working on camstudio_cl (here if interested) . The problem now is that
I currently have something working where I can drag a box horizontally on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.