Dcoo

TransformManager and delate, checkHitAreare, iOS, air

Recommended Posts

I am trying to delete on drag and drop or intersect with checkHitAreare it dorset seem to work with TransformManager.   in my app i would like the user to be able to drag an item to a trashcan, the items are all objects that are in a TransformManager. is it possible to call same delete function that is used when desktop users hit the delete key?
 
 
 
stage.addEventListener(Event.ENTER_FRAME, checkHitAreare);
 
function checkHitAreare(evt:Event) {
    var currentMC:MovieClip;
    var removeMCs:Array = [];
    for(var i=0; i < stage.numChildren; i++){
     currentMC = MovieClip(stage.getChildAt(i));
        if (currentMC != this.recp_mc && this.recp_mc.hitTestObject(currentMC)) {
            removeMCs.push(currentMC);
        }
    }
    for(var j:int = 0 ; j < removeMCs.length;j++)
    {
      stage.removeChild(removeMCs[j]);
    }
 
}

Share this post


Link to post
Share on other sites

Hi Jack, is there an example of how to use deleteSelection() method ?

Share this post


Link to post
Share on other sites

yourTransformManager.deleteSelection(); 

  • Like 1

Share this post


Link to post
Share on other sites

Cool, thank you!

Share this post


Link to post
Share on other sites

Sorry, what if I have more that one TransformManager, but they have the same name? yourTransformManager.deleteSelection(); 

Share this post


Link to post
Share on other sites

That sounds like more of an issue in your own code and how you're handling variables, etc. To answer your question, it'd require digging into your file(s) and seeing how you're setting things up, what your variables are, etc. Unfortunately we just can't afford the time necessary to provide everyone with free general consulting services for their projects or general AS3 best practices, but we're happy to answer specific questions about TransformManager or any of our other products. 

Share this post


Link to post
Share on other sites

No problem, sound fair,  one question for you then, in this code is my TransformManager named "manager" ? or does it get a name programmatically?

 

 

 var manager:TransformManager = new TransformManager({targetObjects:[deco127],constrainScale:true,forceSelectionToFront:true,allowDelete:true,autoDeselect:true,handleSize:29});

Share this post


Link to post
Share on other sites

Well, TransformManager instances don't have a "name" property (if that's what you're asking), but your code is assigning a TransformManager instance to a variable that's named "manager". You could name that variable whatever you want. 

Share this post


Link to post
Share on other sites

so using deleteSelection() method. if I want to call yourTransformManager.deleteSelection(); 

should be written like this? manager.deleteSelection(); 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.