Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently January 9th, 2025, 9:20 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: display variable to x decimal places
PostPosted: September 4th, 2008, 11:21 am 
Offline

Joined: March 26th, 2008, 2:51 pm
Posts: 5
Hi All,

I've just started using Opus Pro after upgrading from Illuminatus V2.81!

I've managed to cobble together a script which displays the mouse position on the screen as a fraction, ie far left = 0, far right =1, but can't seem to find a way to display only 2 decimal places...

I'm sure this must have been asked before, but as usual I've checked the manual and search the forum to no avail!

Please help!

Edit:
Sorry chaps, just found the String.format command - problem solved!


Top
 Profile  
 
 Post subject:
PostPosted: September 5th, 2008, 9:09 am 
Offline

Joined: March 26th, 2008, 2:51 pm
Posts: 5
problem not solved! :oops:

using the String.format("1.2",x) command displays the variable to 2 decimal places in the preview, but when exported to flash the variable isn't displayed on the screen - any ideas?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: September 5th, 2008, 9:43 am 
Offline
Godlike
Godlike
User avatar

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

Perhaps that command is not supported under flex.

There is however an old programming trick that should work.

Multiple the number by 100 (for 2dp) then use Math.round to remove the fraction then divide the number by 100.

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 5th, 2008, 11:21 am 
Offline

Joined: March 26th, 2008, 2:51 pm
Posts: 5
Of course!

Many thanks!


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 63 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