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 derived by tracing the 
event.target.




Why don't you just do this?

loader.filters = [myBevel];
addChild(loader);






On 2/22/2010 5:33 AM, Gregory Boland wrote:



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 Daywrote:


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;
displayObject.width = 257;
displayObject.height = 257;
displayObject.x = myX + 31;
displayObject.y = myY + 31;
var myBevel:BevelFilter = new BevelFilter();
myBevel.type = BitmapFilterType.FULL;
myBevel.distance = 10;
myBevel.highlightColor = 0xFF;
myBevel.shadowColor = 0x00;
myBevel.blurX = 20;
myBevel.blurY = 20;
displayObject.filters = [myBevel];
addChild(displayObject);
e.target.removeEventListener(Event.COMPLETE, loaded);
}

Did the same thing (no correction). Please advise.
TIA,
Susan
___
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


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


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.loader.content; 
 
Your images are unlikely to load in the same order indicated by the switch
statement. 
Your images are likely to display one top of the other, making it seem like
you are only getting one. 
 
Regards,

Keith Reinfeld
Home Page: http://keithreinfeld.home.comcast.net



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] 2.0 => 3.0

2010-02-22 Thread Merrill, Jason
No - I mean just broadcasting events instead of coupling code across
timelines.  Even if you're not using design patterns or even coding
outside the IDE, you don't need to use root.


Jason Merrill 

Bank of  America  Global Learning 
Learning & Performance Solutions

Join the Bank of America Flash Platform Community  and visit our
Instructional Technology Design Blog
(note: these are for Bank of America employees only)






-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Henrik
Andersson
Sent: Monday, February 22, 2010 11:22 AM
To: Flash Coders List
Subject: Re: [Flashcoders] 2.0 => 3.0

Merrill, Jason wrote:
> There are much better ways of doing things.
>

You mean like using design patterns? Like the Mediator pattern? The main

timeline is an excellent choice for that one. I see no reason to not use

root to refer to the main timeline if you actually need such a
reference.
___
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] 2.0 => 3.0

2010-02-22 Thread Merrill, Jason
>> Well, you use event listeners to call the right event.  

I meant to type,"you use event listeners to call the right method."


Jason Merrill 

Bank of  America  Global Learning 
Learning & Performance Solutions

Join the Bank of America Flash Platform Community  and visit our
Instructional Technology Design Blog
(note: these are for Bank of America employees only)


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] 2.0 => 3.0

2010-02-22 Thread tom rhodes
Lehr,

try this...

var pArray:Array = new Array();
var mc:MovieClip = pArray[0] as MovieClip;
mc.gotoAndStop(2);

or...

var pArray:Array = new Array();
MovieClip(pArray[0]).gotoAndStop(2);

which is closer to your original AS2.


On 22 February 2010 17:48, Henrik Andersson  wrote:

> Merrill, Jason wrote:
>
>> No - I mean just broadcasting events instead of coupling code across
>> timelines.  Even if you're not using design patterns or even coding
>> outside the IDE, you don't need to use root.
>>
>
> For events you still need an object to dispatch them on. And it really is
> just used as window dressing to make people feel good about that same old
> code being "better". This is not the only use, but it is one thing that
> people keep doing. Events are worse than just calling the right method to
> begin with. Events are too loosely coupled if you ask me. If I get the event
> source wrong, there is no error raised and so on. Event listeners also can
> not return any value.
>
> Does this mean that I recommend people to stay away from events? No. I only
> want people to think before using them. Good things can be abused too.
>
> Or we could just cut out all this theorist cruff and focus on the issue at
> hand. How would you replace the root property?
>
> I say that there is a limit to how overly complicated you want to make your
> program. Most people are not hired to design virtual machines that "other
> people" program for, they are hired to actually do the boring work. My point
> here is that in reality, you can't be perfect or an elitist. Think about
> your goal before you overdo stuff. It is ok to not do stuff the absolutely
> cleanest possible way, it's total disasters that you should avoid.
>
> ___
> 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] 2.0 => 3.0

2010-02-22 Thread Merrill, Jason
>> Event listeners also can not return any value.

Ha. That isn't true at all, you can send data with events. I do it all
the time, and it's not bad practice.

>> Events are worse than just calling the right 
>> method to begin with. Events are too loosely coupled if you ask me.

Well, you use event listeners to call the right event.  I don't think
telling someone to avoid root and use events is elitist at all -
especially when it's easy to learn.  The only time it's wise to use
root, in my opinion, is when you don't know how to do anything else.
But using root by it's ver nature is tight coupling code, it's also
symptomatic of code lying all over the place.  

>> For events you still need an object to dispatch them on.

Yes, obviously, just like when YOU write "root blah blah" - you have to
script that code from an object as well.

>> Or we could just cut out all this theorist cruff and focus on the
issue 
at hand.  How would you replace the root property?

