Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently October 5th, 2024, 8:35 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Cloned object variables and drop zones
PostPosted: January 24th, 2005, 10:54 am 
Offline

Joined: November 11th, 2004, 1:43 pm
Posts: 172
Location: Buckinghamshire, UK
Dear All,

I am making use of clone facility (var myClone = a.CloneObject()) to replace a dropped object and realised that the new item is named as follows

<original object><.><number>

i.e. a.2147483648

Now I need to drop any of the cloned objects from a drop zone, simulating, clearing of the field. The command I have tried to use complain since the syntax

objectname.ResetAnimation("ALL",1.0)

will assume that objectname doesn't have an "." in its name else opus assumes I am running a function i.e. 2147483648 from above example.
Is there a way to force the clone to assign a particular naming criteria or renaming an object in script?

From the sample page, I have been working on letter A highlighted.

To simulate a clear, click on the dropzome.

The action required hence would be for the 'clear' to only occur for the clicked zone.


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


For this message eomc40 has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: January 25th, 2005, 5:23 pm 
Offline

Joined: October 25th, 2004, 12:27 pm
Posts: 526
Location: Digital Workshop
Hi,

Thank you for your enquiry.

To keep track of multiple cloned objects, it is a good idea to ensure that the object name given to the clone is unique. For example, say you have created a variable named 'num' with a default value of 0, and have then applied the following script actions to a button:

Code:
eval("clone" + num + "= Circle.CloneObject()")
num++


The first time the above script is run, it will create a clone of the object 'Circle' and this clone will be given the name 'clone0' (i.e; the string 'clone' plus the current value of the 'num' variable).

As the 'num' variable is increased, the next time these actions are called, the new clone will be called 'clone1' and we can easily differentiate this from the original clone. For example, the following code:

Code:
clone0.DestroyCloneObject()


will destroy the first clone created, but leave all subsequent clones unaffected.

Please find below a link to download a sample publication which expands on this idea. This publication contains three dropzones which each have their own array (a[], b[] and c[]). Each time a cloned object is dropped into one of these dropzones, the name of the clone is stored to the relevant dropzone array and the 'num' variable is increased.

I have then added a button next to each dropzone which use a for...next loop to destroy each of the cloned objects in the adjacent dropzone's array, without affecting any of the clones which have been dropped on the other two dropzones.

I hope this helps. Please do not hesitate to contact me if you have any further queries.

Kind regards,


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

_________________
Robin Garrett
Digital Workshop Technical Support


For this message Robin Garrett has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: January 26th, 2005, 12:59 pm 
Offline

Joined: November 11th, 2004, 1:43 pm
Posts: 172
Location: Buckinghamshire, UK
Thanks Robin,

Exactly the required functionality.


For this message eomc40 has been thanked by : mackavi


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

All times are UTC [ DST ]


Who is online

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