hi there…
I’ve got this function, in which I declare a variable…
according to that variable I want to adress an instancename…
but it doesn’t work…
here’s the code:
[AS]function holdUp(){
_root.lightUp=“naam”+_root.index;
checkUp=_root.lightUp;
trace(checkUp);
_root.scroll.knoppen.checkUp._x=300;
}[/AS]
_root.index is activated when a button is clicked, and on that same button (after the index is activated) this function is called.
I allready tried using a different variable (checkUp) because I thought It might have been that… but apparently it isn’t…
what am I doing wrong?
robin
if you want to address an object dynamically, you need to do something like this:
_root[“ObjectName” + Index]._x = 300;
and what do you mean by objectname?
the instancename itself? because that’s the part I want to be automatisized…
the ‘stringmanipulationthingie’ works… so that’s what I want to do… but I want to be able to put that variable in a string where you usually put your instancename…
robin
ok, I replied to soon…
got it working with _root.scroll.knoppen[checkUp]._x=300;
thanx a lot mate!
robin
Okay let me put it this way instead, if the instance name you’re trying to address is stored in a variable called ‘ObjectName’ then you’d put this:
_root[ObjectName]._x = 300;
you can put anything you like inside the square brackets to create the object name, in my first example I used a string plus an index number, which you might use if you had a series of objects. E.g. if you’re objects were called Obj1, Obj2, Obj3 etc., then you’d put something like thie:
_root[“Obj” + Index]._x = 300;
where index is an integer variable
hope this helps