You need to create some type of manager that will set the zIndex of
all of the layers you have.  You should set the zIndex of the layer
you click on and then set the zIndex of all of the other layers to
something lower.  Or maybe try something like this:

// assumes all of your layers are in a global mylayers array.

function setAllLayers() {
for (var i=0;i<mylayers.length;i++) {
    mylayers[i].setZIndex(-1);
}

myListenerDrag=new EventListener(myLayer)
myListenerDrag.ondragstart=function(e){
    o=e.getTarget();
    setAllLayers();
    o.setZIndex(+100)
   }
  myListenerDrag.ondragend=function(e){
    o=e.getTarget();
    o.setZIndex(-100)
   }
 myLayer.addEventListener(myListenerDrag)

-- 
// Robert Rainwater

On 2/24/2001, 1:23:03 AM EST, doug wrote about "[Dynapi-Help] how to make layer come 
to top when clicked?":

> that worked FANTASTICALLY except that it only seems to want to do it once.. 
> what i'm trying to create is basically like multiple windows and i want to be 
> able to bring whichever one is clicked to the front.. i can clikck on it once, 
> bring it to the front, then click something else and bring it up, but i can't 
> go back ot the last one..a ctually.. it hink i can never move above something 
> that i did a setZindex on..

> Quoting Richard Bennett <[EMAIL PROTECTED]>:

>> Something like:
>> 
>>  myListenerDrag=new EventListener(myLayer)
>>  myListenerDrag.ondragstart=function(e){
>>    o=e.getTarget();
>>    o.setZIndex(+100)
>>   }
>>  myListenerDrag.ondragend=function(e){
>>    o=e.getTarget();
>>    o.setZIndex(-100)
>>   }
>> myLayer.addEventListener(myListenerDrag)
>> 
>> Cheers,
>> Richard Bennett
>> 
>> [EMAIL PROTECTED]
>> www.richardinfo.com
>> (Everything running on, and ported to the 19/12/2000 snapshot of DynAPI2)
>> Find the DynAPI faq here:
>> http://sourceforge.net/docman/display_doc.php?docid=656&group_id=5757
>> Browse the mailinglist here:
>> http://www.mail-archive.com/index.php3?hunt=dynapi
>> 
>> 
>> ----- Original Message -----
>> From: "doug moore" <[EMAIL PROTECTED]>
>> To: <[EMAIL PROTECTED]>
>> Sent: Friday, February 23, 2001 10:28 PM
>> Subject: [Dynapi-Help] how to make layer come to top when clicked?
>> 
>> 
>> > When using the drag methods in DynAPI 1 the layer you clicked would come
>> to the
>> > top when you clicked on it.  that doesn't appear to be the case in
>> DynAPI2.. is
>> > there a way to do this?
>> >
>> > thank you,
>> >
>> > doug.
>> >
>> > _______________________________________________
>> > Dynapi-Help mailing list
>> > [EMAIL PROTECTED]
>> > http://lists.sourceforge.net/lists/listinfo/dynapi-help
>> > ____________________________________________________________
>> > Get your domain name and domain-based e-mail from
>> > Namezero.com. New!  Namezero Plus domains now available.
>> > Find out more at: http://www.namezero.com
>> >
>> 
>> 
>> _______________________________________________
>> Dynapi-Help mailing list
>> [EMAIL PROTECTED]
>> http://lists.sourceforge.net/lists/listinfo/dynapi-help
>> 


> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-help


----------------------
DynAPI Snapshots: http://dynapi.sourceforge.net/snapshot/
DynAPI Homepage: http://dynapi.sourceforge.net/



_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help

Reply via email to