1 Reply Latest reply on Jun 9, 2010 12:19 AM by davebartlett

    LoadVars.sendAndLoad() between Parent and Popup Window




      Just looking for a pointer in the right direction really...   Having not used PHP in conjuction with Flash before the last few day, I'm a bit stuck.


      I have a PHP file which will contain a list of online courses, each with their own link to to launch them.  The link to launch the course will contain data such as:


        - A book mark that will be read when the flash movie loads to determine which page to go to.

        - The current score of the student

        - Wherever or not the student has compelted the course.

      The links open the course in a new popup window, and I am trying to send the PHP variables from the new window to the parent page, without much success.


      If I use LoadVars.send(); then the whole works ok, updating the variables and the PHP page, but opening it in a new window, instead of just refreshing the existing page.


      I have tried getting my head around sendAndLoad, but it doesn't seem to work?


      Any ideas? Thoughts? Anything would be appreciated...


      Current the "courselist.php" file looks like this:



              <script language="javascript">
                  function openWindow(theURL) {
                      courseWindow = window.open(theURL, "courseWindow", "width=640,height=300");
              <a href="javascript:openWindow('contentwindow.html?account_id=<?php echo $_POST["account_id"]; ?>&course_id=C0001&bookmark=<?php echo $_POST["bookmark"]; ?>&current_score=<?php echo $_POST["current_score"];?>&course_completed=<?php echo $_POST["course_completed"]; ?>')">Click to Launch</a>

      And in the Flash movie I have:


      accountID_txt.text = "Account ID: " + _root.account_id;
      courseID_txt.text = "Course ID: " + _root.course_id;
      bookmark_txt.text = "Bookmark: " + _root.bookmark;
      currentScore_txt.text = "Score: " + _root.current_score;
      courseCompleted_txt.text = "Course Completed: " + _root.course_completed;


      var scoreCounter = new Number(0);
      var bookmarkCounter = new Number(0);


      function updateBookmark() {
          var updateData: LoadVars = new LoadVars();
          updateData.account_id = _root.account_id;
          updateData.course_id = _root.course_id;
          updateData.bookmark = bookmarkCounter;
          updateData.current_score = scoreCounter;
          if (scoreCounter == 100) {
              updateData.course_completed = true;
              updateData.course_completed = false;


      increaseBookmark_btn.onRelease = function() {
          if (bookmarkCounter < 100) {
              _root.bookmark_txt.text = "Bookmark: " + bookmarkCounter;
              this.enabled = false;


      increaseScore_btn.onRelease = function() {
          if (scoreCounter < 100) {
              _root.currentScore_txt.text = "Score: " + scoreCounter;
              this.enabled = false;