• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2116
  • Last Modified:

how to embed flash object into jsp page

I'm having a problem with flash and jsp pages. I am converting from one html web page (where the creator has used java script to create a flash object on the page) into a jsp page. To be honest im not really sure how to create a flash object in a jsp page. I have seen the use of <object> tag when i have searched this forum but in not sure how to use some of the values that I have in the javascript. to make it clearer here is the javascript that creates the flash object in the HTML page.

      <script type="text/javascript" src="./javascript/flashobject.js"></script>
        <script type="text/javascript">
        // <![CDATA[
        var fo = new FlashObject("./slideshow/slideshow.swf", "header-slideshow", 526, 135, 6, "#d7dee8");
        fo.addVariable("xmldir", "./slideshow/");
        fo.addVariable("imagedir", "./images/");
        fo.addVariable("xmlFile", "header.xml");
        fo.addVariable("XSize", "526");
        fo.addVariable("YSize", "135");
        fo.addVariable("picPause", "5");
        fo.addParam("quality", "high");
        fo.addParam("scale", "exactfit");
        fo.addParam("pluginspage", "http://www.macromedia.com/go/getflashplayer");
        fo.addParam("type", "application/x-shockwave-flash");
        // ]]>

I can see the addParam would be sorted using the

<param name="" value=""> tag I think but i dont know a tag for the variable.

  • 2
  • 2
1 Solution
You can treat the flash code for the jsp exactly as you would for html. The extra benefit for using JSP is that you can dynamically assign parameters on the server using scriptlets as in this example where the quality level is set from a value hardcoded earlier.

<% String flashQuality = "high" ; %>

        <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
         width="787" height="346">
            <param name="movie" value="home_page.swf">
            <param name="loop" value="false">
            <param name="menu" value="false">
            <param name="quality" value="<%= flashQuality %>">
            <param name="bgcolor" value="#000000">
            <embed src="home_page.swf" loop="false" menu="false" quality="high" bgcolor="#000000"
             width="787" height="346" type="application/x-shockwave-flash"


AceAdminAuthor Commented:
what would i use for
fo.addVariable("YSize", "135");
I dont know what the tagname is.
would it be

<variable name ="" value="">
It depends on what you are doing. In this case I would guess that it is the height variable so you would do somehting like this

<% String flashHeight = "346" ; %>

        <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
         width="787" height="<%= flashHeight  %>">...

You are aware that you could just leave the javascript as it is. Javascript will run in jsp just as well as in HTML.
AceAdminAuthor Commented:
cheers it did work in the java script version after all.

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now