Re: assign prototype to event

"Richard Cornford" wrote in message news:etgthd$fja$1$8302bc10@xxxxxxxxxxxxxxxxxxx
-Lost wrote:
Richard Cornford wrote:
-Lost wrote:
Might I inquire as to what you are developing in
JavaScript nowadays?
I am writing the client-side framework and UI for a large-scale
web application, and probably will be for some time to come
(details beyond those would be subject to a confidentiality

Heh, fair enough. I was prying for ideas to be honest.

I cannot think of any "large-scale" applications by which to test
my limited skills.

We may have very different concepts of what "large-scale" is. I am working with a
client-side code base of 70,000 odd lines (with at least 60 times the server-side code),
and you would not want to even attempt that on your own or without being paid for it.

Yet again, you are indeed correct. I could not even possibly imagine 70,000 lines of
JavaScript. I get queasy looking over a few hundred lines.

I would love to tinker with something bordering on several hundred
lines as opposed to barely a hundred.

One thing to remember is that your firsts attempts at anything will likely be
unsatisfactory. Once you have a handle on the langue and the object model provided by
the host the next things to learn are the considerations that apply to the design, and
you don't learn those without trying and seeing where you fall short.

You could pick on anything, whether it has been done before (or done to death) you can
still try to do it better, or do it in your style. Even the silly gimmicky things (that
nasty 'falling snow' script, for example) can be better done, and much learnt along the

Duly noted. I wrote one of those "falling" scripts in ActionScript many a month ago, and
have long thought about porting it to JavaScript. Of course, I was not about to brag
about it. : )

For example:

frame 1 {
Stage.showMenu = 'false';
Stage.scaleMode = 'noScale';
var snowflakes = 100;
var stagewidth = 600;
var stageheight = 200;
t = 0;
while (t != snowflakes) {
mc = _root.attachMovie('snowflake', 'snow' + t, t);
mc.dir = (30 + Math.random() * 30) * Math.PI / 180;
mc.speed = Math.random() * 8;
mc._yscale = 15 * mc.speed;
mc._xscale = mc._yscale;
mc._x = Math.random() * stagewidth;
mc._y = Math.random() * stageheight;
mc.onEnterFrame = function () {
var xspeed = Math.cos(this.dir) * this.speed;
var yspeed = Math.sin(this.dir) * this.speed;
this._x += xspeed;
this._y += yspeed;
if (this._x > stagewidth) {
this._x = 0;
if (this._y > stageheight) {
this._y = 0;


Sorry, to go OT with ActionScript, I just thought it wildly coincidental that you
mentioned a snowflake script.

Probably the most important thing is to expose your creations to criticism, and then
address those criticisms with practical changes.

Thank you for the wise advice. It is very much appreciated.