Digital Workshop

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Variable in object name
PostPosted: June 8th, 2005, 10:20 am 
Offline

Joined: April 21st, 2005, 4:47 pm
Posts: 43
Location: Southampton, UK
This question assumes that a set of objects already exist in the organiser with names such as Image1, Image2, Image3... etc. Is it possible in script to reference the objects using a variable as part of the object name, for instance via a for loop?

Thanks
Linnet

_________________
A crack on the head / Is what you get for not asking
And a crack on the head / Is what you get for asking

Barbarism Begins At Home, The Smiths


Top
 Profile  
 
 Post subject:
PostPosted: June 8th, 2005, 12:20 pm 
Offline

Joined: October 26th, 2004, 10:23 am
Posts: 666
Location: Digital Workshop
The "eval" function can be used in this situation:
Code:
for ( x = 1; x <= 10; x++ )
{
  eval("Image"+x).Hide();
}

Be careful not to go too mad with eval - you can easily overcomplicate a solution that could be achieved with normal actions or simpler functions that take an object as a parameter.


Top
 Profile Visit website  
 
 Post subject:
PostPosted: June 8th, 2005, 12:45 pm 
Offline

Joined: April 21st, 2005, 4:47 pm
Posts: 43
Location: Southampton, UK
Works a treat and saves 100 yards of code. Thanks.

_________________
A crack on the head / Is what you get for not asking
And a crack on the head / Is what you get for asking

Barbarism Begins At Home, The Smiths


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 1 guest


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