We help IT Professionals succeed at work.
Get Started

access data from one component to other component in actionscript

royjayd
royjayd asked
on
348 Views
Last Modified: 2012-05-12
hi guys

I have two components.

TextareaComponent
DatagridComponent

public class TextareaComponent extends FormItem{
public function TextareaComponent()  {
super();
grid = new DatagridComponent(); 
this.textArea.addEventListener(flash.events.KeyboardEvent.KEY_UP,callPopulate);
}

private function callPopulate(event: flash.events.KeyboardEvent) : void {
if(grid != null && grid.lookupdataForFilter != null){
var lookupdata:ArrayCollection =  grid.lookupdataForFilter; //data from DatagridComponent 
	}	
}

Open in new window



public class DatagridComponent extends VBox  
{
[Bindable] public var lookupdataForFilter:ArrayCollection = new ArrayCollection();
public function DatagridComponent()
{
super();
Swiz.dispatchEvent(new GlobalScreenEvent(GlobalScreenEvent.POPULATE_LOOKUP));
}

[Mediate(event="GlobalScreenEvent.LOOKUP_RECEIVED", properties="data")]
public function populateLookUp( data:Object ):void{
lookupdataForFilter = data as ArrayCollection;  //contains the data
	}
} 
}

Open in new window


TextareaComponent   is rendered first
DatagridComponent  is rendered second.


My goal is to access lookupdataForFilter defined in the DatagridComponent  from my TextareaComponent
I have defined lookupdataForFilter  as bindable  
I put a breakpoint on this line >>lookupdataForFilter = data as ArrayCollection;  and i see the data.

but when KEY_UP event is invoked from  TextareaComponent  'grid.lookupdataForFilter' is empty.

any idea where i am going wrong?

thanks
 
Comment
Watch Question
Top Expert 2011
Commented:
This problem has been solved!
Unlock 1 Answer and 21 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE