dcsimg
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: External Swf Form Problem

  1. #1
    Junior Member
    Join Date
    Dec 2004
    Posts
    8

    External Swf Form Problem

    Hello,

    I am trying to make a form work in my flash movie. The form is located in an external swf named "featuredAd2.swf" . When this form is called in, the form stops working .. but when I play the external swf standalone, it works fine.


    Here is the code in the submit button when I leave it on the root:

    on (release) {
    if (Email.length || Email.indexOf("@") == -1 || Email.indexOf(".") == -1) {
    EmailStatus = "Enter a valid E-mail";
    } else if (FirstName.length) {
    EmailStatus = "Enter your name";
    } else {
    loadVariablesNum("gear.php", "0", "POST");
    EmailStatus = "Sending... Please Wait...";
    }
    }
    // --- Form works fine standalone.


    Here is the code in the submit button when I add a path:

    on (release) {
    if (_root.main.ADS.featured.Email.length || _root.main.ADS.featured.Email.indexOf("@") == -1 || _root.main.ADS.featured.Email.indexOf(".") == -1) {
    _root.main.ADS.featured.EmailStatus = "Enter a valid E-mail";
    } else if (_root.main.ADS.featured.FirstName.length) {
    _root.main.ADS.featured.EmailStatus = "Enter your name";
    } else {
    loadVariablesNum("gear.php", "0", "POST");
    _root.main.ADS.featured.EmailStatus = "Sending... Please Wait...";
    }
    }
    //---Form doesnt seem to like this


    Please help

  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    The first code should work ( provided the submit button is in the same timeline as the field Email and EmailStatus ). You only have to take away the reference to _level0 as this means the main timeline of the host swf. ( if you are loading into a movieclip and not into a _level ).

    this.loadVariables("gear.php", "POST");

    I assume that both swf files are in the same folder.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #3
    Junior Member
    Join Date
    Dec 2004
    Posts
    8

    thank you

    I'll give that a try. You can see what Im trying to do at www.xdcg.com/spring in the "gear" section

  4. #4
    Junior Member
    Join Date
    Dec 2004
    Posts
    8
    Nope ... didnt work when I changed the code to what you suggested. DO you know of any live examples or source codes I could find with a similar example? One with a form in an external movie?

  5. #5
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Normally the trouble with externa swf's is that the code has references , either to the _root or a _level. The externally loadd swf is regarded as the movieclip its loaded into and movieclips does not have a _root. By changing the reference to this.loadVariables() means that you are sending or recieving variables from the current timeline, wherever that may be.

    So if all your form stuff is in the same timeline in the external swf , it should work fine. The only thing that can mess things up is if its not located in the same folder as the other swf and html.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  6. #6
    Member
    Join Date
    Nov 2004
    Location
    Pasig City, Philippines
    Posts
    68
    Try using the _lockroot property. Or better yet, use relative paths through _parent.
    "Life is unfair... but beautiful."

    Scarlette Krimson
    marte_raphael.soliza@up.edu.ph

  7. #7
    Junior Member
    Join Date
    Dec 2004
    Posts
    8
    Originally posted by redruby
    Try using the _lockroot property. Or better yet, use relative paths through _parent.

    Thanks for this info ... but how would I use _parent? Is it the target? ie: _self, _root, _blank, etc?

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center