Blog Post Dedicated to Udit Sharma.
Hi,
Trying to run a flash movie in a jspx page of an adf application came up with issues when you call the flash movie from the page itself.
To overcome this, we need to embed this flash movie in the jspx page.
This post of mine shows Embedding and running a flash movie (.swf) in a jspx ADF page. My colleague Udit Sharma found out a ingenious and simple way of achieving this.
First we need the <object> (The OBJECT element is used to include objects such as images, audio, videos, Java applets, and Flash animations. OBJECT is intended to replace the more specific IMG and APPLET elements, as well as the proprietary EMBED and BGSOUND elements, though a lack of browser support and severe bugs in supporting browsers make the other elements a better choice in many cases.).
To create this, we write the following code, which returns the string, used to embed the flash movie in the jspx page. In my case, I am embedding a RSA flash movie in my jspx, an ADF application.
Following is the code example:
public String getFlashObjectForFirefox() {
System.out.println("inside getFlashObjectForFirefox");
String ctxPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
System.out.println("ctxPath is " + ctxPath);
String object = "";
object = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" \n" +
"codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version\n" +
"=10,0,0,0\" width=\"100\" height=\"100\" id=\"11gR1_aniH_grey\" align=\"middle\">\n" +
"<param name=\"allowScriptAccess\" value=\"sameDomain\" />\n" +
"<param name=\"allowFullScreen\" value=\"false\" />\n" +
"<param name=\"wmode\" value=\"transparent\" />\n" +
"<param name=\"movie\" value=\""+ctxPath+"/rsa_fso.swf\" />\n" +
"<param name=\"quality\" value=\"high\" />\n" +
"<param name=\"bgcolor\" value=\"#4d5c64\" /> \n" +
"<param name=\"flashVars\" value=\"field_name=deviceString\"/>\n" +
"<embed id=\"flash_id\" " +
"src=\""+ctxPath+"/rsa_fso.swf\" quality=\"high\" width=\"100\" height=\"100\" name=\"rsa_fso.swf\" align=\"middle\" \n" +
"type=\"application/x-shockwave-flash\" flashVars=\"field_name=RSADeviceFso\" wmode=\"transparent\"\n" +
"pluginspage=\"http://www.adobe.com/go/getflashplayer\" />\n" +
"</object> ";
return object;
}
Now, from the .jspx page, I use the following tag to include and run the flash movie:
<f:verbatim>
${pageFlowScope.UIBean.getFlashObjectForFirefox}
</f:verbatim>
Please note that using the ctxPath, I have mentioned the path to the flash movie and the other javascripts required for the proper functioning/running of the flash movie.
Hope this helps.
Sudipto S.
P.S : Follow me with my progress on Java Knowledge and Black Belts come to knowledgeblackbelt.com
Hi,
Trying to run a flash movie in a jspx page of an adf application came up with issues when you call the flash movie from the page itself.
To overcome this, we need to embed this flash movie in the jspx page.
This post of mine shows Embedding and running a flash movie (.swf) in a jspx ADF page. My colleague Udit Sharma found out a ingenious and simple way of achieving this.
First we need the <object> (The OBJECT element is used to include objects such as images, audio, videos, Java applets, and Flash animations. OBJECT is intended to replace the more specific IMG and APPLET elements, as well as the proprietary EMBED and BGSOUND elements, though a lack of browser support and severe bugs in supporting browsers make the other elements a better choice in many cases.).
To create this, we write the following code, which returns the string, used to embed the flash movie in the jspx page. In my case, I am embedding a RSA flash movie in my jspx, an ADF application.
Following is the code example:
public String getFlashObjectForFirefox() {
System.out.println("inside getFlashObjectForFirefox");
String ctxPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
System.out.println("ctxPath is " + ctxPath);
String object = "";
object = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" \n" +
"codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version\n" +
"=10,0,0,0\" width=\"100\" height=\"100\" id=\"11gR1_aniH_grey\" align=\"middle\">\n" +
"<param name=\"allowScriptAccess\" value=\"sameDomain\" />\n" +
"<param name=\"allowFullScreen\" value=\"false\" />\n" +
"<param name=\"wmode\" value=\"transparent\" />\n" +
"<param name=\"movie\" value=\""+ctxPath+"/rsa_fso.swf\" />\n" +
"<param name=\"quality\" value=\"high\" />\n" +
"<param name=\"bgcolor\" value=\"#4d5c64\" /> \n" +
"<param name=\"flashVars\" value=\"field_name=deviceString\"/>\n" +
"<embed id=\"flash_id\" " +
"src=\""+ctxPath+"/rsa_fso.swf\" quality=\"high\" width=\"100\" height=\"100\" name=\"rsa_fso.swf\" align=\"middle\" \n" +
"type=\"application/x-shockwave-flash\" flashVars=\"field_name=RSADeviceFso\" wmode=\"transparent\"\n" +
"pluginspage=\"http://www.adobe.com/go/getflashplayer\" />\n" +
"</object> ";
return object;
}
Now, from the .jspx page, I use the following tag to include and run the flash movie:
<f:verbatim>
${pageFlowScope.UIBean.getFlashObjectForFirefox}
</f:verbatim>
Please note that using the ctxPath, I have mentioned the path to the flash movie and the other javascripts required for the proper functioning/running of the flash movie.
Hope this helps.
Sudipto S.
P.S : Follow me with my progress on Java Knowledge and Black Belts come to knowledgeblackbelt.com