Hi everyone,
I'm trying to bring objects to the foreground, so I'm using the setZorder() function with 1000000 paramater.
for(var i = 0 ; i < objectList.length ; i++){
objectList[i].setZOrder(1000000);
}
Some objects are brought to the foreground and some aren't.
Does someone have an explanation or a work around ?
cheers
Hi Jordan,
there are two ways to solve the problem:
1) send all the occurrences of the model to the background with setZOrder(0) and then bring some of them to the front with setZOrder(N>0);
2) check all the occurrences on the model with getZOrder and get max ZOrder. Then bring some of the occurrences to the front with setZOrder(max+1).
---
BR, Nikita
Hi Nikita,
Thanks for your answer,
I also found another solution.
In my script, I'm adding new Objects to a model and straight after an object is created , I apply the function. setZOrder, but still didn't work.
So what I did is that, after that all the objects were created, I create a separate for loop that runs on all the objects and apply setZOrder and it works.
Here is a pseudo code illustrating my solution
This solution didn't work:
for x:
doSomeThing()
for y:
createObject()
apply setZOrder Function for each object created
This solution worked :
for x:
doSomeThing()
for y:
createObject()
for z:
ApplySetZOrder()