|
|
|
I did a test where I created the app in a legals webcontext named /legals3
and tried to load from an HTML wrapper defined in another legals context mounted at /legals2 I used this wrapper derived from the lzt=html wrapper, and changed the pathnames for the embed.js and the url arg to swfEmbed <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="SHORTCUT ICON" href="http://www.laszlosystems.com/favicon.ico"><title>OpenLaszlo Application</title><script type="text/javascript"> // If loaded bare into a browser, set the browser size to the canvas size if (window === top) { (function (width, height) { // Cf. http://www.quirksmode.org/viewport/compatibility.html if (window.innerHeight) { // Sadly, innerHeight/Width is not r/w on some browsers, and resizeTo is for outerHeight/Width window.resizeTo(width ? (width + window.outerWidth - window.innerWidth) : window.outerWidth, height ? (height + window.outerHeight - window.innerHeight) : window.outerHeight); } else if (document.documentElement && document.documentElement.clientHeight) { if (width) { document.documentElement.clientWidth = width; } if (height) { document.documentElement.clientHeight = height; } } else { if (width) { document.body.clientWidth = width; } if (height) { document.body.clientHeight = height; } } })(800, 600); } </script><script type="text/javascript"> lzOptions = { ServerRoot: '/legals3'}; </script><script type="text/javascript" src="/legals3/lps/includes/embed-compressed.js"></script><style type="text/css"> html, body { /* http://www.quirksmode.org/css/100percheight.html */ height: 100%; /* prevent scrollbars */ margin: 0; padding: 0; border: 0 none; overflow: hidden; } body { background-color: #ffffff; } img { border: 0 none; } </style></head><body><script type="text/javascript"> Lz.swfEmbed({url: '/legals3/test/dante/main.lzx?lzt=swf', bgcolor: '#ffffff', width: '800', height: '600', id: 'lzapp', accessible: 'false'}); </script><noscript> Please enable JavaScript in order to use this application. </noscript></body></html> The library would not load, it seems due to the fact that we compile in a ImportAssets tag which has a hardcoded URL in it. That ImportAssets code was put in to allow fonts to be imported, but it looks like it's a bad idea to have the URL hardcoded into to swf file. I don't see any way around that right now but below is a workaround that will probably work for almost all cases, where people are not trying to import fonts at runtime. I have a patch which will remove the ImportAssets instruction if there are no imported font resources in the library. It is going out for review now. I found a workaround for the problem with importing fonts across 2 different webcontexts. It's not perfect, but maybe the OL developers can pick up the idea and modify the source, that the import can be used in a more flexible way.
Here's my code: Project: LPS Branch: legals Revisoin: 5461 File: org.openlaszlo.compiler.SWFWriter.java Method: public void closeSnippet() throws Exception ------------------- snip -------------------- if (mLibFontsDefined) { ImportAssets2 ia = new ImportAssets2(); //System.err.println("setting ImportAssets url="+this.liburl); //get property of base url for fonts to import String importFontUrlPath = System.getProperty("import.font.base.url"); if (importFontUrlPath != null) { if (importFontUrlPath.endsWith("/") == false) { importFontUrlPath += "/"; } if (liburl.startsWith("/")) { liburl = liburl.substring(1); } liburl = importFontUrlPath + liburl; } ia.setUrl(liburl); Enumeration enu = mFlashFile.definitions(); while (enu.hasMoreElements()) { FlashDef def = (FlashDef) enu.nextElement(); ia.addAsset(def.getName(), def); //System.err.println("adding def named "+def.getName()+ "[id="+def.getID()+"] to ImportAssets2 defs"); } Timeline timeline = mFlashFile.getMainScript().getTimeline(); Frame frame = timeline.getFrameAt(timeline.getFrameCount() - 1); frame.addFlashObject(ia); } mLibFontsDefined = false; ------------------- snip -------------------- checked into legals. The workaround suggested in the bug report was implemented using
LPS.getProperty("import.font.base.url"); So the developer can define this in their lps.properties file |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[16:56] maxcarlson: well, it will be important for hosted components.
[16:56] p7w: soo... confirm to you?
[16:56] maxcarlson: doe! sure.
[16:57] p7w: or you want frisco to reproduce and add test case first?
[16:57] mamye: Needs a fix version too. :-)
[16:57] maxcarlson: yes!
[16:57] jsundman joined the chat room.
[16:57] frisco: Okeydoke.
[16:57] maxcarlson: fix 4.0.3?