We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › Javascript Embed Applet
Pages: 1 2 
Javascript Embed Applet (Read 9484 times)
Re: Javascript Embed Applet
Reply #15 - Jan 12th, 2007, 8:13pm
 
Smiley
yeaha!

here's a version with proper callbacks and a _loadingbar_:
http://bezier.de/xhtml/appletobject2.html

sorry, just realized the above code was broken for IE win .. fixed now.

here's the latest version with support for different fallbacks, different tags (applet, embed, object) and valid xhtml-strict:
http://bezier.de/xhtml/appletobject3.html

( i'm off to some testing and documenting .. will post the final link here)

F
Re: Javascript Embed Applet
Reply #16 - Jan 14th, 2007, 2:21pm
 
Just downloaded Opera so I could check my folio works in it (just discovered it's at number 10 in the top ten browsers used to look at my site, so I thought I'd get the cross-platform hee-bee-jee-bees out of the way).

appletobject3 works fine (so does my folio). I'm getting nothing out of appletobject2 though (and it works okay in the other browsers). All I get out of appletobject2 is a '#' at the end of the link.

Just thought you should know.
Re: Javascript Embed Applet
Reply #17 - Jan 14th, 2007, 4:44pm
 
hmm. #3 is the latest version 0.0.4, might be that i fixed something in there. have not done intesive testing with #2.

F
Re: Javascript Embed Applet
Reply #18 - Jan 15th, 2007, 5:35pm
 
Continues here:
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Integrate;action=display;num=1168878870
Re: Javascript Embed Applet
Reply #19 - Apr 25th, 2009, 10:15am
 
When a friend was looking over my work, he remarked how it would be nicer to see a preview of the applet, rather than it stalling the whole browser simply because you visited the page.

I've just added JQuery to my site, so I guessed this should be easy to implement. Ideally I wanted a play button where the applet should be, clicking on it would swap the div with the play button for an applet.

Here's what I came up with:

Code:

<script src="../../assets/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
// Create a run button in the div where the applet would be - div is named after applet
$(document).ready(function(){
appletRunButton("eye4anEye", 400, 350, "preview.png");
});
// Create the run button - optionally add a preview graphic the same size as the applet
function appletRunButton(name, width, height, preview){
var div_id = "#"+name;
$(div_id).width(width);
$(div_id).height(height);
var run_html = '';
var top = ((height/2) - 25);
if(preview === undefined); else{
run_html += '<img src="'+preview+'" />';
top -= height;
}
run_html += '<div id="runimg">';
run_html += '<img src="http://www.robotacid.com/assets/run.png" /></div>';
$(div_id).html(run_html);
var img = "#runimg";
$(div_id).css({cursor: "pointer", border:"solid 1px #333"});
$(img).css({position:"relative", top:top, left:((width/2) - 25), zindex:2});
$(div_id).click(function(){
appletHtml(name, width, height);
});
}
// Create applet html in the div reserved for the applet
function appletHtml(name, width, height){
var div_id = "#"+name;
var string = '<applet code="'+name+'" archive="'+name+'.jar" width="'+width+'" height="'+height+'" mayscript="true">';
string += '<param name="image" value="loading.gif" />';
string += '<param name="boxmessage" value="Loading Processing software..." />';
string += '<param name="boxbgcolor" value="#FFFFFF" />';
string += ' To view this content, you need to install Java from <a href="http://java.com">java.com</a>';
string += '</applet>';
$(div_id).html(string);
}
</script>


A tided up version is here:

http://www.robotacid.com/PBeta/eye4anEye/index.html

Haven't cross browser tested it yet, but it's certainly more user friendly. We all know how annoying it is when a video auto-streams on a web page - that's why they all have play buttons now.

What are other people's thoughts on this?
Re: Javascript Embed Applet
Reply #20 - Apr 28th, 2009, 12:04pm
 
Looks good.
Pages: 1 2