Digital Workshop

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: script in Flash
PostPosted: September 27th, 2009, 7:48 pm 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
I like to make a flash application and therefor i need to use this script:
-------------------------------------------------------------------------------
function TwoDigit(n)
{
return ((n > 9) ? "" : "0") + n
}

function ConvertTime(sec)
{
var min = Math.floor(sec/60)
sec = sec % 60
var hr = Math.floor(min/60)
min = min % 60

return TwoDigit(hr) + ":" + TwoDigit(min) + ":" + TwoDigit(sec)
}
-----------------------------------------------------------------------------

but this scrip don't work in flash while a simple script to set position or a show, hide script works fine.
Any suggestions?


Ad


You do not have the required permissions to view the files attached to this post.

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


Top
 Profile Visit website  
 
 Post subject:
PostPosted: September 28th, 2009, 2:46 am 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
I've put your script into a simple example and it works for me in v9 player and v10 in browser.
Flash version in IE browser I'm using is 10.0.32.18.

Paul


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
 Post subject:
PostPosted: September 28th, 2009, 6:28 am 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Thanks Paul, it works but what did i do wrong? I am not that good in scripts but i like to learn it.

Kind regards,

Ad

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


Top
 Profile Visit website  
 
 Post subject:
PostPosted: September 28th, 2009, 8:14 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi Ad,

You didn't do anything wrong in the script. You just can't use a constant expression like that in Flex.

You have to display a variable on screen and execute the function in a script passing the result to the variable on screen.

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:
PostPosted: September 28th, 2009, 10:54 pm 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
Hi Ad,
you have to display a variable not an expression like <ConvertTime(INPUT)>.
All you do is equate the expression to a variable, then display the variable.

I've added a short script to the text input box to trigger the ConvertTime function, and changed the function slightly so it outputs to a variable tDis.

cheers
Paul


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
 Post subject:
PostPosted: September 29th, 2009, 6:39 am 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Ok, it's gone be nicer every time...

Thanks

Ad

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


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

All times are UTC [ DST ]


Who is online

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