PDA

View Full Version : reading values from ADG to a popup


raffialexanian
01-13-2009, 07:25 AM
Dear fellow scripters;

My main MXML calls a tilewindow as a pop, the tile window has an ADG that grabs all the query made in the main mxml and is launched when the user clicks "search". The ADG holds 11 fields, and 7 of them are set to invisible. When the user doubles clicks any of the items in the ADG, a second tilewindow popup appears and displays all 11 items, but not in an ADG format. Just plain text labels with IDs, so I wanna pass the data from the ADG to the second tile window. And thats when all hell breaks loose, I just cant seem to do it. I declare an obj variable and try to pass the adgID.selecteditem to obj, but then the search wont even popup. Please see code blelow, many thanks in advance for any help.

var obj:Object;


private function showSelectedPropertyDetails():void
{
obj = adg1.selectedItem;
realEstateWindow = new realEstateDetailsPopUpWindow();
PopUpManager.addPopUp(realEstateWindow,this, true);
realEstateWindow.SectorID.text = obj.toString();
realEstateWindow.addEventListener("OK",closeHandler);
realEstateWindow.x=200;
realEstateWindow.y=100;
}

]]>


</mx:Script>
<mx:Text width="680" height="36" text="All results currently displayed are fictitious and are for testing purposes. Accurate results will be available on January 12th 2009.&#xa;Double click for property details. Maximum of 500 results are only displayed."/>
<mx:AdvancedDataGrid id="adg1"
dataProvider="{Application.application.queryTask2.executeLastRes ult.attributes}"
designViewDataType="tree" width="100%" height="100%" mouseUp="zoom();"
borderThickness="4" backgroundColor="#0D0101" styleName="advancedDGrid"
itemDoubleClick="showSelectedPropertyDetails()" doubleClickEnabled="true" buttonMode="true">
<mx:columns>
<mx:AdvancedDataGridColumn visible="false" headerText="Parcel ID" dataField="Parcel_ID" id="ParcelIDid" />
<mx:AdvancedDataGridColumn headerText="Sector" dataField="Sector"/>
<mx:AdvancedDataGridColumn headerText="City" dataField="City"/>
<mx:AdvancedDataGridColumn headerText="Type" dataField="PType"/>
<mx:AdvancedDataGridColumn headerText="Purpose" dataField="PPurpose"/>
<mx:AdvancedDataGridColumn headerText="Price" dataField="Price"/>
<mx:AdvancedDataGridColumn headerText="Last Name" dataField="LName"/>
<mx:AdvancedDataGridColumn headerText="First Name" dataField="FName" />
<mx:AdvancedDataGridColumn headerText="Mobile Phone" dataField="MPhone" />
<mx:AdvancedDataGridColumn headerText="Office Name" dataField="OPhone" />
<mx:AdvancedDataGridColumn headerText="Email" dataField="Email" />
<mx:AdvancedDataGridColumn headerText="Description" dataField="PDescription" />

</mx:columns>
</mx:AdvancedDataGrid>

wvxvw
01-13-2009, 07:34 AM
Sorry, I don't have Flex Data Visualization Components lib, so, I can't tell how would you do it with ADG for sure. What I'm sure of is that:
PopUpManager.addPopUp(realEstateWindow,this, true);
is wrong, and it should be:
PopUpManager.addPopUp(<where you want to create a popup>,
<the class of the popup>, true);
Also, it's not a smart planning when you have one visual component passing data to another. It would be much better if those two components ware sharing access to the same data source.

raffialexanian
01-13-2009, 07:52 AM
Hello, thanks for replying, your second solution is what I opted for at the beggining, but I couldnt gather the selectedItem from the ADG and the data from the query to do that...any ideas how pls?

