Intermediate AS question
- Started
- Last post
- 11 Responses
- fues
I have a function on a button:
on (release) {
rescale(_root.bar2.bar4.bar5);
}Now I want different objects to rescale.. I have tried this with an array but I think I have misdefined it.
Can you help?
Thanks peops!
- unfittoprint0
why not:
on (release){
rescale(_root.bar1);
rescale(_root.bar2);
rescale(_root.bar3);
}
- fues0
I want to cut down on the script as much as possible.. thanks anyway..
- unfittoprint0
Ok, I understand...
and if...
on(release){
for (i=0; i<myArray.length, i++){
rescale(_root["bar"+i]);
}
}
- unfittoprint0
damn, newstoday formatted my 'reaction'... i'll email you.
- fues0
Okay :-]
- fues0
But: the paths to the objects differ (they aren't located on the same level).
I have tried:
myList= new Array(_root.bar1, _root.bar2.bar3, _root.bar1.bar3)and then "rescale(myList") but doesn't work...
- unfittoprint0
you can't do it at once... you'll have to loop the different 'members' of your array (example: with a for loop,..) and implement the rescale action within each loop...
- fues0
Thanks unfittoprint.. so the best alternative is to rescale them seperately like you first said?
- unfittoprint0
A for loop does'nt parse the different array members at frame rate, it depends only on the user processing capability, so it will seem like the 'rescaling' it's done all at the same time.
Tot ziens.
- fues0
Bedankt =-)
- unfittoprint0
hmmm.
ok how about this:
//construct array
myArray = new Array("_root.bar1","_root.bar2.b...//rescale function (the _xscale parameter is just an example...)
function rescale() {
for (i=0, i<myArray.length, i++){
this[myArray[i]]._xscale = 100
}
}on (release){
rescale();
}hope it get's the job done.