Re: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Steven Sacks
If you call close() on a Loader and it fails for any reason, it will throw a runtime error that you can do nothing about. To avoid this, you should wrap it in a try catch. The code block comes straight from Flex and it works. If you test it a bunch and close() never fires an error, then you ca

RE: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Keith Reinfeld
> > var bitmap:Bitmap = new > Bitmap(Bitmap(loader.content).bitmapData.clone(),"auto", true); > Bitmap(loader.content).bitmapData.dispose(); > loader.unloadAndStop(true); > try { > loader.close(); > } catch (e:Error) {} > // remove all event listeners from loader > Steven, I'm curious about

RE: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Keith Reinfeld
February 23, 2010 2:52 PM > To: Flash Coders List > Subject: Re: [Flashcoders] Event.COMPLETE Question > > You should only create the bevel filter ONCE. Filters are _expensive_ > and > can/should be shared. Make your bevel an instance variable > > private var m

Re: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Steven Sacks
You should only create the bevel filter ONCE. Filters are _expensive_ and can/should be shared. Make your bevel an instance variable private var myBevel:BevelFilter = new BevelFilter(); public function foo() { myClip.filters = [myBevel]; } ___ F

Re: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Steven Sacks
When loading bitmaps, your loader will NEVER be eligible for cleanup by the Garbage Collector unless you do ALL of the following in this order: var bitmap:Bitmap = new Bitmap(Bitmap(loader.content).bitmapData.clone(), "auto", true); Bitmap(loader.content).bitmapData.dispose(); loader.unloadAnd

Re: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Susan Day
On Tue, Feb 23, 2010 at 1:27 PM, Keith Reinfeld wrote: > > How is that? I'm not iterating over that function, I call it as needed, > > so > > myX, myY would be reset every time. > > Uses the addition assignment (+=) operator. > My bad. It is not iteration. It is called onMouseOver, hence the valu

RE: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Keith Reinfeld
> How is that? I'm not iterating over that function, I call it as needed, > so > myX, myY would be reset every time. Uses the addition assignment (+=) operator. > No: > displayObject.filters = [createBevel()]; You are missing the point. Why run this function repeatedly when you can set 'myBeve

Re: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Susan Day
On Tue, Feb 23, 2010 at 11:04 AM, Keith Reinfeld wrote: > > I presume my removeEventListener works. > You should be sure. So check it: > > trace(e.currentTarget.hasEventListener(Event.COMPLETE)); //true > e.currentTarget.removeEventListener(Event.COMPLETE, loaded); > trace(e.currentTarget.hasEvent

RE: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Keith Reinfeld
> I presume my removeEventListener works. You should be sure. So check it: trace(e.currentTarget.hasEventListener(Event.COMPLETE)); //true e.currentTarget.removeEventListener(Event.COMPLETE, loaded); trace(e.currentTarget.hasEventListener(Event.COMPLETE)); //false > So, how do I pass new valu

Re: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Susan Day
On Mon, Feb 22, 2010 at 2:27 PM, Keith Reinfeld wrote: > > Thanks for the clarification, but that ain't doing it either. > > // LoaderInfo > e.currentTarget > > // Bitmap > e.currentTarget.loader.content > Perhaps, but if I trace(displayObject) it traces as the bitmap, so I can use that. Such bei

Re: [Flashcoders] Event.COMPLETE Question

2010-02-22 Thread Steven Sacks
> e.target isn't your loader info, its most likely the Loader itself. loader.contentLoaderInfo.addEventListener() The LoaderInfo is the target of the event - that's what you added the event listener to. trace(event.target); [LoaderInfo] Proof that the LoaderInfo is the target is easily deriv

RE: [Flashcoders] Event.COMPLETE Question

2010-02-22 Thread Keith Reinfeld
> Thanks for the clarification, but that ain't doing it either. // LoaderInfo e.currentTarget // Bitmap e.currentTarget.loader.content // Remove listener e.currentTarget.removeEventListener(Event.COMPLETE, loaded); // Get current jpg var displayObject:DisplayObject = e.currentTarget.l

Re: [Flashcoders] Event.COMPLETE Question

2010-02-22 Thread Susan Day
On Mon, Feb 22, 2010 at 9:33 AM, Gregory Boland wrote: > e.target isn't your loader info, its most likely the Loader itself. > > the target is where the event bubbles from, and the currentTarget is what > was applied the listener > > so what you are looking for is e.target.content and that is what

Re: [Flashcoders] Event.COMPLETE Question

2010-02-22 Thread Gregory Boland
e.target isn't your loader info, its most likely the Loader itself. the target is where the event bubbles from, and the currentTarget is what was applied the listener so what you are looking for is e.target.content and that is whatever you loaded in On Mon, Feb 22, 2010 at 4:57 AM, Susan Day wro

Re: [Flashcoders] Event.COMPLETE Question

2010-02-22 Thread Susan Day
On Mon, Feb 22, 2010 at 8:31 AM, Steven Sacks wrote: > Update this line: > > var displayObject:DisplayObject = loaderInfo.loader.content; Updated: function loaded(e:Event):void { var loaderInfo:LoaderInfo = e.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.loader.content; dis

Re: [Flashcoders] Event.COMPLETE Question

2010-02-22 Thread Steven Sacks
Update this line: var displayObject:DisplayObject = loaderInfo.loader.content; ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Re: [Flashcoders] Event.COMPLETE Question

2010-02-22 Thread Susan Day
On Sat, Feb 20, 2010 at 2:58 PM, Keith Reinfeld wrote: > All but the last Loader is being over written. > Put each Loader into an array. > > var req:URLRequest = new URLRequest(path); > loaderArray[counter] = new Loader(); > loaderArray[counter].load(req); > > loaderArray[counter].contentLoaderInf

RE: [Flashcoders] Event.COMPLETE Question

2010-02-20 Thread Keith Reinfeld
All but the last Loader is being over written. Put each Loader into an array. var req:URLRequest = new URLRequest(path); loaderArray[counter] = new Loader(); loaderArray[counter].load(req); loaderArray[counter].contentLoaderInfo.addEventListener(Event.COMPLETE,loade d); This way each Loade