Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 23rd, 2024, 2:23 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Web pub interacting with HTML or javascript
PostPosted: November 9th, 2004, 8:54 pm 
Offline

Joined: November 3rd, 2004, 7:18 pm
Posts: 8
Location: New Zealand
Hi all,
Has anyone managed to get an Opus web pub to read javascript or HTML variables off the page it is sitting in , or will I have to use a server side method to pass variables to the pub with the InternetGetData() function?

cheers
Paul


For this message Paul Gresham has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Web Pub and variables
PostPosted: November 9th, 2004, 9:24 pm 
Offline

Joined: November 3rd, 2004, 2:11 pm
Posts: 323
Are you using the Flexed version of the Opus pub or the IOed version?


For this message bwpatric has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: November 9th, 2004, 9:28 pm 
Offline

Joined: November 3rd, 2004, 7:18 pm
Posts: 8
Location: New Zealand
Sorry,
I am using the IO'd version.
I would have searched the old forum for clues --but someone appears to have been over-zealous and nuked it.
cheers
Paul


For this message Paul Gresham has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: November 10th, 2004, 12:38 pm 
Offline

Joined: November 4th, 2004, 10:55 am
Posts: 5
Location: Digital Workshop
Hi Paul,

If you look in the published Opus html file you will see that there is an object called "ilm", this is the publication object and there is a function available to javascript called SetVariableString.
So, in order to set the variable in your publication from javascript you can use the following code:

ilm.SetVariableString("OPUS_VARIABLE", javascript_variable);

However, this assumes that you want to control things from the HTML side, if you want to get variables from the Opus side then things get a lot more complicated. First you need to put the above code into a function so it can be called from Opus using the LaunchURL script function.
So on the HTML side you will need:

function ILMGetVariable(opus_variable, javascript_variable)
{
ilm.SetVariableString(opus_variable, javascript_variable);
}

On the opus side you use the following code:

LaunchURL('javascript:'+'ILMGetVariable("opus_variable_name", "javascript_variable_name")', '_self');

The real problems start if you need to access more than one variable in succession, in this situation javascript commands can be lost as Opus has no way of knowing how long the previous command will take to complete before sending the next one.
In order to get round this problem it is necessary to keep a command queue in OpusScript and set a command completion variable from the javascript side in order to notify the Opus side that it can send the next command safely.
Also as a final drawback, due to the differing standards across browsers, this code will only work in Internet Explorer and you will need the latest Opus service release.

Hope this helps,

Damion Kelly

DW


For this message Damion Kelly has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: November 10th, 2004, 6:35 pm 
Offline

Joined: November 3rd, 2004, 7:18 pm
Posts: 8
Location: New Zealand
Thanks Damion,
the info you gave is much appreciated -- you learn something every day around here.
Opus's LaunchURL works in a similar way to Flash's getURL function.
I think using a php or cgi script is the way to go for me -- life will be easier.

thanks
Paul


For this message Paul Gresham has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Web pub interacting with HTML or javascript
PostPosted: May 29th, 2007, 11:48 am 
Offline

Joined: November 11th, 2004, 1:43 pm
Posts: 172
Location: Buckinghamshire, UK
Anyone had success in this setup, having a flex pub "read in" data from html via javascript, an example will be appreciated...
eomc40


For this message eomc40 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Web pub interacting with HTML or javascript
PostPosted: May 6th, 2010, 9:57 am 
Offline

Joined: May 24th, 2007, 11:02 am
Posts: 132
Location: UK - Wales - Ceredigion
Opus: illuminatus > Evolution
OS: Windows 10 Pro
System: i7 8GB RAM
Does this still work?

Where would one put the "ilm.SetVariableString("OPUS_VARIABLE", javascript_variable);" in the HTML that is generated?

I need to pass some variables to flex/flash in the html and need this function.

Is there another way if not?

Also, the generated HTML JavaScript shows the error box in IE7? Is there a fix?


For this message jezjones29 has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: Web pub interacting with HTML or javascript
PostPosted: May 6th, 2010, 1:22 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
Jez,

Thanks for raising this question and resurrecting this old thread. It is timely as I am looking to do/learn something similar. So I started probing around a bit.

First, here is a handy website for some of the basics of Javascript in webpages. (see side menu there too, for more topics)
http://www.w3schools.com/js/js_examples.asp

Then I started looking at the html source code OpusPro produces when you publish to Flex. Try it. Open the file with Notepad++, Crimson Editor, or similar. Look down at Line ~200 and following. Also look around Lines ~300, ~500. It seems there is quite a lot of code pre-written (for SCORM for example)... that shows how this works.
Code:
PubName_asPublished.SetVariable("LMSINITIALIZE_RETURN", "NOAPI");

However, I wonder why that is different syntax/command than that given in previous post Nov 2004... SetVariableString.
Code:
ilm.SetVariableString("OPUS_VARIABLE", javascript_variable);



Anyone have any idea why all that code is included but commented out (published for Flex/Flash)?

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Web pub interacting with HTML or javascript
PostPosted: May 6th, 2010, 3:03 pm 
Offline

Joined: May 24th, 2007, 11:02 am
Posts: 132
Location: UK - Wales - Ceredigion
Opus: illuminatus > Evolution
OS: Windows 10 Pro
System: i7 8GB RAM
It should be simple to do.

I use other flash programs but wanted to use Opus for this project.

Normally I would use the swfobject method

Example: GoogleCode has the JavaScript file needed

Code:
<div id="myDiv" >
You need <strong>Flash player 8+</strong> .....   
</div>

<script type="text/javascript"> 
var flashvars = {test_var: "1"};
var params = {menu: "false" };
swfobject.embedSWF("demo.swf","myDiv", "129", "23", "8", NULL, flashvars, params)
</script>


For this message jezjones29 has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: Web pub interacting with HTML or javascript
PostPosted: May 6th, 2010, 11:27 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
I have almost no experience with JS and little with html. I may get into playing around some with this towards the weekend or next week. Let us know if you come up with anything halfway working.

BTW, one thing I read on 'where to put JS functions' said in the Header (to make sure func's are read early) or in the Body.

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Web pub interacting with HTML or javascript
PostPosted: June 17th, 2010, 4:34 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
Bump.

I've tried the Opus LaunchURL command as outlined by Damion Kelly back in 2004, but no luck.
Code:
LaunchURL('javascript:'+'ILMGetVariable("opus_variable_name", "javascript_variable_name")', '_self');

I get an error over in Firefox
Quote:
Firefox can't find the file at /G:/OpusPubs_1/javascript:ILMGetVariable(opus_var02,javascript_var02).


I am not working in Flex. I have a full Opus Pub with a Browser object... which is where I open a local HTML file. That is the file that holds the ILMGetVariable function as shown in the earlier Post as well.

(what I am trying to do is pickup the value of an Opus variable and use that to change the font-size of the content in the Browser object).

I am struggling with the Opus side of things.
Anyone have an example pub and html file.

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 46 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group