wvxvw
01-13-2009, 09:28 AM
Id do something similar to JS: let the realEstateWindow class have a caller property, populate it on after a PopUpManager.addPopUp() call with the reference to the calling object, which will expose some method to grab that selectedItem, maybe by implementing some ICallerThatHasSelectedItem interface, and after the caller property of the realEstateWindow class is set - will populate it's view with the data from the caller, which would be accessible through some sort of ICallerThatHasSelectedItem.getThatSelectedItm() method...

raffialexanian
01-14-2009, 10:15 AM
Thanks again for replying, but I am really new to AS3, so couldnt translate your suggestions to actual code. Thanks anyways.

wvxvw
01-14-2009, 11:24 AM
<?xml version="1.0" encoding="utf-8"?>
<!-- ADGTest.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
implements="ICaller">
<mx:Script>
<![CDATA[
import mx.core.IFlexDisplayObject;
import mx.managers.PopUpManager;
import RealEstatePopup;

private function showSelectedPropertyDetails():void
{
var obj:XML = adg1.selectedItem as XML;
var popup:IFlexDisplayObject;
popup = PopUpManager.createPopUp(this, RealEstatePopup, true);
(popup as RealEstatePopup).caller = this;
PopUpManager.centerPopUp(popup);
}

public function get adgDataProvider():Object
{
return providerList;
}

public function get selectedADGItem():Object
{
return adg1.selectedItem;
}
]]>
</mx:Script>
<mx:String id="infoStr"><![CDATA[All results currently displayed are fictitious
and are for testing purposes. Accurate results will be available on
January 12th 2009. Double click for property details. Maximum of
500 results are only displayed.]]></mx:String>

<mx:XMLList id="providerList">
<node>
<Parcel_ID>0</Parcel_ID>
<Sector>querty</Sector>
<City>querty</City>
<PType>querty</PType>
<PPurpose>querty</PPurpose>
<Price>querty</Price>
<LName>querty</LName>
<FName>querty</FName>
<MPhone>querty</MPhone>
<OPhone>querty</OPhone>
<Email>querty</Email>
<PDescription>querty</PDescription>
</node>
<node>
<Parcel_ID>1</Parcel_ID>
<Sector>abcd</Sector>
<City>abcd</City>
<PType>abcd</PType>
<PPurpose>abcd</PPurpose>
<Price>abcd</Price>
<LName>abcd</LName>
<FName>abcd</FName>
<MPhone>abcd</MPhone>
<OPhone>abcd</OPhone>
<Email>abcd</Email>
<PDescription>abcd</PDescription>
</node>
</mx:XMLList>

<mx:Text width="680" height="36"
htmlText="{infoStr}" condenseWhite="true" />

<mx:AdvancedDataGrid id="adg1"
dataProvider="{providerList}"
designViewDataType="tree" width="100%" height="100%"
borderThickness="4" backgroundColor="#0D0101"
itemDoubleClick="showSelectedPropertyDetails()"
doubleClickEnabled="true"
buttonMode="true">

<mx:columns>
<mx:AdvancedDataGridColumn visible="false"
headerText="Parcel ID"
dataField="Parcel_ID" id="ParcelIDid" />
<mx:AdvancedDataGridColumn headerText="Sector"
dataField="Sector" />
<mx:AdvancedDataGridColumn headerText="City"
dataField="City" />
<mx:AdvancedDataGridColumn headerText="Type"
dataField="PType" />
<mx:AdvancedDataGridColumn headerText="Purpose"
dataField="PPurpose" />
<mx:AdvancedDataGridColumn headerText="Price"
dataField="Price" />
<mx:AdvancedDataGridColumn headerText="Last Name"
dataField="LName"/>
<mx:AdvancedDataGridColumn headerText="First Name"
dataField="FName" />
<mx:AdvancedDataGridColumn headerText="Mobile Phone"
dataField="MPhone" />
<mx:AdvancedDataGridColumn headerText="Office Name"
dataField="OPhone" />
<mx:AdvancedDataGridColumn headerText="Email"
dataField="Email" />
<mx:AdvancedDataGridColumn headerText="Description"
dataField="PDescription" />
</mx:columns>

