how to embed flash object into jsp page

Posted on 2006-04-05
Last Modified: 2012-06-21
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", "");
        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.

Question by:AceAdmin
    LVL 29

    Expert Comment

    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"



    Author Comment

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

    <variable name ="" value="">
    LVL 29

    Accepted Solution

    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.

    Author Comment

    cheers it did work in the java script version after all.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    password protect pdf 11 68
    How to Post an If Statement in JSP 3 39
    oracle fusion vs MQ 2 76
    struts hibernate integration example 28 87
    It can often be challenging to stay relevant in the rapidly evolving world of technology. This can make recruiting talent difficult for companies of all sizes.
    David Varnum recently wrote up his impressions of PRTG, based on a presentation by my colleague Christian at Tech Field Day at VMworld in Barcelona. Thanks David, for your detailed and honest evaluation!
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now