A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: talking to javascript via FSCOMMAND

  1. #1
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Robert said that I could send javascript commands via FSCOMMAND but I can't seem to get it working.
    this is what I've got for the javascript

    <script language="Javascript">
    <!--

    function testjs_DoFSCommand (command, args)
    {
    document.write("Test");
    if (command=="gosite") {
    newWindow = window.open("dobi.html","Dobiecki","height=400,wid th=480");
    }
    }


    //-->
    </script>


    In the Movie I have the action of a button as
    FSCOMMAND gosite input

    Any ideas?

  2. #2
    Junior Member
    Join Date
    Mar 2001
    Posts
    5
    I got it to work yesterday with these 3 additions but I am not sure if all three are needed. I borrow the code from another web page using flash.

    1) Added the var testjsObj line after the function statement:

    function testjs_DoFSCommand(command, args)
    {
    var testjsObj = InternetExplorer ? testjs : document.testjs;

    2) Added this code for Internet Explorer within the <SCRIPT> tag:

    // Hook for Internet Explorer
    if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
    document.write('<SCRIPT LANGUAGE=VBScript\> \n');
    document.write('on error resume next \n');
    document.write('Sub testjs_FSCommand(ByVal command, ByVal args)\n');
    document.write(' call testjs_DoFSCommand(command, args)\n');
    document.write('end sub\n');
    document.write('</SCRIPT\> \n');

    3) I made sure that the <OBJECT> tag had this in it:

    id=testjs

    Works great for me but I am too green to know if all three had to be used.

  3. #3
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    interesting

    Originally posted by erikpm
    I got it to work yesterday with these 3 additions but I am not sure if all three are needed. I borrow the code from another web page using flash.

    1) Added the var testjsObj line after the function statement:

    function testjs_DoFSCommand(command, args)
    {
    var testjsObj = InternetExplorer ? testjs : document.testjs;

    2) Added this code for Internet Explorer within the <SCRIPT> tag:

    // Hook for Internet Explorer
    if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
    document.write('<SCRIPT LANGUAGE=VBScript\> \n');
    document.write('on error resume next \n');
    document.write('Sub testjs_FSCommand(ByVal command, ByVal args)\n');
    document.write(' call testjs_DoFSCommand(command, args)\n');
    document.write('end sub\n');
    document.write('</SCRIPT\> \n');

    3) I made sure that the <OBJECT> tag had this in it:

    id=testjs

    Works great for me but I am too green to know if all three had to be used.
    Well I can tell you that 1 is not needed, but it's interesting that this worked for you. Part of my problem is that I'm in the process of moving and my books are packed So I can't readily look up javascript stuff.

    2 is simply writing the same thing in Vbscript to the document if Explorer is detected. Not what I want to do, and interestingly I tried using this to see and it did partly work but then crashed my browser, I'll have to look at it some more.


  4. #4
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    Slowly narrowing it down

    My function is fine I've determined this by calling it manually via javascript in the page, however I cannot seem to get my flash program to call the function, so that is where my problems lie, I'm thinking it's the name thing, and that the html produced via 3dfa is not adding the needed tag so that javascript knows the name of the movie.

  5. #5
    Senior Member
    Join Date
    Jan 2002
    Posts
    118

    Lightbulb one idea

    3dfa might not be inserting the id=testjs in the object tag, especially if the name inside the movie (not the save title) is not testjs.

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