Jump to content
Search Community

select event should dispatch after deselect

jankrut
Moderator Tag

Recommended Posts

Posted

i have two instance of transform manager ex. t1 & t1, both have 2-3 transform item, t1 has a1 & b1 while t2 has a2 & b2, when i select a1 it dispatch select event, now when i click on a2 it dispatch select event of a2 and then dispatch deselect event of a1. but i need that it should dispatch deselect event first before select event.

please help!!!!

Thanks in advance,

Posted

Yes, each manager must juggle its selections internally and within a TransformManager, deselect events are indeed dispatched before select events. But if you have multiple TransformManager instances, each one will perform deselect/select routines independently (as you discovered). If your goal is to run code after all the TransformManager instances are done with their deselect/select events, you could just add a CLICK listener to the stage and run some conditional logic in that, kinda like:

 

var selectionChanged:Boolean;
manager1.addEventListener(TransformEvent.SELECTION_CHANGE, onSelectionChange);
manager2.addEventListener(TransformEvent.SELECTION_CHANGE, onSelectionChange);
this.stage.addEventListener(MouseEvent.CLICK, onStageClick);

function onSelectionChange(event:TransformEvent):void {
   selectionChanged = true;
}

function onStageClick(event:Event):void {
   if (selectionChanged) {
       //put your code here...
       selectionChanged = false;
   }
}

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.
×
×
  • Create New...