View Single Post
  #9  
Old 11-26-2009, 02:21 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
I don't think you have a clear grasp of the way objects work.

PHP Code:
temp.obj = new TStaticVar();

obj.test "foo";
echo(
obj.test); // echoes foo

obj.test 1;
echo(
obj.test); // echoes 1

obj.destroy(); // destroys the object 
You can also do it with global names

PHP Code:
temp.obj = new TStaticVar("MyObject");

MyObject.test "foo";
echo(
MyObject.test); // echoes foo 
The same works for GUI controls

PHP Code:
new GuiShowImgCtrl("MyGuiImage") {
  
image "block.png";
  
  
32;
  
64;
  
  
width 32;
  
height 32;

then in another script you can call

PHP Code:
MyGuiImage.image "bcalarmclock.png";
MyGuiImage.16
or change any other variables, as long as you know the object name; you can also use dynamic object names:

PHP Code:
for (temp.05++) { // make 5 images
  
new GuiShowImgCtrl("MyGuiImage_" i) {
    
image "block.png";
    
    
32 + (33);
    
64;
    
    
width 32;
    
height 32;
  }

then you could do something like this:

PHP Code:
MyGuiImage_0.image "bcalarmclock.png"
which would change only the first image's image. If you wanted to change all the images, you could do:

PHP Code:
for (temp.05++) {
  (@ 
"MyGuiImage_" i).image "bcalarmclock.png";

However, in your case, I don't think you will need to use dynamic objects. I think you mistakenly used them in your initial post, though I could be wrong.
__________________
Reply With Quote