Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool Flash 8: Cannot Access Textfield in Cross Domain SWF

    Flash 8 Actionscript

    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
    Note: a.swf and b.swf both use embedded Verdana font

    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)-----
    Code:
    // ALLOW ALL DOMAINS TO ACCESS THIS SWF
    System.security.allowDomain("*");
    
    // SAMPLE TEXT
    xxx.text = "RED HAT";



    -----Complete Code for b.swf (one frame SWF)------
    Code:
    // 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>";}}

  • #2
    New to the CF scene
    Join Date
    Dec 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Update

    Update: When using Flash Player Plugin 8, the cross domain SWFs can easily communicate with each other (read/write to each other's textfields). Its only when using Flash Player Plugin 9 (or higher) do the textfields stop being accessible. I covered my bases, using a crossdomain.xml file:

    Code:
    <?xml version="1.0"?>
       <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
       <cross-domain-policy>
       <allow-access-from domain="*"/>
       </cross-domain-policy>

    Also, I am using an allowdomain statement in each SWF:

    Code:
    System.security.allowDomain("*");


    I now understand that even though my SWFs were made in Flash 8, they are still subject to the security features in each new version of the Flash Player Plugin. I just cannot figure out how to fix my Cross Domain SWFs so they can communicate with each other using Flash Player Plugin 9 (and higher).

    Does anybody know what changed between Flash Player Plugin 8 and Flash Player Plugin 9 that would prevent Cross Domain SWFs from accessing each other's textfields (reading/writing to textfields)?

    Summary of Problem:

    Flash Player Plugin 8:
    1. Can Access Textfield properties that change appearance (_x, _y, _alpha, _height, etc)
    2. Can Access text within Textfields (.text)

    Flash Player Plugin 9 (and higher):
    1. Can Access Textfield properties that change appearance (_x, _y, _alpha, _height, etc)
    2. CANNOT Access text within Textfields (.text)

    Thanks for taking a look at this thread. Please comment if you have any suggestions.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •