Hey... a question I think I can actually answer (having been the recipient
of good advice from others, I'm happy to be on the flip side for a change
:-)
Anyway, what you're looking to do can easily (?) be accomplished, so long as
you are careful about managing your code (I've made stupid mistakes like
trying to call DynAPI methods before the class finished loading in my static
frame, and I've run into more complex issues, too.) Anyway, having played
around with this scheme for a while now, I've finally gotten to the point
where things are working well in both NS and IE (for basic stuff... still
working on more complex code, but that's more a function of my newbie
status). Here's the basic framework of my code that has been working... my
apologies in advance if it's not what you're looking for:
IN MY STATIC FRAME --
function createDyndocument(frame) {
if ( top.userInfo.DynAPITarget) { //array I keep in my
frameset to track various states
targetPage = new DynDocument(frame);
} else {
targetPage = new DynDocument(frame);
// CREATE "DYNAMIC" LAYERS THAT WILL BE COMMON ACROSS TARGET
FRAMES
lyrCanvas = new DynLayer('canvas',bla,bla);
lyrMargin = new DynLayer('margin',bla,bla);
lyrImage = new DynLayer ('image',bla,bla);
lyrMargin.addChild(lyrImage);
lyrCanvas.addChild(lyrMargin);
top.userInfo.DynAPITarget = true;
}
}
function addLayers() { // target frames call this to add multiple Dynlayers
for (var a=0; a<arguments.length; a++){
targetPage.addChild(arguments[a]);
}
}
function removeLayers() {
// REMOVE COMMON LAYERS SO THEY ARE NOT DELETED ON RECREATION OF NEW
DYNDOCUMENT
targetPage.removeChild(lyrCanvas);
targetPage.deleteAllChildren(); //helps to keep browser running
longer without crashing
}
function addDyndoc() { // called by target frames
createDyndocument(parent.main);
lyrImage.setBgImage(null);
lyrImage.setHTML("");
addLayers(lyrCanvas);
}
IN MY TARGET FRAMES --
function init() {
if ( top.userInfo.DynAPILoaded ) {
// MAKE THIS FRAME A DYNDOC AND ADD COMMON LAYERS
parent.menu.addDyndoc();
// CREATE DYNAMIC CONTENT LAYERS
lyrMain1 = new parent.menu.DynLayer('main1',bla,bla);
lyrMain2 = new parent.menu.DynLayer('main2',bla,bla);
// AND SO ON
} else {
setTimeout("init()",500);
}
}
<body onLoad="init();" onUnload="JavaScript:parent.menu.removeLayers();">
Happy coding!
-----Original Message-----
From: Martin Weinelt [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 12, 2000 12:04 PM
To: [EMAIL PROTECTED]
Subject: [Dynapi-Help] One frame for 'DynAPI.include(...)', how to?
Hi,
I am dealing with a site with four frames: top, bottom, left, main.
Brilliant, eh? Top and bottom are static, left and main is where I
may put dyndocuments.
Can I use one of the static frames (top, bottom) to put the dynapi.js
and the libs so that the content frames (where I build dynlayers, use
widgets, etc) can use them?
Thanks, Martin
_______________________________________________
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