Flash and document.write()

Discussion in 'Javascript' started by Charles, Apr 28, 2007.

  1. Charles

    Charles Guest

    It's strange... The following works:

    document.write('<object classid="clsid:D27CDB6E-
    AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/
    pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="1"
    height="1"><param name="movie" value="vinheta1.swf"><embed
    src="vinheta1.swf" quality="high" pluginspage="http://
    www.macromedia.com/go/getflashplayer" type="application/x-shockwave-
    flash" width="1" height="1"></embed></object>');

    But the following doesn't:

    document.write('<object classid="clsid:D27CDB6E-
    AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/
    pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="1"
    height="1"><param name="movie" value="vinheta' . '1' . '.swf"><embed
    src="vinheta' . '1' . '.swf" quality="high" pluginspage="http://
    www.macromedia.com/go/getflashplayer" type="application/x-shockwave-
    flash" width="1" height="1"></embed></object>');

    Have you had this sort of problem? Do you know why this doesn't work
    in the 2nd case?
    Thanks,
    Charles, Apr 28, 2007
    #1
    1. Advertising

  2. On Apr 27, 7:19 pm, Charles <> wrote:
    > It's strange... The following works:
    >
    > document.write('<object classid="clsid:D27CDB6E-
    > AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/
    > pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="1"
    > height="1"><param name="movie" value="vinheta1.swf"><embed
    > src="vinheta1.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-
    > flash" width="1" height="1"></embed></object>');
    >
    > But the following doesn't:
    >
    > document.write('<object classid="clsid:D27CDB6E-
    > AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/
    > pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="1"
    > height="1"><param name="movie" value="vinheta' . '1' . '.swf"><embed
    > src="vinheta' . '1' . '.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-
    > flash" width="1" height="1"></embed></object>');
    >
    > Have you had this sort of problem? Do you know why this doesn't work
    > in the 2nd case?


    I doubt anyone is going to bust out a diff program to figure out what
    is different in these two blobs. Perhaps you'd like to indicate what
    is different?

    Peter
    Peter Michaux, Apr 28, 2007
    #2
    1. Advertising

  3. Charles

    Mark Guest

    The string concatenation operator is '+' not '.'.
    Mark, Apr 28, 2007
    #3
  4. Charles

    Charles Guest

    On Apr 28, 12:32 am, Mark <> wrote:
    > The string concatenation operator is '+' not '.'.


    Correct.
    Charles, Apr 29, 2007
    #4
  5. Charles

    Charles Guest

    Any idea?
    Charles, May 1, 2007
    #5
  6. Charles

    -Lost Guest

    Charles wrote:
    > Any idea?
    >


    About what? Didn't Mark's response solve your problem?

    --
    -Lost
    Remove the extra words to reply by e-mail. Don't e-mail me. I am
    kidding. No I am not.
    -Lost, May 1, 2007
    #6
  7. Charles

    Charles Guest

    On May 1, 1:49 am, -Lost <> wrote:
    > About what? Didn't Mark's response solve your problem?


    No, I would like to know why this difference prevents the Flash
    animation from appearing.
    TIA,
    Charles, May 1, 2007
    #7
  8. Charles

    -Lost Guest

    Charles wrote:
    > On May 1, 1:49 am, -Lost <> wrote:
    >> About what? Didn't Mark's response solve your problem?

    >
    > No, I would like to know why this difference prevents the Flash
    > animation from appearing.


    And you changed your .'s to +'s, right?

    --
    -Lost
    Remove the extra words to reply by e-mail. Don't e-mail me. I am
    kidding. No I am not.
    -Lost, May 1, 2007
    #8
  9. Charles

    Charles Guest

    On May 1, 7:30 pm, -Lost <> wrote:
    > And you changed your .'s to +'s, right?


    Nope.
    Charles, May 2, 2007
    #9
  10. Charles

    Charles Guest

    On May 2, 10:06 am, Randy Webb <> wrote:
    > Because one way is a syntax error and the other way isn't. When the
    > syntax error is encountered script execution stops. When it stops you
    > won't see an animation because it hasn't been completely created yet.


    Thanks. From the 2nd snippet, I'm just concatenating strings. This is
    why I don't understand it fails to render the Flash animation.
    Charles, May 2, 2007
    #10
  11. Charles

    -Lost Guest

    Charles wrote:
    > On May 2, 10:06 am, Randy Webb <> wrote:
    >> Because one way is a syntax error and the other way isn't. When the
    >> syntax error is encountered script execution stops. When it stops you
    >> won't see an animation because it hasn't been completely created yet.

    >
    > Thanks. From the 2nd snippet, I'm just concatenating strings. This is
    > why I don't understand it fails to render the Flash animation.


    Oh my God. NO YOU ARE NOT. The concatenation operator in JavaScript is
    a plus (+) not a dot (.). This is NOT PHP.

    --
    -Lost
    Remove the extra words to reply by e-mail. Don't e-mail me. I am
    kidding. No I am not.
    -Lost, May 2, 2007
    #11
  12. Charles

    Charles Guest

    Damn! I mix everything...Anyway, thanks again!
    Charles, May 3, 2007
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bernie
    Replies:
    0
    Views:
    530
    Bernie
    Sep 5, 2004
  2. Jim Higson
    Replies:
    1
    Views:
    499
    Jim Higson
    Sep 21, 2004
  3. Chuck
    Replies:
    0
    Views:
    87
    Chuck
    Nov 27, 2003
  4. Document.write and Flash

    , Dec 18, 2007, in forum: Javascript
    Replies:
    3
    Views:
    232
    David Mark
    Dec 18, 2007
  5. Frank Peterson
    Replies:
    9
    Views:
    218
    David Mark
    Jun 28, 2009
Loading...

Share This Page