Javascript <--> Flash: communication trouble

Ask a Question related to Macromedia Flash Actionscript, Design and Development.

  1. #1

    Default Javascript <--> Flash: communication trouble

    On my webpage I need to be able to communicate from Javascript to Flash and
    vice versa.

    To communicate from Flash to Javascript I'm using FScommand.

    From javascript to Flash I'm using the flashVars parameter of the Object &
    embed tags. I have my page set up to dynamically write the object/embed code to
    the DIV tag that I want to contain the flash movie. This is necessary due to
    the variables that I'm using in the FlashVars values. The code looks similar to
    the following:

    var HTMLins = "<OBJECT ID='newsTicker' width='114' height='355'><param
    name=movie value='movie.swf'><param name=FlashVars value='recalledBit=" +
    parent.upperPanel.activeNewsClip + "'>"
    document.getElementById("newsTickerLayer").innerHT ML=HTMLins;

    This dynamic method of communication from Javascript to Flash works very well
    with one exception. It screws up my FSCommand communication. My FSCommand code
    used to run great when the object & embed tags were actually coded into the
    page. Now that the page is set up to generate the object & embed tags
    dynamically as mentioned above, the FSCommands don't want to work at all.

    Any ideas?

    automan25 Guest

  2. Similar Questions and Discussions

    1. JavaScript & Flash Internal movie communication
      Hi I would like to build a html page that triggers various flash movies via javaScript. For example Id like to have two html checkboxes...
    2. flash <-> javascript communication in IE7
      Hello, Having downloaded and installed IE7 Beta 2, my already working app. in IE6 using 8.0.22 Flash player, now suddenly is not reacting anymore...
    3. JavaScript to Flash communication
      Hello, I am trying to communicte between JavaScript and Flash. Generality, I want to run a function in flash using JavaScript . I have a page...
    4. Javascript communication with Flash
      Hello, Does anyone know if its possible to control a text field in flash with JavaScript. I.E. change font and font color?? Thanks!
    5. What's the deal w javascript -> flash communication?
      This is syntax from Javascript... window.document.test.SetVariable("foo", "fubar"); In this case the object, which is the Flash movie is named...
  3. #2

    Default Re: Javascript <--> Flash: communication trouble

    Actually; there's no need to use FScommand at all. Here's a simple example
    of what I once created:
    [url]http://home.hccnet.nl/john.mulder/flash/js_comm.zip[/url]

    But actually - unless you insist on publishing for Flash Player 5 or
    earlier - it's well worth to have a look at Local Connection Object, which
    is much more reliable. After all the simple action of turning of javascript
    in the browser would sabotage whatever you're trying to achieve.

    John

    --
    ----------------------------------------------------------------------------
    -----------
    RESOURCES
    [url]http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash[/url]
    ----------------------------------------------------------------------------
    -----------
    TUTORIALS at
    [url]www.laiverd.com[/url]
    Flash & PHP Emailform
    Using textfiles in Flash
    ----------------------------------------------------------------------------
    -----------


    Laiverd.COM Guest

  4. #3

    Default Re: Javascript <--> Flash: communication trouble

    I examined your code. It seems to work very well. I won't work for my project
    though. I chose to use FScommand because it eliminates that "click" noise that
    IE produces every time you click on a link. That same click occurs when you use
    the GetURL command from Flash. Since my script will be sending data to the page
    twice every second the clicking noise would get rather annoying to the user.

    You did mention creating the Local Connection Object though. Since I have
    another flash movie on the site I can use Local Connection Object to store data
    in the other flash movie rather than in the webpage itself, thus solving my
    problem.

    Thanks for the help.

    automan25 Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139