Digital Workshop

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: script for random spinner
PostPosted: July 13th, 2008, 3:03 pm 
Offline

Joined: May 2nd, 2008, 9:09 pm
Posts: 9
I would like to create an object which will spin randomly when clicked.
Something like the spinning arrow on various educational spinner wheels.

I see some examples of scripts like the following in various resources but I cannot figure out how to implement this in Opus.
Examples of spinner scripts:
on(press){
object.spinning = true
object.spin = 12 + Math.random()*20
object._rotation = object._rotation = 0
}

if (spinning){
if (spin <= 0){
spinning = false
rot = (_rotation < 0) ? 180 + _rotation : _rotation
_root.youSpunA = Math.floor(16 * rot/180)+1
}else{
_rotation += spin -= .25
_parent.wheel._rotation = -_rotation
}
}
}


Any help on this will be greatly appreciated.

_________________
Opus Pro
Windows XP


Top
 Profile  
 
 Post subject:
PostPosted: July 13th, 2008, 5:00 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
This is rather advanced scripting. Unless you need something this complicated - you could use Opus actions.

See example. Click the spinner hand to spin.

Mack


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

_________________
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: July 13th, 2008, 6:03 pm 
Offline

Joined: May 2nd, 2008, 9:09 pm
Posts: 9
Hi Mack,
This is perfect. Greatly appreciated. I hope to learn more scripting by following your example.
Thanks again.

_________________
Opus Pro
Windows XP


Top
 Profile  
 
 Post subject:
PostPosted: July 14th, 2008, 4:33 am 
Offline

Joined: May 2nd, 2008, 9:09 pm
Posts: 9
Hi Mack,
Sorry to bother you again.
Your publication spins fine when in preview mode.
But when published to flash, spinner does not work. I am baffled and dont understand why.

I have also attached an imp file that I created using your as an example.

could you please help again.
Kind regards


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

_________________
Opus Pro
Windows XP


Top
 Profile  
 
 Post subject:
PostPosted: July 14th, 2008, 10:01 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
That's because you've published to SWF. Most the functions in Opus are not available in Flash publications.

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: July 14th, 2008, 3:54 pm 
Offline

Joined: May 2nd, 2008, 9:09 pm
Posts: 9
Thank you very much again Mack. That explains what was happening.

Maybe someone from digital workshop can offer some advice here. I use Promethean Activstudio in my classroom. So far all publications I made with Opus Pro were published to SWF . This worked great because I then could embed the output SWF files inside ActivStudio. This created a wonderful seamless learning environment.

The next best option when ouput to swf does not work is the standalone publication mode I guess where a single EXE file is generated and this can be embedded inside Promethean Activstudio.

Unfortunately htm file cannot be embedded in Activstudio. I even tried to save the htm file output as mht but that did not work.

_________________
Opus Pro
Windows XP


Top
 Profile  
 
 Post subject:
PostPosted: July 14th, 2008, 6:07 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
This spinner should be SWF compatible.

Mack


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

_________________
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: July 15th, 2008, 1:31 am 
Offline

Joined: May 2nd, 2008, 9:09 pm
Posts: 9
Thanks again very much Mack.
yes indeed this does work in swf format.

I was looking through the two variables that you used.
I understand how the "myrandom" variable works with a max value of 4

I see that you also declared another variable called "mytick" which is set to -1.

But I do not understand how "myrandom" interacts with "mytick".

Could you help me understand how this all works so nicely?
Thanks again.

_________________
Opus Pro
Windows XP


Top
 Profile  
 
 Post subject:
PostPosted: July 15th, 2008, 7:48 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
The myTick variable is control via a ticker action on the page. It increments 1 per second. The start button resets this and starts the count again until myRandom is reached which triggers the stop action.

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: July 15th, 2008, 7:48 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Ignore this one - it posted twice!!

What happens when you post b4 coffee :-)

_________________
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  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

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