4 Replies Latest reply on Oct 28, 2009 4:48 PM by cyber0897

    need help with accessing popup variables in main application

    cyber0897 Level 1

      hey guys... im having some trouble accessing variables in the popup from the main application.

      I have gone over tons of links on google, and the one article on the adobe labs about passing variables between popups, but it dosent answer my question...


      what i basically need to happn is, i need to have access to the "dataToSave" variable in the itemDetail.mxml file.

      and the variable needs to come back only if none of the fields are blank.



      the code i have is


          public var win:itemDetails;
          public function itemClicking(event:Event):void{
              var temp:ImageData = event.target as ImageData;
              win = itemDetails(PopUpManager.createPopUp(this, itemDetails, true));
              win.title = "Enter Details";






      <?xml version="1.0" encoding="utf-8"?>
      <s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:mx="library://ns.adobe.com/flex/halo" width="800" height="600">
                  import mx.managers.PopUpManager;
                  import mx.controls.Alert;
                  import valueObjects.*;
                  public var dataToSave:ImageData;
                  private function windowClose(event:MouseEvent):void{
                  public function checkUploadDetails(event:Event):void{
                      if(confirmNoEmptyFields() == true){
                          dataToSave = new ImageData;
                          dataToSave.Description = description.text;
                          dataToSave.FileName = fileName.text;
                          dataToSave.Location = location.text;
                          dataToSave.Photographer = photographer.text;
                  public function confirmNoEmptyFields():Boolean{
                      if(description.text == ""){
                          Alert.show("Description is empty");
                          return false;
                      if(fileName.text == ""){
                          Alert.show("File Name is empty");
                          return false;
                      if(location.text == ""){
                          Alert.show("Location is empty");
                          return false;
                      if(photographer.text == ""){
                          Alert.show("Photographer is empty");
                          return false;
                      return true;
              <!-- Place non-visual elements (e.g., services, value objects) here -->
              <mx:Form id="uploadDetails" borderThickness="10">
                      <!--mx:Image id="img" scaleContent="true" width="250" height="250" /-->
                  <mx:FormItem label="Description:">
                      <s:TextArea id="description" width="100%" height="250" />
                  <mx:FormItem label="File Name:">
                      <s:TextInput id="fileName" width="100%" />
                  <mx:FormItem label="Location">
                      <s:TextInput id="location" width="100%" />
                  <mx:FormItem label="Photographer">
                      <s:TextInput id="photographer" width="100%" />
                      <mx:FormItem label="Thumbnail Scale X">
                          <s:TextInput id="thumbnailX" />
                      <mx:FormItem label="Thumbnail Scale Y">
                          <s:TextInput id="thumbnailY" />
                      <s:Button id="save" label="save" click="checkUploadDetails(event)" />
                      <s:Button id="cancel" label="Cancel" click="windowClose(event)" />


      Thank you soo much in advance!! i really appretiate your help!!