8 Replies Latest reply on Dec 9, 2008 6:58 AM by kglad

    Cannot Access Text in Cross Domain SWF

    scantron13

      Hello Everybody,
      I am trying to make a "mother" swf to hold all my functions, shortcuts, etc.. This "mother" swf will be stored on a "mother" server.
      I intend to make several websites on different servers that all access this "mother" swf for various tasks.
      I created two testing domains (unitcounter.com & projectvolcano.com) where I was able to have cross-domain swfs share functions & variables successfully.
      The problem occurs when one swf tries to write to a textfield in another swf. I can change properties like position and rotation, but I cannot access properties such as ".text", which is the most important property I need to use.

      Mother SWF: "www.projectvolcano.com/a.swf" (a.swf)
      2nd SWF: "www.unitcounter.com/b.swf" (b.swf)

      Note: b.swf loads a.swf using loadMovie
      Note: Both servers contain crossdomain.xml files allowing any other server full access
      Note: Both SWFs contain "allowdomain" statements allowing any other SWF, on any other server, full access

      The actionscript I used for both SWFs is below. If b.swf and a.swf where communicating correctly, then b.swf would load a.swf, then b.swf would alter the textfield located in a.swf to read "NICE" instead of "RED HAT". Further, b.swf would then list all the properties of the textfield located in a.swf.
      Take a look at b.swf or b.fla and see for yourself. Thanks in advance for anybody who can help; I've been battling with this problem for 2 weeks now.

      Final Note: In b.swf, you must press the black button to manipulate the loaded a.swf



      ----Complete Code for a.swf (one frame SWF)-----
      // ALLOW ALL DOMAINS TO ACCESS THIS SWF
      System.security.allowDomain("*");

      // SAMPLE TEXT
      xxx.text = "RED HAT";




      -----Complete Code for b.swf (one frame SWF)------
      // ALLOW EVERY DOMAIN TO ACCESS THIS SWF
      System.security.allowDomain("*");

      // MAKE A MOVIECLIP TO LOAD THE CROSS-DOMAIN SWF INTO
      _root.createEmptyMovieClip("nas",_root.getNextHighestDepth());
      _root.nas.loadMovie(" http://www.projectvolcano.com/a.swf");

      // ONCE THE EXTERNAL SWF IS LOADED, PRESS THIS BUTTON TO ALTER IT
      butt.onRelease = function(){

      // CHANGE THE TEXT VALUE (DOES NOT WORK)
      _level0.nas.xxx.text = "NICE";

      // CHANGE THE ROTATION VALUE (WORKS)
      _level0.nas.xxx._rotation += 20;

      // SHOW ALL THE PROPERTIES OF THE TEXTFIELD IN A.SWF -
      // (IN THE LOADED SWF) YOU TRIED TO ACCESS
      ppp.html = true;
      ppp.htmlText = "";
      for(prop in _level0.nas.xxx){
      ppp.htmlText += prop+" = "+_level0.nas.xxx[prop] +"<BR>";}}