dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: HELP!! Can FLash read JavaScript variables?

  1. #1
    Junior Member
    Join Date
    Feb 2002
    Posts
    12
    Hi,

    Is it possible for Flash to get the value of a Javascript variable and use that value in ActionScript?


    I have read al kinds of info on setVariable, but It seems that this is unable to affect ActionScript, only Dynamic textfields?....

  2. #2
    Junior Member
    Join Date
    Feb 2002
    Posts
    12

    Whooaa this is only the third time or so

    So all you people know al lot!
    It's not that this is like the third time that I posted this question!!!!

    It's so simple, either it can/ or it can't be done!

    Any answer at all would be nice by now!

  3. #3
    Señor Miembro
    Join Date
    May 2001
    Posts
    162
    A little more detailed info on what you're trying to do might help. Are you setting this variable in an html page, is it already set when flash loads, does an action in flash determine when you get this variable??

    simplest solution...when you load the flash, put a query string on the end of your .swf files location in the <object> and <embed> tags. Use javascript to write out that line of html:

    <script>
    document.write('<parameter name="files/movie.swf?JSVariable=' + variableName + '">');
    </script>

    This variable will be available on the _root timeline of your movie.

    Quasi
    [Edited by Quasidandy on 08-15-2002 at 03:36 PM]

  4. #4
    Junior Member
    Join Date
    Feb 2002
    Posts
    12
    Hi Quasidandy,

    Thanks for taking the time to post a reply.

    I have this ActionScript in my movie:
    <b>loadVarDoc</b> = "assets/swf/service.txt";
    loadVarsText = new loadVars();
    loadVarsText.load(loadVarDoc);
    loadVarsText.onLoad = function(success) {
    if (success) {
    to the
    scroller.html = true;
    scroller.htmlText = this.var1;
    } else {
    scroller.text = "Data Not Found...";
    }
    };

    What I want to do is give each HTML page a different value for <b>loadVarDoc</b> so I can include the same flashmovie on each page but it would load different .TXT files because of the variable.

    Does this make any sence?

    So, on each HTML page I will have a JavaScript variable:
    loadVarDoc = xxxx.TXT (xxxx.TXT being different on each page)

    Each page will include the same Flash Movie that will know what TXT file to load because it gets this from the JavaScript variable on that page.

    Is this possible?

    Your suggestion looks promising, I'll definitely give it a try tomorrow and let you know!

    Kind regards,

    Michiel

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