That's exactly what I'm answering, you would replace "root" with event
dispatchers and event listeners.  I guess root isn't evil, it's just
very very ugly.

So I think we'll just have to agree to disagree and leave it at that.

Jason Merrill 

Bank of  America  Global Learning 
Learning & Performance Solutions

Join the Bank of America Flash Platform Community  and visit our
Instructional Technology Design Blog
(note: these are for Bank of America employees only)






-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Henrik
Andersson
Sent: Monday, February 22, 2010 11:49 AM
To: Flash Coders List
Subject: Re: [Flashcoders] 2.0 => 3.0

Merrill, Jason wrote:
> No - I mean just broadcasting events instead of coupling code across
> timelines.  Even if you're not using design patterns or even coding
> outside the IDE, you don't need to use root.

For events you still need an object to dispatch them on. And it really 
is just used as window dressing to make people feel good about that same

old code being "better". This is not the only use, but it is one thing 
that people keep doing. Events are worse than just calling the right 
method to begin with. Events are too loosely coupled if you ask me. If I

get the event source wrong, there is no error raised and so on. Event 
listeners also can not return any value.

Does this mean that I recommend people to stay away from events? No. I 
only want people to think before using them. Good things can be abused
too.

Or we could just cut out all this theorist cruff and focus on the issue 
at hand. How would you replace the root property?

I say that there is a limit to how overly complicated you want to make 
your program. Most people are not hired to design virtual machines that 
"other people" program for, they are hired to actually do the boring 
work. My point here is that in reality, you can't be perfect or an 
elitist. Think about your goal before you overdo stuff. It is ok to not 
do stuff the absolutely cleanest possible way, it's total disasters that

you should avoid.
___
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] 2.0 => 3.0

2010-02-22 Thread Henrik Andersson

Merrill, Jason wrote:

No - I mean just broadcasting events instead of coupling code across
timelines.  Even if you're not using design patterns or even coding
outside the IDE, you don't need to use root.


For events you still need an object to dispatch them on. And it really 
is just used as window dressing to make people feel good about that same 
old code being "better". This is not the only use, but it is one thing 
that people keep doing. Events are worse than just calling the right 
method to begin with. Events are too loosely coupled if you ask me. If I 
get the event source wrong, there is no error raised and so on. Event 
listeners also can not return any value.


Does this mean that I recommend people to stay away from events? No. I 
only want people to think before using them. Good things can be abused too.


Or we could just cut out all this theorist cruff and focus on the issue 
at hand. How would you replace the root property?


I say that there is a limit to how overly complicated you want to make 
your program. Most people are not hired to design virtual machines that 
"other people" program for, they are hired to actually do the boring 
work. My point here is that in reality, you can't be perfect or an 
elitist. Think about your goal before you overdo stuff. It is ok to not 
do stuff the absolutely cleanest possible way, it's total disasters that 
you should avoid.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] 2.0 => 3.0

2010-02-22 Thread Lehr, Theodore
Sorry - I am way new to 3.0 - this is code I am trying to convert to help me 
learn 

why would this not work:

var pArray = new Array();

pArray[0].gotoAndStop(2);


or is there a better way to do it in 3

Thanks


From: flashcoders-boun...@chattyfig.figleaf.com 
[flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Glen Pike 
[g...@engineeredarts.co.uk]
Sent: Monday, February 22, 2010 11:15 AM
To: Flash Coders List
Subject: Re: [Flashcoders] 2.0 => 3.0

Surely using dynamic instance names can be faster than using array
lookup in some "instances"?

For example, I have a number of movieclip classes, I don't want to
extend their functionality by subclassing, so instead of adding an "id"
property, I derive the id from the instance name - "btn_0", "btn_1",
etc.  Messy, but works in some instances and is a case of GTD, no?

I may be wrong of course ;)
>  I am more concerned with people who insist on dynamic instance names
> instead of arrays.
> ___
> 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
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] 2.0 => 3.0

2010-02-22 Thread Henrik Andersson

Merrill, Jason wrote:

There are much better ways of doing things.



You mean like using design patterns? Like the Mediator pattern? The main 
timeline is an excellent choice for that one. I see no reason to not use 
root to refer to the main timeline if you actually need such a reference.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] 2.0 => 3.0

2010-02-22 Thread Glen Pike
Surely using dynamic instance names can be faster than using array 
lookup in some "instances"?


For example, I have a number of movieclip classes, I don't want to 
extend their functionality by subclassing, so instead of adding an "id" 
property, I derive the id from the instance name - "btn_0", "btn_1", 
etc.  Messy, but works in some instances and is a case of GTD, no?


I may be wrong of course ;)
 I am more concerned with people who insist on dynamic instance names 
instead of arrays.

___
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] 2.0 => 3.0

2010-02-22 Thread Merrill, Jason
I don't think its elitist at all - I think using root is only asking for
trouble.  I think it's poor practice, plain and simple, and there is NO
reason for it.  There are much better ways of doing things.


