On Tue, Feb 23, 2010 at 11:04 AM, Keith Reinfeld
<[email protected]>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.hasEventListener(Event.COMPLETE)); //false
>
Thanks. Traced true.
>
> > So, how do I pass new values to fn loaded?
> Just increment the vars.
> // Cascade layout
> displayObject.x = myX + 31;
> displayObject.y = myY + 31;
> myX += 20;
> myY += 20;
>
How is that? I'm not iterating over that function, I call it as needed, so
myX, myY would be reset every time.
>
> Have you considered putting your url strings into an array instead of using
> that awkward switch statement?
>
This worked. Thanks:
public function thePic(x:int,
y:int)
{
var paths:Array = new Array("images/bracelet.jpg",
"images/brooch.jpg",
"images/chain.jpg",
"images/earring.jpg",
"images/necklace.jpg",
"images/ring.jpg");
var path:String = new String();
path = paths[counter];
var req:URLRequest = new URLRequest(path);
var loaderArray:Array = new Array();
loaderArray[counter] = new Loader();
loaderArray[counter].load(req);
loaderArray[counter].contentLoaderInfo.addEventListener(Event.COMPLETE,loaded);
}
I would also recommend writing a function that creates and returns
> BevelFilter. Set 'myBevel' once (rather than running through the code
> repeatedly) then apply it where appropriate.
> var myBevel:BevelFilter = createBevel();
> function createBevel():BevelFilter{
> var bf:BevelFilter = new BevelFilter();
> bf.type = BitmapFilterType.OUTER;
> bf.distance = 10;
> bf.highlightColor = 0xFF0000;
> bf.shadowColor = 0xFFFF00;
> bf.blurX = 20;
> bf.blurY = 20;
> return bf;
> }
>
> Thanks.
> // apply Bevel filter
> displayObject.filters = [myBevel];
>
No:
displayObject.filters = [createBevel()];
TIA,
Susan
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders