6 Replies Latest reply: Feb 20, 2009 12:58 PM by Newsgroup_User RSS

    why use javascript to embed swf files?

    montysM Community Member
      I tryed to find this on the web but came up empty handed so here i am.

      If I add a flash swf file to my html page in the traditional Dreamweaver manner - Insert/media/Flash, Dreamweaver generates javascript code to embed the swf file. And I'm wondering why when all one simply needs is -

      <embed src="whatever.swf" quality="high" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage=" http://www.macromedia.com/go/getflashplayer" height="XX" width="XX"></embed>

      I actually couldn't get my swf to play with the Dreamweaver generated javascript when posting to my webserver (though it did play locally on my machine). I tryed using relative paths, etc. to no avail. All my files (swf and html) are in the same directory, but the swf just wouldn't show up in my page. Finally I just scrapped the Dreamweaver generated javascript and replaced it with the above and it all worked perfectly! And much more succintly I may add, in terms of code.

      Which lead me to wonder why the javascript?? Does anybody know?
        • 1. Re: why use javascript to embed swf files?
          Newsgroup_User Community Member
          montysM wrote:
          > Which lead me to wonder why the javascript?? Does anybody know?

          The embed tag is not standard HTML, so pages that use it do not validate.

          --
          David Powers, Adobe Community Expert
          Author, "The Essential Guide to Dreamweaver CS4",
          "PHP Solutions" & "PHP Object-Oriented Solutions"
          http://foundationphp.com/
          • 2. Re: why use javascript to embed swf files?
            Newsgroup_User Community Member
            montysM wrote:
            > I tryed to find this on the web but came up empty handed so here i am.
            >
            > If I add a flash swf file to my html page in the traditional Dreamweaver
            > manner - Insert/media/Flash, Dreamweaver generates javascript code to embed the
            > swf file. And I'm wondering why when all one simply needs is -
            >
            > <embed src="whatever.swf" quality="high" allowscriptaccess="sameDomain"
            > type="application/x-shockwave-flash"
            > pluginspage=" http://www.macromedia.com/go/getflashplayer" height="XX"
            > width="XX"></embed>
            >
            That's because it's HTML specific. If your page is XHTML and with
            correct mime type, that's why your flash animation won't work.

            Actually the embed tag is served for netscape 6 below. And it is
            proprietary. I still suprise that Adobe still include it in dreamweaver.
            • 3. Re: why use javascript to embed swf files?
              Newsgroup_User Community Member
              Burman wrote:
              > That's because it's HTML specific. If your page is XHTML and with
              > correct mime type, that's why your flash animation won't work.

              Referring to the "correct MIME type" for XHMTL is confusing. Very few
              servers use application/xhtml+xml. The vast majority use text/html,
              which is permitted in XHTML 1.0. Although non-standard, the embed tag
              works fine in XHTML served as text/html.

              > Actually the embed tag is served for netscape 6 below. And it is
              > proprietary. I still suprise that Adobe still include it in dreamweaver.

              I'm not surprised at all. Dreamweaver uses the embed tag to ensure that
              Flash movies are displayed correctly in all browsers.

              In fact, you could say that Adobe is being very forward looking. The
              embed tag is being added to HTML5:

              http://www.w3.org/TR/html5-diff/#new-elements

              Burman, you have obviously studied a lot about web standards, which is
              great. However, the web is constantly evolving. Not all of the decisions
              taken by the W3C were sensible, which is why HTML5 is being developed.
              It's also debatable whether all parts of HTML5 will make sense.

              Stick to standards wherever you can, but also learn to take a practical
              approach. Making things work is what really matters.

              --
              David Powers, Adobe Community Expert
              Author, "The Essential Guide to Dreamweaver CS4",
              "PHP Solutions" & "PHP Object-Oriented Solutions"
              http://foundationphp.com/
              • 4. Re: why use javascript to embed swf files?
                montysM Community Member
                Thanks for your replies and the elucidation! (somehow this thread ended up on google and I replied there but here it is here...

                Validation is a good answer. Despite the fact that the embed tag, as pointed out, is part of the Dreamweaver generated swf insertion. Like David said, "Making things work is what really matters." I guess that's true for me *and* Adobe... validation or not.

                What still mystifies me is the javascript - once I strip it out, my swf plays, but when it's there it doesn't.
                I should qualify that - the swf (as3, a preloader; so really 2 swfs, though that shouldn't matter) works locally with the javascript, but not when I load it to my web host. AC_RunActiveContent.js is in the folder on both.

                It's frustrating that the program I pay money for doesn't do what it's supposed to (that'll start an avalanche of mail! ( ; ), and that I have to resort to other methods to get it to work.

                For the Dreamweaver javascript code just go to - Insert/media/Flash - to embed your swf. I'm using CS3.

                Thanks for all your help.

                Stefan
                • 5. Re: why use javascript to embed swf files?
                  Newsgroup_User Community Member
                  Google indexes this forum, but it's one-way only. Your replies there go
                  into the celestial bitbucket.

                  --
                  Murray --- ICQ 71997575
                  Adobe Community Expert
                  (If you *MUST* email me, don't LAUGH when you do so!)
                  ==================
                  http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                  http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                  ==================


                  "montysM" <webforumsuser@macromedia.com> wrote in message
                  news:gnn387$6bp$1@forums.macromedia.com...
                  > Thanks for your replies and the elucidation! (somehow this thread ended
                  > up on
                  > google and I replied there but here it is here...
                  >
                  > Validation is a good answer. Despite the fact that the embed tag, as
                  > pointed
                  > out, is part of the Dreamweaver generated swf insertion. Like David said,
                  > "Making things work is what really matters." I guess that's true for me
                  > *and*
                  > Adobe... validation or not.
                  >
                  > What still mystifies me is the javascript - once I strip it out, my swf
                  > plays,
                  > but when it's there it doesn't.
                  > I should qualify that - the swf (as3, a preloader; so really 2 swfs,
                  > though
                  > that shouldn't matter) works locally with the javascript, but not when I
                  > load
                  > it to my web host. AC_RunActiveContent.js is in the folder on both.
                  >
                  > It's frustrating that the program I pay money for doesn't do what it's
                  > supposed to (that'll start an avalanche of mail! ( ; ), and that I have
                  > to
                  > resort to other methods to get it to work.
                  >
                  > For the Dreamweaver javascript code just go to - Insert/media/Flash - to
                  > embed
                  > your swf. I'm using CS3.
                  >
                  > Thanks for all your help.
                  >
                  > Stefan
                  >
                  >

                  • 6. Re: why use javascript to embed swf files?
                    Newsgroup_User Community Member
                    > I should qualify that - the swf (as3, a preloader; so really 2 swfs,
                    > though
                    > that shouldn't matter) works locally with the javascript, but not when I
                    > load
                    > it to my web host.

                    Post a link to the page, please.

                    > It's frustrating that the program I pay money for doesn't do what it's
                    > supposed to

                    In this case, though, it does do what it's supposed to.

                    > (that'll start an avalanche of mail! ( ; ), and that I have to
                    > resort to other methods to get it to work.

                    You shouldn't have to do this.

                    --
                    Murray --- ICQ 71997575
                    Adobe Community Expert
                    (If you *MUST* email me, don't LAUGH when you do so!)
                    ==================
                    http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                    http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                    ==================


                    "montysM" <webforumsuser@macromedia.com> wrote in message
                    news:gnn387$6bp$1@forums.macromedia.com...
                    > Thanks for your replies and the elucidation! (somehow this thread ended
                    > up on
                    > google and I replied there but here it is here...
                    >
                    > Validation is a good answer. Despite the fact that the embed tag, as
                    > pointed
                    > out, is part of the Dreamweaver generated swf insertion. Like David said,
                    > "Making things work is what really matters." I guess that's true for me
                    > *and*
                    > Adobe... validation or not.
                    >
                    > What still mystifies me is the javascript - once I strip it out, my swf
                    > plays,
                    > but when it's there it doesn't.
                    > I should qualify that - the swf (as3, a preloader; so really 2 swfs,
                    > though
                    > that shouldn't matter) works locally with the javascript, but not when I
                    > load
                    > it to my web host. AC_RunActiveContent.js is in the folder on both.
                    >
                    > It's frustrating that the program I pay money for doesn't do what it's
                    > supposed to (that'll start an avalanche of mail! ( ; ), and that I have
                    > to
                    > resort to other methods to get it to work.
                    >
                    > For the Dreamweaver javascript code just go to - Insert/media/Flash - to
                    > embed
                    > your swf. I'm using CS3.
                    >
                    > Thanks for all your help.
                    >
                    > Stefan
                    >
                    >