Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 10:06 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Opus Flex and Script Objects
PostPosted: April 29th, 2011, 5:30 am 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi,

I've been trying to get an Opus Flex (SWF) pub working and am having difficulty with a complex, lengthy math script.

In the survey, there are 4 scores finally produced. To complete scoring, these have to be statistically "processed" using a "probit" or "normalization" formula. The formula is in JS and can be seen at: http://home.online.no/~pjacklam/notes/i ... msinv.html

I've placed this complex formula into a script object, then call the function. While it works OK in preview (telling me that the maths work), it will not work once published in Flash SWF. Yet, when I've checked the SWF publishing log, no warnings or errors.

Regular math scripts work OK in Flex. So, I'm wondering if this problem is due to this script object's complex math calculations and length? Too many calculations? This math formula doesn't easily allow for breaking it into smaller parts, other work arounds that I can think of. But, maybe there is a way?

I'd like to get this working and would appreciate any help.

Regards,

_________________
Stephen


Top
 Profile  
 
 Post subject: Re: Opus Flex and Script Objects
PostPosted: April 29th, 2011, 12:58 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 thought I read in the help files (Flex and scripting) that you cannot call a function under Flex. Maybe that is not the 'right' wording.

If that is the case, there may be some workarounds... show or hide a Frame or other object, even off-page. Run a script under an on-show trigger. That may introduce other limitations... scope, etc.

[Lar EDIT:] Correction, functions ARE ALLOWED. (thanks, Mackavi). Check the Script Help Files for special advice on Flex.

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


Last edited by Lar_123 on April 29th, 2011, 7:59 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: Opus Flex and Script Objects
PostPosted: April 29th, 2011, 2:13 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Larry,

Wasn't aware of whether or not you can call a function using Flex, but I'll take a look. The item that is specified in the Opus help files-features not supported in Flex-is "synchronization triggers" which I've (maybe incorrectly) assumed means OnShow, etc.

I took another look at this complex math function, trying to adapt it so that it was no longer set up as a function, but I couldn't figure it out. I tried various adaptations but, while not showing any script errors, they also did produce any results. If you get a chance, take a look at the JavaScript function at the website in the posting above. Maybe you can suggest how to re-write it without the function call so that I could use it successfully in Flex.

Another option would be to try to post the 4 scores as web data to an ASP or PHP page, have the formula run there (if possible) and return the 2 final results back into the SWF. Seems like a round about way to do it. But, whatever works.

Thanks for your suggestions.

Regards,

_________________
Stephen


Top
 Profile  
 
 Post subject: Re: Opus Flex and Script Objects
PostPosted: April 29th, 2011, 7:33 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Functions are fine.

I might be way off, but it seems that Opus Flex is operating with Single precision floating point as all Number appears to be limited to six digits of precision. This simple test:

Code:
//display variable on screen
myValue = f()

function f()
{
return 45123.5456 / 2
}


Illustrates that Flex returns halve of 45123.5 not 45123.5456 :-? Though why the answer is allow seven digits - who knows!

As I said, might be well off, but I don't think it your script Stephen!

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Opus Flex and Script Objects
PostPosted: April 29th, 2011, 7:56 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
Stephen,
Mack's right. Functions are okay, so no need to pursue working around/changing that aspect.

Here is what I did not remember correctly about 'functions' limitation:
Quote:
Functions all return immediately. In OpusScript many functions do not return a value until the action they perform has completed (such as the Move() function). It is not possible to replicate this behaviour in Flash, therefore all functions return immediately.
There is some additional advice in the help files for potential scripting issues with Flex type.

You mentioned
Quote:
...synchronization triggers
I think that is quite specific, and not the general triggers. e.g., "synchronize to end" etc. -- where actions and events (?) can announce their end/beginning for other actions to detect and use.

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


Top
 Profile  
 
 Post subject: Re: Opus Flex and Script Objects
PostPosted: April 29th, 2011, 8:09 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Thanks Mack and Thanks Larry.

Mack, maybe I am misunderstanding about decimal points, but is there anything I can or should do about this in the script?

Larry, the issue of functions returning immediately in Flex may be affecting this: the project calls the function 4 times in one action. It runs the same function for each of 4 scores in succession.

I'm wondering if this somehow wipes out the previous return before it is processed in the next part of the script.

Here are the 4 calls:

Code:
var p = totalscore5a
var probit1 = NORMSINV(p)
var p = totalscore6a
var probit2 = NORMSINV(p)
var Dprime1 = probit1-probit2


followed in the same set of actions by:

Code:
var p = totalscore8a
var probit3 = NORMSINV(p)
var p = totalscore7a
var probit4 = NORMSINV(p)
var Dprime2 = probit3-probit4


(The "a" version of the these scores has had some additional processing before the first above and in between first and second above: if they are 0 or 1, they are changed to .001 or .999 for data integrity.)

I wonder if there is another way to write either the function (http://home.online.no/~pjacklam/notes/i ... msinv.html) and/or the 4 calls to separate them? I don't understand the maths enough to figure out how?

Regards,

_________________
Stephen


Top
 Profile  
 
 Post subject: Re: Opus Flex and Script Objects
PostPosted: April 29th, 2011, 8:26 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Not decimal points - single precision floating point.

It means that a value like -3.969683028665376e+01 will be treated as -39.6968 in Flex. A very small difference, but in your calculation a huge difference - I guess.

As for a work-around / solution - I'm not even sure if it's the problem. You'd have to check with DW!

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 41 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