I also think the findLAyers() code should be a method of the DynDocument and
not the DynAPI. This way you can do:
DynAPI.document.findLayers()
Without having to specify any parameters. This would be the code:
DynDocument.prototype.findLayers=function() {
var divs=[]
dyndoc=arguments[0]||this
or=arguments[1]||dyndoc
if (is.ns4) divs=dyndoc.doc.layers
if (is.ns5) divs=dyndoc.doc.getElementsByTagName("DIV")
if (is.ie) divs=dyndoc.doc.all.tags("DIV")
for (var i=0; i<divs.length; i++) {
if(DynAPI.isDirectChildOf(divs[i],dyndoc.elm)) {
var id=is.ns4? divs[i].name : divs[i].id
var dlyr=new DynLayer(id)
dlyr.parent=dyndoc
dlyr.assignElement(divs[i])
dlyr.dyndoc=or
if (dyndoc.getClass()!=DynDocument) dlyr.isChild=true
if (or.getClass()!=DynDocument) dlyr.isChild=true
else {
or.children[or.children.length]=dlyr
or.elements[dlyr.id]=dlyr
}
var index=id.indexOf("Div")
if (index>0)
dyndoc.doc.window[id.substr(0,index)]=dyndoc.elements[id]
if (is.ns4) {
for (ict in dlyr.doc.images)
dlyr.doc.images[ict].lyrobj=dlyr
} else if (is.ns5) {
for (ict in dlyr.doc.images) {
dlyr.doc.images[ict].lyrobj=dlyr.elm
}
} else {
for (ict in dlyr.elm.all.tags("img"))
dlyr.elm.all.tags("img")[ict].lyrobj=dlyr
}
if (dlyr.updateValues) dlyr.updateValues()
this.findLayers(dlyr,or)
}
}
}
If I remember correctly, I only changed the first few lines in this method.
Pascal Bestebroer
[EMAIL PROTECTED]
http://www.dynamic-core.net
> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]Namens Jordi 'IlMaestro'
> Ministral
> Verzonden: woensdag 13 december 2000 17:45
> Aan: [EMAIL PROTECTED]
> Onderwerp: Re: [Dynapi-Help] DynAPI.findLayers
>
>
> I don't know what is happening to the drag event, but I can tell
> what is the
> 'or' parameter. The findLayers method is a recursive method, taht
> is, calls
> itself. The second parameter is a way of passing needed
> information between
> calls of the function. It is not meant to be used when the user calls the
> method.
>
> Let me take a look at the findLayer's code.
>
> Cameron Hart wrote:
>
> > Hi all,
> >
> > I'm trying to do something weird and as usual it's not working
> quite how I'd
> > expect...
> >
> > What I'm trying to do is loading a page into a LoadPanel. Nothing weird
> > about that. The page contains inline layers and some onclicks
> to show/hide
> > the inline layers. To do this I first have to 'find' the inline
> layers so I
> > can call setVisibility() on them. So on onclick I'm calling
> > DynAPI.findLayers(DynAPI.document) first to find the layers and
> then doing
> > the show/hide with
> >
> DynAPI.document.all['<inlineLayerName>'].setVisible(<true|false>). This is
> > actually working. It's a very stupid way of doing things, but
> it works which
> > is good enough for the time being. The problem is that after calling
> > DynAPI.findLayers(DynAPI.document) I lose all the drag events
> for all the
> > layers I have on screen. I'm probably losing all events, but I
> only noticed
> > drag events not working. Why????
> >
> > I noticed that DynAPI.findLayers takes 2 parameters, 'dyndoc'
> and 'or'. I
> > presume dyndoc, is a DynDocument object. Can this be set to a
> DynLayer, for
> > example the LoadPanel I've loaded the page into? I have no idea what the
> > parameter 'or' is for.
> >
> > Is there another way of doing this (apart from not loading the
> page from an
> > external html file into a LoadPanel)?
> >
> > Thanks in advance for any light people out there can shed on the matter!
> >
> > Cameron
> >
> > _______________________________________________
> > Dynapi-Help mailing list
> > [EMAIL PROTECTED]
> > http://lists.sourceforge.net/mailman/listinfo/dynapi-help
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/mailman/listinfo/dynapi-help
>
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/mailman/listinfo/dynapi-help