RE: [Flashcoders] reading a css from "www"?
You are right about the base path being the html, so you should get to your css by passing in the complete relative path, so: '../path_to_css/cssfile.css' when the html is in 'somefolder' en the css is in 'path_to_css' folder -Oorspronkelijk bericht- Van: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] Namens sebastian Verzonden: zaterdag 17 april 2010 23:53 Aan: Flash Coders List Onderwerp: Re: [Flashcoders] reading a css from "www"? sweet thanks Benny, this replacement method worked! yaay! btw, as far as i can tell, the flash file tries to load the files relative to the path of the current URL, and not the path relative to the SWF itself... so if if the HTML file is in: http://mysite.com/somefoloder/index.html and you load: ('file.css'); then it will look in: http://mysite.com/somefoloder/file.css even if the swf is being loaded from: http://mysite.com/flash/flashfile.swf If I am wrong, and the path is relative to the swf, then I am completely confused as to why i have to use full URL paths and I cant just type "file.css" and get it to load when the swf and the css file are actually stored on the server from the same location... Best, Seb. Benny wrote: > You could use the url from which your swf is loaded, replace the filename of > the swf by that of the css. > > In your main movie (from top of my haead, i.e. not tested ;-) use something > like: > > var cssFullURL:String = this.loaderInfo.url.replace(/thecallingfile\.swf > /,"cssFile.css"); > trace(cssFullURL); > > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] reading a css from "www"?
sweet thanks Benny, this replacement method worked! yaay! btw, as far as i can tell, the flash file tries to load the files relative to the path of the current URL, and not the path relative to the SWF itself... so if if the HTML file is in: http://mysite.com/somefoloder/index.html and you load: ('file.css'); then it will look in: http://mysite.com/somefoloder/file.css even if the swf is being loaded from: http://mysite.com/flash/flashfile.swf If I am wrong, and the path is relative to the swf, then I am completely confused as to why i have to use full URL paths and I cant just type "file.css" and get it to load when the swf and the css file are actually stored on the server from the same location... Best, Seb. Benny wrote: You could use the url from which your swf is loaded, replace the filename of the swf by that of the css. In your main movie (from top of my haead, i.e. not tested ;-) use something like: var cssFullURL:String = this.loaderInfo.url.replace(/thecallingfile\.swf /,"cssFile.css"); trace(cssFullURL); ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] reading a css from "www"?
... or just load the css file relative. As far as I know you are not required to pass in absolute URLs -Oorspronkelijk bericht- Van: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] Namens Benny Verzonden: zaterdag 17 april 2010 14:01 Aan: 'Flash Coders List' Onderwerp: RE: [Flashcoders] reading a css from "www"? You could use the url from which your swf is loaded, replace the filename of the swf by that of the css. In your main movie (from top of my haead, i.e. not tested ;-) use something like: var cssFullURL:String = this.loaderInfo.url.replace(/thecallingfile\.swf /,"cssFile.css"); trace(cssFullURL); ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders __ Informatie van ESET NOD32 Antivirus, versie van database viruskenmerken 5035 (20100416) __ Het bericht is gecontroleerd door ESET NOD32 Antivirus. http://www.eset.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] reading a css from "www"?
You could use the url from which your swf is loaded, replace the filename of the swf by that of the css. In your main movie (from top of my haead, i.e. not tested ;-) use something like: var cssFullURL:String = this.loaderInfo.url.replace(/thecallingfile\.swf /,"cssFile.css"); trace(cssFullURL); ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] reading a css from "www"?
//check to see if testing locally, or deployed live if ((this.loaderInfo.url.indexOf("http")<0) || (this.loaderInfo.url.indexOf("testserver")>1) || (this.loaderInfo.url.indexOf("localhost")>1)) { //live test.foo = LoaderInfo (this.root.loaderInfo).parameters.foo; }else{ //testing test.foo = "testing"; } Karl On Apr 16, 2010, at 9:54 PM, sebastian wrote: Hello coders, Simple question I think... I have a SWF file, but its location on my server is not fixed, so I am having to call and load files using full URL paths. I'm having an issue with loading the CSS file based on whether the domain being loaded is typed with, or without the "www" in front of it. How can I make it so that the CSS file is loaded from either domain name? Cuase right now if I write in my FLA to load the CSS from http:// www.mysite.com/cssfile.css then it won't load it if the swf is currently playing from: http://mysite.com/someunknownpath/thecallingfile.swf Thanks!! Seb. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders