4 Replies Latest reply on Dec 2, 2008 9:14 PM by porchick

    Actionscript + Java popup window from XML

    porchick
      Im confused as to how I can achieve a pop up from Flash using my XML data.

      As it stands, my XML contains many URLs, so I have them launching in a new window because it is simple for now.

      But I need to have a javascript that will incorporate the nodes/URLs being pushed by my Actionscript. Its not just as simple as adding one URL address because it needs to load many. All scripts i have seen just handle single URL popups.

      I wish there was just ONE script for popups instead of multiple scripts for multiple pages!!!

      Ideas Anyone?


      See it live @ http://ainternationalwines.com and go to "Our Wines" tab and select a wine to view.


      ------>>>


      tn_group.tn._visible = false;
      tn_group.setMask( tn_group_area );
      var total:Number = filename_list.length;
      var distance_y:Number = tn_group.tn._height + 9;
      var current:Number = 0;
      var i:Number = 0;

      for( ; i < total; i++ )
      {
      tn_group.tn.duplicateMovieClip("tn"+i, i);
      tn_group["tn"+i].preloader._width = 0;
      tn_group["tn"+i].tn_button._visible = false;
      tn_group["tn"+i].txt = (i+1);
      tn_group["tn"+i].tn_no = i;
      tn_group["tn"+i]._y = i * distance_y;

      tn_group["tn"+i].fm_title.text = title_list ;
      tn_group["tn"+i].description.text = description_list
      ;
      tn_group["tn"+i].price.text = price_list ;
      tn_group["tn"+i].code.text = code_list
      ;

      tn_group["tn"+i].tn_button.onRollOver = function()
      {
      this._parent.txt = "view info";
      }
      tn_group["tn"+i].tn_button.onRollOut = function()
      {
      this._parent.txt = "";
      }
      tn_group["tn"+i].tn_button.onRelease = function()
      {
      getURL(url_list[this._parent.tn_no], "_blank");
      }
      }

        • 1. Actionscript + Java popup window from XML
          Devendran Level 1
          use FS Command to pass your Arguments to a javascript function.

          fscommand ("call_popup", pageUrl);
          or use

          getURL("javascript:call_popup('" + pageDetails +"' , '"+ arg2 +"')" )



          inside the JAVASCRIPT call popup.

          <SCRIPT LANGUAGE="JavaScript">
          <!--
          function myslash_DoFSCommand(command, args) {
          if (command == "call_popup") {
          window.open(args, 'popMe','directories=0,status=0,menubar=0,toolbar=0,scrollbars=1,resizable=no,copyhistory =no,width=6 30,height=450,top=200,left=200')
          }
          }
          //-->
          </SCRIPT>



          or use some external interface / JSFL_Helper component
          • 2. Actionscript + Java popup window from XML
            porchick Level 1
            Im not quite sure that your idea will work for my code. You see, it needs to get the URL from the url_list that I had defined previously. getURL(url_list[this._parent.tn_no], "_blank"); the java script needs to accomidate the url_list that is a seperate XML document containing the URL addresses (because there are more than 1 web addresses)


            tn_group["tn"+i].tn_button.onRelease = function()
            {
            getURL(url_list[this._parent.tn_no], "_blank");
            }
            • 3. Actionscript + Java popup window from XML
              Devendran Level 1
              i am not hardCoding the values in JAVASCRIPT.
              what ever you pass it will work for that.

              Just create your URL String in Flash and Pass it to the JavaScript function
              I don't know why you are passing XML Node.

              instead of that Parse the XML and Form the URL Then pass it to JS
              • 4. Re: Actionscript + Java popup window from XML
                porchick Level 1
                I used the fscommand but get no response. I tried both ways. Im not sure why its not working

                fscommand ("call_popup", url_list[this._parent.tn_no]);

                the "url_list" is the URLs loaded from the XML data list page.

                --------------------this is the script for the movieclip that loads the XML data-----------------------------

                filename_list = new Array();
                url_list = new Array();
                tgt = new Array();
                title_list = new Array();
                description_list = new Array();
                price_list = new Array();
                code_list = new Array();
                var filepath:String = "whites/";

                var my_xml = new XML();
                my_xml.ignoreWhite = true;
                my_xml.onLoad = function()
                {
                var nodes:Array = this.firstChild.childNodes;
                for(var i=0;i<nodes.length;i++)
                {
                filename_list.push(nodes .attributes.filename);
                url_list.push(nodes
                .attributes.url);
                tgt.push(nodes .attributes.target);
                title_list.push(nodes
                .attributes.title);
                description_list.push(nodes .attributes.description);
                price_list.push(nodes
                .attributes.price);
                code_list.push(nodes .attributes.code);
                }
                }
                my_xml.load("white_wine_list.xml");
                tn_group.tn._visible = false;
                tn_group.setMask( tn_group_area );
                var total:Number = filename_list.length;
                var distance_y:Number = tn_group.tn._height + 9;
                var current:Number = 0;
                var i:Number = 0;

                for( ; i < total; i++ )
                {
                tn_group.tn.duplicateMovieClip("tn"+i, i);
                tn_group["tn"+i].preloader._width = 0;
                tn_group["tn"+i].tn_button._visible = false;
                tn_group["tn"+i].txt = (i+1);
                tn_group["tn"+i].tn_no = i;
                tn_group["tn"+i]._y = i * distance_y;

                tn_group["tn"+i].fm_title.text = title_list
                ;
                tn_group["tn"+i].description.text = description_list ;
                tn_group["tn"+i].price.text = price_list
                ;
                tn_group["tn"+i].code.text = code_list ;

                tn_group["tn"+i].tn_button.onRollOver = function()
                {
                this._parent.txt = "view info";
                }
                tn_group["tn"+i].tn_button.onRollOut = function()
                {
                this._parent.txt = "";
                }
                tn_group["tn"+i].tn_button.onRelease = function()
                {
                getURL(url_list[this._parent.tn_no], "btn_mc");
                }
                }