Jason Merrill 

Bank of  America  Global Learning 
Learning & Performance Solutions

Join the Bank of America Flash Platform Community  and visit our
Instructional Technology Design Blog
(note: these are for Bank of America employees only)






-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Henrik
Andersson
Sent: Monday, February 22, 2010 11:06 AM
To: Flash Coders List
Subject: Re: [Flashcoders] 2.0 => 3.0

Merrill, Jason wrote:
> Well, using root is just bad practice anyway - there's no need for it
in
> anything you do.

That is an elitist view on the matter. I say, think, then code. If you 
mean the main timeline, use root. I am more concerned with people who 
insist on dynamic instance names instead of arrays.
___
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] 2.0 => 3.0

2010-02-22 Thread Henrik Andersson

Merrill, Jason wrote:

Well, using root is just bad practice anyway - there's no need for it in
anything you do.


That is an elitist view on the matter. I say, think, then code. If you 
mean the main timeline, use root. I am more concerned with people who 
insist on dynamic instance names instead of arrays.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] 2.0 => 3.0

2010-02-22 Thread Merrill, Jason
Well, using root is just bad practice anyway - there's no need for it in
anything you do.


Jason Merrill 

Bank of  America  Global Learning 
Learning & Performance Solutions

Join the Bank of America Flash Platform Community  and visit our
Instructional Technology Design Blog
(note: these are for Bank of America employees only)






-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr,
Theodore
Sent: Monday, February 22, 2010 9:54 AM
To: Flash Coders List
Subject: [Flashcoders] 2.0 => 3.0

how would I translate:

_root["but_"+pArray[i]].gotoAndStop(1);

from 2.0 to 3.0?

The error I am getting is "Access of undefined property _root.

TIA!

Ted

___
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] 2.0 => 3.0

2010-02-22 Thread Henrik Andersson

Lehr, Theodore wrote:

The error I am getting is "Access of undefined property _root.


did you try simply dropping the underscore? The api isn't THAT much 
different.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] 2.0 => 3.0

2010-02-22 Thread Lehr, Theodore
how would I translate:

_root["but_"+pArray[i]].gotoAndStop(1);

from 2.0 to 3.0?

The error I am getting is "Access of undefined property _root.

TIA!

Ted

___
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 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 whatever you
> loaded in
>

e.target.content.removeEventListener(Event.COMPLETE, loaded);

Thanks for the clarification, but that ain't doing it either.
TIA,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


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 wrote:

> 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;
> displayObject.width = 257;
> displayObject.height = 257;
> displayObject.x = myX + 31;
> displayObject.y = myY + 31;
> var myBevel:BevelFilter = new BevelFilter();
> myBevel.type = BitmapFilterType.FULL;
> myBevel.distance = 10;
> myBevel.highlightColor = 0xFF;
> myBevel.shadowColor = 0x00;
> myBevel.blurX = 20;
> myBevel.blurY = 20;
> displayObject.filters = [myBevel];
> addChild(displayObject);
> e.target.removeEventListener(Event.COMPLETE, loaded);
> }
>
> Did the same thing (no correction). Please advise.
> TIA,
> Susan
> ___
> 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] 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;
displayObject.width = 257;
displayObject.height = 257;
displayObject.x = myX + 31;
displayObject.y = myY + 31;
var myBevel:BevelFilter = new BevelFilter();
myBevel.type = BitmapFilterType.FULL;
myBevel.distance = 10;
myBevel.highlightColor = 0xFF;
myBevel.shadowColor = 0x00;
myBevel.blurX = 20;
myBevel.blurY = 20;
displayObject.filters = [myBevel];
addChild(displayObject);
e.target.removeEventListener(Event.COMPLETE, loaded);
}

Did the same thing (no correction). Please advise.
TIA,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


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].contentLoaderInfo.addEventListener(Event.COMPLETE,loade
> d);
>
> This way each Loader object is preserved in a separate element of the
> array.
>
>
> Don't forget to remove your listeners.
>

I'm missing something. I added the variable loaderArray as an Array which I
believe took care of one problem; however, I apparently am not correctly
identifying the e.target in the loader function:

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);
}

function loaded(e:Event):void
{
var loaderInfo:LoaderInfo = e.target as LoaderInfo;
var displayObject:DisplayObject = loaderInfo.content;
displayObject.width = 257;
displayObject.height = 257;
displayObject.x = myX + 31;
displayObject.y = myY + 31;
var myBevel:BevelFilter = new BevelFilter();
myBevel.type = BitmapFilterType.FULL;
myBevel.distance = 10;
myBevel.highlightColor = 0xFF;
myBevel.shadowColor = 0x00;
myBevel.blurX = 20;
myBevel.blurY = 20;
displayObject.filters = [myBevel];
addChild(displayObject);
e.target.removeEventListener(Event.COMPLETE, loaded);
}

Please help me see what I'm missing.
TIA,
Susan
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders