Solved

pass object from one mxml to another

Posted on 2011-03-06
4
799 Views
Last Modified: 2012-05-11
hi guys

I have a very simple requirment but dont seem to find an answer on google.

main.mxml  has a button . when button is clicked a pop up displays. From my main.mxml i am passing a arraycollection which i want to display in the pop-up

main.mxml
<mx:script>
private function launchPopUp(e:MouseEvent,projectList:ArrayCollection):void {
var popupwindow : Window = new Window();   
PopUpManager.addPopUp(popupwindow,this,true);
PopUpManager.centerPopUp(popupwindow);
}
</mx:script>

<mx:Button id="button" label="show" click="launchPopUp(event,arrayCollection);"/>  //passing the arrayCollection

Open in new window


and this is Window.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
 width="650"
 height="250"  
itle="PopUp Window" horizontalAlign="center"
showCloseButton="true"	
close="closeWindow(event);" >
<mx:Script>
<![CDATA[
import mx.core.IFlexDisplayObject;
import mx.events.CloseEvent;
import mx.managers.PopUpManager;			
private function closeWindow(e:CloseEvent):void {
PopUpManager.removePopUp(e.target as IFlexDisplayObject);
}
]]>
</mx:Script>
<mx:Image source="assets/img.gif"/>	
<mx:DataGrid id="dataGrid" dataProvider="{arrayCollection}" width="182/>  //trying to get arrayCollection here
<mx:columns>
</mx:columns>
</mx:DataGrid>
	
</mx:TitleWindow>

Open in new window


 how can i get the 'arrayCollection'   in Window.mxml from main.mxml
Is this possible?

thanks for any help
0
Comment
Question by:royjayd
  • 2
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
deepanjandas earned 500 total points
ID: 35052214
Window.mxml - in the scripts tag add this line:
public var projectList:ArrayCollection;

Open in new window


main.mxml - pass the collection to the popup like this:
<mx:script>
private function launchPopUp(e:MouseEvent,projectList:ArrayCollection):void {
var popupwindow : Window = new Window();   
popupwindow.projectList = projectList;
PopUpManager.addPopUp(popupwindow,this,true);
PopUpManager.centerPopUp(popupwindow);
}
</mx:script>

<mx:Button id="button" label="show" click="launchPopUp(event,arrayCollection);"/>  //passing the arrayCollection

Open in new window


Warm Regards
Deepanjan Das
0
 

Author Comment

by:royjayd
ID: 35052973
hi thanks very much.

Is there anyway i can display the popup on the top-right section of screen.
Right now i have PopUpManager.centerPopUp(popupwindow);  
i removed that but how do i put it on the top-right just above the button?

thanks
0
 
LVL 17

Expert Comment

by:deepanjandas
ID: 35053366
set the x and y of popupwindow based on its size and stage size.

Warm Regards
Deepanjan Das
0
 

Author Comment

by:royjayd
ID: 35053409
thanks very much for help.

Any help with next question will be greatly appreciated
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/Flex/Q_26867115.html

thanks
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Flex Air Internet connectivity 5 547
AdvancedDataGrid 4 359
Converting PDF to SWF with video embedded 11 458
FLex Calendar 3 557
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…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

821 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