From: Ed M. <Ed...@to...> - 2000-11-15 16:12:24
|
It looks like I'm going to have to create my layers as inline layers and then try to use DynAPI object wrappers around them. That's not too bad, but I'm most interested in using DynAPI for event handling, and I'm having trouble creating an appropriate object reference to an inline layer. The tutorial (section 5)describes the following usage for using DynAPI methods on inline layers (I'm getting the X coordinate of an inline layer named "mapLayer"): DynAPI.document.all['mapLayer'].getX () and this works fine. However, I can't figure out how to create an object reference to this layer so I can pass it as a parameter when needed - specifically, I need to create an event listener and mapListener = new EventListener (DynAPI.document.all['mapLayer']); doesn't work. Neither does: mapLayer = DynAPI.document.all['mapLayer']; and I can't figure out why. I'm digging through the source, but sage pointers in the right direction would be very much appreciated. I'm in the general position of having to create just about all of my layers as inline layers, but I'd then like to create DynAPI objects that wrap them so I can treat them just as if I had created them as DynLayer objects. Thanks again! - Ed Ed McNierney Executive Vice President and Chief Mapmaker TopoZone.com / Maps a la carte, Inc. 73 Princeton Street, Suite 305 North Chelmsford, MA 01863 (978) 251-4242 ed...@to... www.topozone.com -----Original Message----- From: Sam Douglass [mailto:sa...@eb...] Sent: Tuesday, November 14, 2000 6:59 PM To: dyn...@li... Subject: [Dynapi-Help] Another newbie ? re: setURL() in IE Hi, sorry to post a newbie question here, but I'm trying to load an external HTML file into a dynlayer and am having a problem that I don't think I saw addressed in the list archives available over the Web. I have one simple layer into which I want to load a simple external file: <SCRIPT LANGUAGE="JavaScript"><!-- DynAPI.setLibraryPath('Core/lib2.0/') DynAPI.include('core.api.*') DynAPI.include('core.ext.loadhtml.js') DynAPI.onLoad=function() { testlayer = new DynLayer(null,100,100,143,16,"#ffffff") testlayer.setURL("ext.html") DynAPI.document.addChild(testlayer) } //--></SCRIPT> This works great in Netscape 4.73, but doesn't work in IE 5.0. I think I tracked down the error, but I'm not sure what to do about it. In the file "core.ext.loadhtml.js" there is a property called "DynAPI.setURL.current" which appears to be initialized to null (last line of the file). This is causing an error here on line 18, I think: 15: DynLayer.prototype.onLoad=function(e) { 16: var lyr 17: if (is.ie) { 18: lyr=document.all[DynLayer.prototype.setURL.current].lyrobj 19: lyr.elm.innerHTML=e 20: } else if (is.dom) { I'm getting "document.all[...].lyrobj is not an object" which seems to fit with using a null object as a reference into the document.all[] array. So the "current" propery should be a layer id tag, but which one? Or am I way off on what's happening here? Anyway, if anybody read this far and knows how to make this work in IE, I'd be immensely grateful for any help. If this is a known bug that's being worked on that's not up on SourceForge yet, or if I'm doing something stupid like not including the right files or something, sorry about the dumb post, but I would still appreciate a heads up. Thanks! Sam Douglass PS The API is awesome, and tremendously useful! Thanks to the development team for all the hard work they've put into it. _______________________________________________ Dynapi-Help mailing list Dyn...@li... http://lists.sourceforge.net/mailman/listinfo/dynapi-help |
From: Pascal B. <pa...@dy...> - 2000-11-15 19:04:05
|
The strange thing is that this method: myLayer = DynAPI.document.all['mapLayer'] should work.. maybe the problem you'r having is that you name your variable also mapLayer (the same as the inline layer) I think IE chokes on that, so try using another name for it. Pascal Bestebroer pa...@dy... http://www.dynamic-core.net > -----Oorspronkelijk bericht----- > Van: dyn...@li... > [mailto:dyn...@li...]Namens Ed McNierney > Verzonden: woensdag 15 november 2000 17:12 > Aan: 'dyn...@li...' > Onderwerp: [Dynapi-Help] Creating object references to inline layers > > > It looks like I'm going to have to create my layers as inline layers and > then try to use DynAPI object wrappers around them. That's not > too bad, but > I'm most interested in using DynAPI for event handling, and I'm having > trouble creating an appropriate object reference to an inline layer. > > The tutorial (section 5)describes the following usage for using DynAPI > methods on inline layers (I'm getting the X coordinate of an inline layer > named "mapLayer"): > > DynAPI.document.all['mapLayer'].getX () > > and this works fine. However, I can't figure out how to create an object > reference to this layer so I can pass it as a parameter when needed - > specifically, I need to create an event listener and > > mapListener = new EventListener (DynAPI.document.all['mapLayer']); > > doesn't work. Neither does: > > mapLayer = DynAPI.document.all['mapLayer']; > > and I can't figure out why. I'm digging through the source, but sage > pointers in the right direction would be very much appreciated. > I'm in the > general position of having to create just about all of my layers as inline > layers, but I'd then like to create DynAPI objects that wrap them so I can > treat them just as if I had created them as DynLayer objects. > Thanks again! > > - Ed > > Ed McNierney > Executive Vice President and Chief Mapmaker > TopoZone.com / Maps a la carte, Inc. > 73 Princeton Street, Suite 305 > North Chelmsford, MA 01863 > (978) 251-4242 > ed...@to... > www.topozone.com > > > -----Original Message----- > From: Sam Douglass [mailto:sa...@eb...] > Sent: Tuesday, November 14, 2000 6:59 PM > To: dyn...@li... > Subject: [Dynapi-Help] Another newbie ? re: setURL() in IE > > > Hi, sorry to post a newbie question here, but I'm trying to > load an external HTML file into a dynlayer and am having a problem > that I don't think I saw addressed in the list archives available over > the Web. I have one simple layer into which I want to load a simple > external file: > > <SCRIPT LANGUAGE="JavaScript"><!-- > DynAPI.setLibraryPath('Core/lib2.0/') > > DynAPI.include('core.api.*') > DynAPI.include('core.ext.loadhtml.js') > > DynAPI.onLoad=function() { > testlayer = new DynLayer(null,100,100,143,16,"#ffffff") > testlayer.setURL("ext.html") > DynAPI.document.addChild(testlayer) > } > //--></SCRIPT> > > This works great in Netscape 4.73, but doesn't work in IE 5.0. I think I > tracked down the error, but I'm not sure what to do about it. In the > file > "core.ext.loadhtml.js" there is a property called > "DynAPI.setURL.current" > which appears to be initialized to null (last line of the file). This is > causing an error here on line 18, I think: > > 15: DynLayer.prototype.onLoad=function(e) { > 16: var lyr > 17: if (is.ie) { > 18: lyr=document.all[DynLayer.prototype.setURL.current].lyrobj > 19: lyr.elm.innerHTML=e > 20: } else if (is.dom) { > > I'm getting "document.all[...].lyrobj is not an object" which seems to > fit > with using a null object as a reference into the document.all[] array. > So > the "current" propery should be a layer id tag, but which one? Or am I > way > off on what's happening here? > > Anyway, if anybody read this far and knows how to make this work in > IE, I'd be immensely grateful for any help. If this is a known bug > that's > being worked on that's not up on SourceForge yet, or if I'm doing > something > stupid like not including the right files or something, sorry about the > dumb post, but I would still appreciate a heads up. Thanks! > > Sam Douglass > > PS The API is awesome, and tremendously useful! Thanks to the > development > team for all the hard work they've put into it. > _______________________________________________ > Dynapi-Help mailing list > Dyn...@li... > http://lists.sourceforge.net/mailman/listinfo/dynapi-help > _______________________________________________ > Dynapi-Help mailing list > Dyn...@li... > http://lists.sourceforge.net/mailman/listinfo/dynapi-help > |