Solved

setting priorities for listeners

Posted on 2011-09-07
5
219 Views
Last Modified: 2012-05-12
hi guys

I have my customgrid like this

public class CustomGrid extends VBox
{

private var id:String = "";
            
private function buildColumn(headers:Object,fields:Object):void{
dataGrid.addEventListener(flash.events.KeyboardEvent.KEY_UP,createAutoPopulate);
dataGrid.addEventListener(AdvancedDataGridEvent.ITEM_EDIT_END,itemEditEndHandler);
}

private function createAutoPopulate(event: flash.events.KeyboardEvent) : void {      
PopUpManager.addPopUp(tradeLookUp.dataGrid, this, false);      //show data
PopUpManager.centerPopUp(tradeLookUp.dataGrid);     //center popup
tradeLookUp.dataGrid.addEventListener(CheckBoxEvent.CHECKBOX_TOGGLED,populatedata);

}

private function itemEditEndHandler(event:AdvancedDataGridEvent):void{
if(event.currentTarget.columns[event.columnIndex].editable){
use 'id' here  
 }
}

private function  populatedata ( event:CheckBoxEvent ) : void {
id = event != null && event.data != null ? event.data.userId : "";
}

}

buildColumn()  is the first function which is called.

createAutoPopulate()  is second function which is called

itemEditEndHandler()  is the third function which is called

populatedata()  is the last function which is called


but the problem is i want populatedata() to be the third function which should be called and
itemEditEndHandler() should be called last.

from populatedata() i will have the 'id' which i can use in itemEditEndHandler().

any idea how i can set the priorities? i want populatedata()  to be called before itemEditEndHandler().

thnks
0
Comment
Question by:royjayd
  • 3
5 Comments
 
LVL 29

Accepted Solution

by:
dgofman earned 500 total points
ID: 36500654
royjayd,
The first problem you cannot use "id" variable name in AS classes because id already declared in UIComponent

Another problem I cannot create valid project using your custom class. Please can you attach a working example.
0
 

Author Comment

by:royjayd
ID: 36500680
>>Another problem I cannot create valid project using your custom class. Please can you attach a working example.

Its 600 lines of actionscript code, if i paste the whole thing you will get lost, thats why i pasted only what makes sense :)
0
 
LVL 29

Expert Comment

by:dgofman
ID: 36500812
you can attach files. look on the botton a "File" link
0
 
LVL 29

Expert Comment

by:dgofman
ID: 36500816
If you can attach a whole project it's better. Don't worry I can read any code
0
 
LVL 37

Expert Comment

by:zzynx
ID: 36527633
>> i want populatedata() to be the third function which should be called and itemEditEndHandler() should be called last.
Those methods will be called when the corresponding event is "seen" or "heard", so imo if you want the methods to be called in that specific order, you have to make sure that the events occur in that specific order. But I'm afraid that is somehting you don't control, do you?
Why is that specific order important to you? Maybe you have to rethink that...
0

Featured Post

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Deleting Objects in flex 1 369
Adobe license 6 270
parse string in as3 2 336
Flex Adobe Flex Connector for MS SQL Server - calling stored procedure with parameters 3 1,215
First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
An article on effective troubleshooting
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now