RE: [Flashcoders] onLoadInit running when swf doesn't exist
have you tried defining your listening function before your loadText function ? Had similar problems when defining the event handlers after the load() call. Also you could use LoadVars to test the existence of the file firsthand. import mx.utils.Delegate; var fileExists:Boolean = false; var testFile:LoadVars = new LoadVars(); testFile.onLoad = Delegate.create(this, testExist); function testExist(success:Boolean) { fileExists = success; } testFile.load(pPath + "texts.swf"); Then load either the swf or the xml accordingly. HTH Alain -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Danny Kodicek Sent: 31 janvier 2007 11:16 To: 'Flashcoders mailing list' Subject: [Flashcoders] onLoadInit running when swf doesn't exist I've got some information that might either be contained in a swf file or an xml file. What I'm doing (stripped down) is this: function loadText():Void { var tSwf:String = pPath + "texts.swf"; var tContainer:MovieClip = this.createEmptyMovieClip("txt", this.getNextHighestDepth()); var tLoader:MovieClipLoader = new MovieClipLoader(); tLoader.addListener(this); tLoader.loadClip(tSwf, tContainer); } function onLoadError(tContainer:MovieClip):Void { tContainer.removeMovieClip(); importText(pPath + "texts.xml"); } function onLoadInit(tContainer:MovieClip):Void { } So it tries to load in the .swf, and if this isn't found, it looks for the XML. Running locally, this is working fine. But running online, it's failing: despite the fact that the swf file doesn't exist, it's running onLoadInit instead of onLoadError. Anyone have any thoughts? Danny ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.410 / Virus Database: 268.17.17/661 - Release Date: 2007-01-30 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.410 / Virus Database: 268.17.17/661 - Release Date: 2007-01-30 ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] onLoadInit running when swf doesn't exist
I've seen issues where a download fails (connection is cut off after it started) where onLoadInit is called instead of onLoadError. To detect this I simply check the bytesLoaded versus bytesTotal on the movie clip I was loading it into. It's possible you're hitting the same situation (file doesn't exist, but whatever is serving it is reporting that in a weird way) so it might be worth doing that check in onLoadInit. -Andy On 1/31/07, Danny Kodicek <[EMAIL PROTECTED]> wrote: I've got some information that might either be contained in a swf file or an xml file. What I'm doing (stripped down) is this: function loadText():Void { var tSwf:String = pPath + "texts.swf"; var tContainer:MovieClip = this.createEmptyMovieClip("txt", this.getNextHighestDepth()); var tLoader:MovieClipLoader = new MovieClipLoader(); tLoader.addListener(this); tLoader.loadClip(tSwf, tContainer); } function onLoadError(tContainer:MovieClip):Void { tContainer.removeMovieClip(); importText(pPath + "texts.xml"); } function onLoadInit(tContainer:MovieClip):Void { } So it tries to load in the .swf, and if this isn't found, it looks for the XML. Running locally, this is working fine. But running online, it's failing: despite the fact that the swf file doesn't exist, it's running onLoadInit instead of onLoadError. Anyone have any thoughts? Danny ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com