</mx:AdvancedDataGrid>
</mx:Application>
package
{

/**
* ICaller interface.
* @author wvxvw
* @langVersion 3.0
* @playerVersion 10.0.12.36
*/
public interface ICaller
{

function get adgDataProvider():Object;
function get selectedADGItem():Object;

}

}
<?xml version="1.0" encoding="utf-8"?>
<!-- RealEstatePopup.mxml -->
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import ICaller;
import mx.managers.PopUpManager;

[Bindable]
protected var populateMe:XML;

protected var _caller:ICaller;

public function set caller(value:ICaller):void
{
if (_caller == value) return;
_caller = value;
populateMe = value.selectedADGItem as XML;
}

protected function clickHandler():void
{
_caller = null;
populateMe = null;
PopUpManager.removePopUp(this);
}

]]>
</mx:Script>
<mx:VBox horizontalAlign="center">
<mx:DataGrid dataProvider="{populateMe}">
<mx:columns>
<mx:DataGridColumn visible="false"
headerText="Parcel ID"
dataField="Parcel_ID" id="ParcelIDid" />
<mx:DataGridColumn headerText="Sector"
dataField="Sector" />
<mx:DataGridColumn headerText="City"
dataField="City" />
<mx:DataGridColumn headerText="Type"
dataField="PType" />
<mx:DataGridColumn headerText="Purpose"
dataField="PPurpose" />
<mx:DataGridColumn headerText="Price"
dataField="Price" />
<mx:DataGridColumn headerText="Last Name"
dataField="LName" />
<mx:DataGridColumn headerText="First Name"
dataField="FName" />
<mx:DataGridColumn headerText="Mobile Phone"
dataField="MPhone" />
<mx:DataGridColumn headerText="Office Name"
dataField="OPhone" />
<mx:DataGridColumn headerText="Email"
dataField="Email" />
<mx:DataGridColumn headerText="Description"
dataField="PDescription" />
</mx:columns>
</mx:DataGrid>

<mx:Button label="Close" click="clickHandler()" />
</mx:VBox>

</mx:Panel>
I've got the trial version :p

raffialexanian
01-14-2009, 12:10 PM
I am speachless about the length you have gone to help a total stranger...THANK YOU SIR!! I am trying out the code now, and will post again when done..

raffialexanian
01-14-2009, 12:44 PM
Your code works perfectly. Can I replace all "XML" with "object"?
Cause my first ADG is populated by a query search through a REST service, as pasted below. One difference also is my second popup is not an ADG, its a tile window with just text with ID's that I would target to populate.

