This content has been marked as final.
Show 5 replies
-
1. Re: AS3 close() method
kglad Nov 8, 2007 6:19 AM (in response to "B")did you try using the close() methods on the line just above your load() methods? -
-
3. Re: AS3 close() method
kglad Nov 8, 2007 8:04 AM (in response to "B")i don't see a problem with that, though you don't need to use a try..catch and you're probably adding myLoader to the empty repeatedly which is problematic. -
4. Re: AS3 close() method
"B" Nov 8, 2007 11:29 AM (in response to kglad)I put the close method inside a try because if the movie is already finished downloading, then an error message occurs.
If I'm referencing the myLoader object for the close/uload/remove, isn't that (once it all actually works) going to cause a problem? As in, as soon as something loads it will immediately be closed/unloaded/removed. It seems to me that I would need to reference the previous movie clip that was loading prior to the newest one being loaded. But every way I've tried it just gives me errors.
Also, I was reading on the actionscript.org forum and someone said he got the close method to work by referencing his movie clips via an absolute path rather than relative. Meaning, instead of
var myRequest:URLRequest = new URLRequest("movieOne.swf")
he did...
var myRequest:URLRequest = new URLRequest(" http://www.serverWebAddress.com/movieOne.swf")
And he said it worked. I have yet to test this, but I'll report back to whether it works or not.
Also, the addChild could be problematic because it sits inside the function? I thought so too, but then my logic was that each time that function runs it will be closed/uloaded/removed anyways. I'm not sure if that's even logical at this point. I'm working on 2 hours of sleep. I will, however, place it outside of the function and see what happens.
Hey question... is it possible to monitor the display list? Sure would be helpful in checking to see when things are being added and removed. In that way, I can see if some of my logic in having things added/removed is working or not.
Thank you for your replies.
Brenda -
5. Re: AS3 close() method
kglad Nov 8, 2007 12:25 PM (in response to "B")ok, on the try..catch.
i have no trouble using a relative path with the close() method.
the addChild() is a problem because you're repeatedly adding your loader. you only need to add it once to the display list. executing the close() method doesn't remove your loader from the display list. it just stops any open streams.
yes, you can monitor the display list, but i don't think that will help you. you're going to see your loader is in the display list. and if you don't change your code you're going to see your loader is added to your display list multiple times.
you probably want to check the url of your loader's contentloaderinfo property. this property is accurate after the first progress event is dispatched by your loader's contentloaderinfo property.