Digital Workshop

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: resetting object position
PostPosted: February 22nd, 2007, 4:17 pm 
Offline

Joined: November 21st, 2004, 1:15 pm
Posts: 39
Location: Wales
Opus: Opus Pro v9.5
OS: Windows 7 & Windows 8
System: iMac (with Bootcamp dual boot for Windows) + Sony VAIO laptop
I posted this earlier in the 'Basics' forum in error. I wonder if anybody here can help me.

I have used a script to 'shuffle' objects on the screen at random, which is working fine. But when I use those objects in a drag and drop activity with drag and drop properties set to 'return to original position if not dropped' they return to where they were initially located on the screen or in fact off the screen.

Is there a way for the 'new' position set in the script to be remembered as their 'original' position?


For this message dpj has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: February 22nd, 2007, 8:42 pm 
Offline

Joined: November 11th, 2004, 1:43 pm
Posts: 172
Location: Buckinghamshire, UK
At the point where you have done the shuffle, you need to use the current positional data as the default for each object as follows

1). first read the new position details

Code:
var object_pos = this.GetDisplayData()

2). reset the objects display data

Code:
//Object
var DisplayObj = new Object()
DisplayObj.x = object_pos.x
DisplayObj.y = object_pos.y

this.SetDisplayData( DisplayObj )


Hope you can use these in your code, if not would be happy to see your code where you do the shuffle and can point you to how to use above...


For this message eomc40 has been thanked by : mackavi


Last edited by eomc40 on February 23rd, 2007, 4:33 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: February 23rd, 2007, 12:09 pm 
Offline

Joined: November 3rd, 2004, 8:05 pm
Posts: 22
Opus: Pro 9
OS: Windows 10 Home 64-bit
System: HP Spectre x360 Intel Core i7-8550U CPU @ 1.80GHz, 16Gb Ram
I would really like to see the code your using. Am trying to achieve something similar myself - but am struggling to get a working script to randomly display the items.

_________________
Adrian Murray
https://www.businesssed.co.uk
Supporting Business Education


For this message staffam has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: resetting object position
PostPosted: February 23rd, 2007, 4:41 pm 
Offline

Joined: November 21st, 2004, 1:15 pm
Posts: 39
Location: Wales
Opus: Opus Pro v9.5
OS: Windows 7 & Windows 8
System: iMac (with Bootcamp dual boot for Windows) + Sony VAIO laptop
The code that I have used for shuffling the cards can be found on a previous submission (including a downloadable example) by Steve H. I found it very useful and easily adaptable (for someone like myself with limited scripting skills).

viewtopic.php?t=1244&highlight=cards

But I haven't been able to reset the position of the cards to their shuffled position for drag and drop purposes. I'll have a try with eomc40's solution now.


For this message dpj has been thanked by : mackavi


Top
 Profile  
 
 Post subject: resetting object position
PostPosted: February 23rd, 2007, 8:56 pm 
Offline

Joined: November 21st, 2004, 1:15 pm
Posts: 39
Location: Wales
Opus: Opus Pro v9.5
OS: Windows 7 & Windows 8
System: iMac (with Bootcamp dual boot for Windows) + Sony VAIO laptop
eomc40

Thanks for your help - but still having problems. Can I email it to you? Tried on the email supplied here but was bounced back to me.


For this message dpj has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: February 24th, 2007, 11:00 pm 
Offline

Joined: November 11th, 2004, 1:43 pm
Posts: 172
Location: Buckinghamshire, UK
dpj
have updated my e-mail account.... post the .imp with section and will have a look for you...


For this message eomc40 has been thanked by : mackavi


Top
 Profile  
 
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: Google [Bot] and 47 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