My main mxml as code for the query is below.
<mx:Script>
<![CDATA[
import com.esri.ags.tasks.QueryTask;
import com.esri.ags.tasks.Query;
var myQueryTask :QueryTask;

var landmarkResultWindow:LandmarkResultPopUpWindow;
var realEstateResultWindow:realEstateResultPopUpWindow ;


private function realEstateQuery():void
{
var realEstateCity:String;
var realEstateSector:String;
var realEstateFName:String;
var realEstateLName:String;
var realEstateOPhone:String;
var realEstateMPhone:String;
var realEstateEmail:String;
var realEstateType:String;
var realEstateKeywords:String;
var realEstatePurpose:String;
var realEstateDescription:String;

realEstateCity = "City'";
realEstateSector = "Sector'";
realEstateType = "PType'";
realEstatePurpose = "PPurpose'";
realEstateEmail = "Email'";
realEstateFName = "FName'";
realEstateLName = "LName'";
realEstateOPhone = "OPhone'";
realEstateMPhone = "MPhone'";
realEstateDescription = "PDescription'";
realEstateKeywords = "City'";

var whereString:String = "";

if (untiTypesComboBox.value.toString()!="All Types")
{

whereString += "PType='"+ untiTypesComboBox.value.toString()+"'";
}

if(realEstatePurposeComboBox.value.toString()!="All Purposes")

{
if (whereString == "")
{
whereString += "PPurpose='"+ realEstatePurposeComboBox.value.toString()+"'";
}
else if (whereString != "")
{

whereString += "AND PPurpose='"+ realEstatePurposeComboBox.value.toString()+"'";
}
}

if (citiesComboBox.value.toString()!="All Cities")

{
if (whereString == "")
{
whereString +="City='"+ citiesComboBox.value.toString()+"'";
}
else if (whereString != "")
{
whereString +="AND City='"+ citiesComboBox.value.toString()+"'";
}

}

if(sectorsComboBox.value.toString()!="All Sectors")
{
if (whereString == "")
{
whereString +="Sector='"+ sectorsComboBox.value.toString()+"'";
}
else if (whereString != "")
{
whereString +="AND Sector='"+ sectorsComboBox.value.toString()+"'";
}

}

if (whereString == "")
{
whereString += "PDescription like '%"+realEstateKeyWords.text+"%'";
}

else if (whereString != "")
{
whereString += "AND PDescription like '%"+realEstateKeyWords.text+"%'";
}



query2.where = whereString;

queryTask2.execute(query2);
realEstateResultWindow = new realEstateResultPopUpWindow();
PopUpManager.addPopUp(realEstateResultWindow, this, false);
realEstateResultWindow.addEventListener("close",closeHandler )
realEstateResultWindow.x=200;
realEstateResultWindow.y=100;
realEstateResultWindow.adg1.dataProvider = queryTask2.executeLastResult.attributes;
realEstateResultWindow.adg1.visible = true;

}

Below is the code for the first popup with the ADG:

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" title="Real Estate Search Results"
fontWeight="normal" xmlns:ns1="com.esri.ags.controls.navigationClasses.*" xmlns:ns2="com.esri.ags.*"
xmlns:ns3="com.esri.ags.controls.*"
xmlns:esri="http://www.esri.com/2008/ags"
height="514"
verticalScrollPolicy="auto" focusEnabled="true" styleName="redBorderUndockPanel" borderColor="#FC0202"
cornerRadius="20" color="#FC0101">
<mx:Style source="Voda_css.css"/>
<mx:Metadata>
[Event(name="ok", type="flash.events.Event")]
</mx:Metadata>

<mx:Script>

<![CDATA[

import mx.collections.ArrayCollection;
import com.esri.ags.tasks.QueryTask;
import com.esri.ags.geometry.Multipoint;
import com.esri.ags.events.ZoomEvent;
import com.esri.ags.geometry.Geometry;
import com.esri.ags.Graphic;
import com.esri.ags.events.FindEvent;
import mx.core.Application;
import mx.managers.PopUpManager;
import mx.controls.Alert;
import com.esri.ags.geometry.Extent;
import com.esri.ags.geometry.Polygon;
import com.esri.ags.geometry.Polyline;
import com.esri.ags.geometry.MapPoint;
import realEstateDetailsPopUpWindow;

private var realEstateWindow:realEstateDetailsPopUpWindow;
var event:com.esri.ags.events.FindEvent;

private function okClickHandler():void
{
var e:Event = new Event("close");
dispatchEvent(e);
}

var token:String = "";

private function getToken():String
{
return "Results For "+Application.application.fText.text;
}
private function closeHandler(event:Event):void
{

PopUpManager.removePopUp(realEstateWindow);


}

var obj:Object;


private function showSelectedPropertyDetails():void
{
obj = adg1.selectedItem;
realEstateWindow = new realEstateDetailsPopUpWindow();
PopUpManager.addPopUp(realEstateWindow,this, true);
realEstateWindow.SectorID.text = obj.ParcelIDid.toString();
realEstateWindow.addEventListener("OK",closeHandler);
realEstateWindow.x=200;
realEstateWindow.y=100;
}

]]>


</mx:Script>
<mx:Text width="680" height="36" text="All results currently displayed are fictitious and are for testing purposes. Accurate results will be available on January 12th 2009.&#xa;Double click for property details. Maximum of 500 results are only displayed."/>
<mx:AdvancedDataGrid id="adg1"
dataProvider="{Application.application.queryTask2.executeLastRes ult.attributes}"
designViewDataType="tree" width="100%" height="100%"
borderThickness="4" backgroundColor="#0D0101" styleName="advancedDGrid"
itemDoubleClick="showSelectedPropertyDetails()" doubleClickEnabled="true" buttonMode="true">
<mx:columns>
<mx:AdvancedDataGridColumn visible="false" headerText="Parcel ID" dataField="Parcel_ID" id="ParcelIDid" />
<mx:AdvancedDataGridColumn headerText="Sector" dataField="Sector" visible="false"/>
<mx:AdvancedDataGridColumn headerText="City" dataField="City"/>
<mx:AdvancedDataGridColumn headerText="Type" dataField="PType"/>
<mx:AdvancedDataGridColumn headerText="Purpose" dataField="PPurpose"/>
<mx:AdvancedDataGridColumn headerText="Price" dataField="Price"/>
<mx:AdvancedDataGridColumn headerText="Last Name" dataField="LName" visible="false"/>
<mx:AdvancedDataGridColumn headerText="First Name" dataField="FName" visible="false" />
<mx:AdvancedDataGridColumn headerText="Mobile Phone" dataField="MPhone" visible="false" />
<mx:AdvancedDataGridColumn headerText="Office Name" dataField="OPhone" visible="false" />
<mx:AdvancedDataGridColumn headerText="Email" dataField="Email" visible="false"/>
<mx:AdvancedDataGridColumn headerText="Description" dataField="PDescription" visible="false"/>

</mx:columns>
</mx:AdvancedDataGrid>
<mx:ControlBar horizontalAlign="center" paddingTop="2" paddingBottom="2">
<mx:Button label="Close" color="#FEFEFE" themeColor="#FF0006" click="okClickHandler()" styleName="popUpQuickFind" buttonMode="true" focusEnabled="true"/>
</mx:ControlBar>
</mx:TitleWindow>

raffialexanian
01-14-2009, 12:46 PM
And finally this is the code of the second popup and is displayed when the user double clicks on any of the adg fields:

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" title="Real Estate / Property Details"
fontWeight="normal"
borderColor="#970101" backgroundColor="#010000" cornerRadius="10" width="700" height="600" borderStyle="solid"
roundedBottomCorners="true" color="#E90D02" verticalScrollPolicy="auto" focusEnabled="true" activate="init();">
<mx:Script>
<![CDATA[
import mx.managers.FocusManager;
import mx.core.Application;
import mx.managers.PopUpManager;
import mx.controls.Alert;

var xCoordinate:String;
var yCoordinate:String;

var ordersWindow:OrdersPopUpWindow;
var realWindow:OrdersPopUpWindow;



private function closeHandler(event:Event):void
{
PopUpManager.removePopUp(ordersWindow);
PopUpManager.removePopUp(realWindow);
}

private function okClickHandler():void
{
var e:Event = new Event("OK");
dispatchEvent(e);
}
]]>
</mx:Script>
<mx:Style source="Voda_css.css"/>
<mx:HBox width="100%">
<mx:Text text="This is a sample window with fictitious contents that illustrates representations of available properties for sale." color="#ECEAEA" fontWeight="bold" textDecoration="underline" fontSize="12" width="672"/>
</mx:HBox>
<mx:HBox width="100%" height="20">
<mx:Label text="Listing ID:" width="100" fontWeight="bold" color="#D7D6D6"/>
<mx:Text id="realEstateListinglID" selectable="false" height="100%" textAlign="left" width="100%" color="#D7D6D6" fontWeight="bold" text="521-0603"/>
</mx:HBox>


<mx:Metadata>
[Event(name="ok", type="flash.events.Event")]
</mx:Metadata>


<mx:VBox width="100%" verticalAlign="top" horizontalAlign="center" fontSize="12" fontWeight="bold" color="#FEFDFD" textDecoration="underline" borderColor="#EBEEF0" borderStyle="solid" borderThickness="2">
<mx:Label text="About the Owner / Submitter"/>
<mx:HBox width="100%" height="20" borderStyle="solid">
<mx:HBox width="50%">
<mx:Label text="Name:" width="94" fontWeight="bold" fontSize="10" textDecoration="normal"/>
<mx:Text id="firstNameTextID" selectable="false" height="100%" textAlign="left" width="100%" color="#E90D02" fontWeight="bold" text="Raffi Alexanian" fontSize="10" textDecoration="normal"/>
</mx:HBox>
<mx:HBox width="50%">
<mx:Label text="Email:" width="113" fontWeight="bold" fontSize="10" textDecoration="normal"/>
<mx:Text id="emailTextID" selectable="false" height="100%" textAlign="left" width="100%" color="#E90D02" fontWeight="bold" text="[email protected]" textDecoration="normal" fontStyle="normal" fontSize="10"/>
</mx:HBox>
</mx:HBox>
<mx:HBox width="100%" height="20" borderStyle="solid">
<mx:HBox width="50%">
<mx:Label text="Mobile Phone:" width="89" fontWeight="bold" textDecoration="normal" fontSize="10"/>
<mx:Text id="mobilePhoneTextID" selectable="false" height="100%" textAlign="left" width="100%" color="#E90D02" fontWeight="bold" text="+(20)18 517 1817" textDecoration="normal" fontSize="10"/>
</mx:HBox>
<mx:HBox width="50%">
<mx:Label text="Office Phone:" width="112" fontWeight="bold" fontSize="10" textDecoration="normal"/>
<mx:Text id="officePhoneTextID" selectable="false" height="100%" textAlign="left" width="100%" color="#E90D02" fontWeight="bold" text="+(20) 2 2508 7941" fontSize="10" textDecoration="normal"/>
</mx:HBox>
</mx:HBox>
</mx:VBox>
<mx:VBox width="100%" verticalAlign="top" horizontalAlign="center" fontSize="12" fontWeight="bold" color="#FEFDFD" textDecoration="underline" borderColor="#EBEEF0" borderStyle="solid" borderThickness="2">
<mx:Label text="About the Property/Real Estate"/>
<mx:HBox width="100%" height="20" borderStyle="solid">
<mx:HBox width="50%">
<mx:Label text="Sector:" width="99" fontWeight="bold" color="#D7D6D6" textDecoration="normal" fontSize="10"/>
<mx:Text id="SectorID" selectable="false" height="100%" textAlign="left" width="100%" color="#D7D6D6" fontWeight="bold" text="&#xa;" textDecoration="normal" fontSize="10"/>
</mx:HBox>
<mx:HBox width="50%">
<mx:Label text="City:" width="112" fontWeight="bold" color="#D7D6D6" textDecoration="normal" fontSize="10"/>
<mx:Text id="CityID" selectable="false" height="100%" textAlign="left" width="100%" color="#D7D6D6" fontWeight="bold" text="Cairo" textDecoration="normal" fontSize="10"/>
</mx:HBox>
</mx:HBox>
<mx:HBox width="100%" borderStyle="solid">
<mx:HBox width="50%">

<mx:Label text="Property Type:" width="98" fontWeight="bold" fontSize="10" textDecoration="normal"/>
<mx:Text id="propertyTypeTextID" selectable="false" height="100%" textAlign="left" width="216" color="#E90D02" fontWeight="bold" text="Appartment" fontSize="10" textDecoration="normal"/>
</mx:HBox>
<mx:HBox width="50%">

<mx:Label text="Property Purpose:" width="113" fontWeight="bold" fontSize="10" textDecoration="normal"/>
<mx:Text id="propertyPurposeTextID" selectable="false" height="100%" textAlign="left" width="109" color="#E90D02" fontWeight="bold" text="For Sale" textDecoration="normal" fontStyle="normal" fontSize="10"/>
</mx:HBox>
</mx:HBox>
<mx:HBox width="100%" borderStyle="solid">
<mx:HBox width="50%">

<mx:Label text="Price:" width="96" fontWeight="bold" fontSize="10" textDecoration="normal"/>
<mx:Text id="propertyPurposeTextID0" selectable="false" height="100%" textAlign="left" width="136" color="#E90D02" fontWeight="bold" text="1200 EGP per month" textDecoration="normal" fontStyle="normal" fontSize="10"/>
</mx:HBox>
<mx:HBox width="50%">
<mx:Label text="Property Address:" width="113" fontWeight="bold" fontSize="10" textDecoration="normal"/>
<mx:Text id="propertyAddressTextID" selectable="false" height="100%" textAlign="left" width="207" color="#E90D02" fontWeight="bold" text="Nasr City, Mayo Buildings" textDecoration="normal" fontStyle="normal" fontSize="10"/>
</mx:HBox>
</mx:HBox>

<mx:HBox width="100%" borderStyle="solid">
<mx:Label text="Description:" fontSize="10" textDecoration="normal"/>
</mx:HBox>
<mx:VBox width="100%">
<mx:Text text="A fantastic opportunity to rent an apartment in the heart of Nasr City. A large 145 square meter area, with two large balconies, and three bedrooms. New carpet was installed last week. One large bathroom, apartment is semi furnished with a new refrigerator, color TV, and working air-conditioning. 11th floor and building has four working elevators. Only serious enquiries please." textDecoration="normal" fontSize="10" width="625"/>
<mx:HBox width="100%">
<mx:Image width="60" height="40" source="images/2bedroom-apartment-thumb.jpg" buttonMode="true"/>
<mx:Image width="60" height="40" source="images/3bedroom-apartment-thumb.jpg" buttonMode="true"/>
<mx:Image width="60" height="40" buttonMode="true">
<mx:source>images/Seattle_-_Queen_Anne_High_apartment_kitchen-thumb.jpg</mx:source>
</mx:Image>
</mx:HBox>
</mx:VBox>
</mx:VBox>
<mx:ControlBar horizontalAlign="center">
<mx:Button id="ook" label="OK" color="#FEFEFE" themeColor="#FF0006" click="okClickHandler()" styleName="popUpQuickFind" buttonMode="true" focusEnabled="true" paddingTop="5"/>
</mx:ControlBar>
</mx:TitleWindow>

wvxvw
01-14-2009, 02:22 PM
Your code works perfectly. Can I replace all "XML" with "object"?
Cause my first ADG is populated by a query search through a REST service, as pasted below. One difference also is my second popup is not an ADG, its a tile window with just text with ID's that I would target to populate.
Yes, if you specify the receiving format as "Object" than it will be object.
BTW, you can use [ as ] [ /as ] BBcodes to format AS code or [ code ] [ /code ] or [ html ] [ /html ] etc for the code (w/o spaces). It is very difficult to read it in that quantities, if it's not formatted.

raffialexanian
01-14-2009, 02:41 PM
Ok, sorry about that, I can repost if you like
so how can I target the second window's text labels from the adg in the first popup window?

raffialexanian
01-14-2009, 02:57 PM
I found what was wrong in my code, I ahd to target items using the datafield from the ADG and not IDs as I was doing.
realEstateWindow.SectorID.text = obj.Parcel_ID.toString();

Your help is highly appreciatted.

raffialexanian
01-15-2009, 08:35 AM
one last thing please, this following code wont launch the search results (ADG in the first popup). I was trying to debug a null object reference, and all hell broke loose.

import com.esri.ags.tasks.QueryTask;
import com.esri.ags.tasks.Query;
import mx.rpc.AsyncResponder;
import com.esri.ags.tasks.FeatureSet;
import mx.controls.Alert;

var myQueryTask :QueryTask;

var landmarkResultWindow:LandmarkResultPopUpWindow;
var realEstateResultWindow:realEstateResultPopUpWindow ;


private function realEstateQuery():void

{
var realEstateCity:String;
var realEstateSector:String;
var realEstateFName:String;
var realEstateLName:String;
var realEstateOPhone:String;
var realEstateMPhone:String;
var realEstateEmail:String;
var realEstateType:String;
var realEstateKeywords:String;
var realEstatePurpose:String;
var realEstateDescription:String;

realEstateCity = "City'";
realEstateSector = "Sector'";
realEstateType = "PType'";
realEstatePurpose = "PPurpose'";
realEstateEmail = "Email'";
realEstateFName = "FName'";
realEstateLName = "LName'";
realEstateOPhone = "OPhone'";
realEstateMPhone = "MPhone'";
realEstateDescription = "PDescription'";
realEstateKeywords = "City'";

var whereString:String = "";

if (untiTypesComboBox.value.toString()!="All Types")
{

whereString += "PType='"+ untiTypesComboBox.value.toString()+"'";
}

if(realEstatePurposeComboBox.value.toString()!="All Purposes")

{
if (whereString == "")
{
whereString += "PPurpose='"+ realEstatePurposeComboBox.value.toString()+"'";
}
else if (whereString != "")
{

whereString += "AND PPurpose='"+ realEstatePurposeComboBox.value.toString()+"'";
}
}

if (citiesComboBox.value.toString()!="All Cities")

{
if (whereString == "")
{
whereString +="City='"+ citiesComboBox.value.toString()+"'";
}
else if (whereString != "")
{
whereString +="AND City='"+ citiesComboBox.value.toString()+"'";
}

}

if(sectorsComboBox.value.toString()!="All Sectors")
{
if (whereString == "")
{
whereString +="Sector='"+ sectorsComboBox.value.toString()+"'";
}
else if (whereString != "")
{
whereString +="AND Sector='"+ sectorsComboBox.value.toString()+"'";
}

}

if (whereString == "")
{
whereString += "PDescription like '%"+realEstateKeyWords.text+"%'";
}

else if (whereString != "")
{
whereString += "AND PDescription like '%"+realEstateKeyWords.text+"%'";
}
query2.where = whereString;
query, new AsyncResponder( onResult, onFault );
}



private function onFault( info : Object, token : Object = null ) : void
{
//if your cursor is busy during the execution, remove it here
this.cursorManager.removeBusyCursor();

Alert.show( info.toString() );
Alert.show("There was an error! Please, try again later!", "Error");
}
private function onResult(featureSet : FeatureSet, token : Object = null ) : void {

realEstateResultWindow = new realEstateResultPopUpWindow();
PopUpManager.addPopUp(realEstateResultWindow, this, false);
realEstateResultWindow.addEventListener("close",closeHandler )
realEstateResultWindow.x=200;
realEstateResultWindow.y=100;
realEstateResultWindow.adg1.dataProvider = featureSet.attributes;
realEstateResultWindow.adg1.visible = true;

}

raffialexanian
01-15-2009, 11:19 AM
Hello again :) I posted a last question, but I think I clicked reply to one of my eariler postings, could you please take a look at my posting before this one?
Many thanks

wvxvw
01-15-2009, 01:06 PM
Ok... where the error is coming from? I believe you're talking about onResult function, right?
So, this line is wrong, as it was wrong before:
PopUpManager.addPopUp(realEstateResultWindow, this, false);
first argument is the container that is asking for to create a popup, the second argument is the factory for creating the popup.
What is FeatureSet? How can you be sure the object to invoke onResult will be exactly of this type? Usually it's an untyped object which may be XML / array / text etc. but it's not of some custom type.

raffialexanian
01-16-2009, 07:36 AM
You're right, that line inside the onResult function was wrong, its now fixed, your help is very appreciatted :) Thanks!!