473,756 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

assign prototype to event

Hello,

I am wondering why the following works, on IE6, but with an error : "Not
implemented".

function TEST(){}
TEST.prototype. Initialize = function()
{
var mImage = new Image();
var mDate = new Date();
var start = mDate.getTime() ;
mImage.onload = this.Alerting(s tart);//WORKS with ERROR "Not implemented"
//mImage.onload = function(){this .Alerting(start );}//ERROR "Object doesn't
support this property or method"
mImage.src = "winxp.gif" ;
}
TEST.prototype. Alerting = function(i_stri ng){alert(i_str ing);}
var mTest = new TEST();
mTest.Initializ e();

Can anybody guess why?
Thanks for your time.
Mar 12 '07
11 1779
-Lost wrote:
Richard Cornford wrote:
>-Lost wrote:
<snip>
>>Might I inquire as to what you are developing in
JavaScript nowadays?
<snip>
>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
agreement).

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.
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 way.

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

Richard.

Mar 17 '07 #11
"Richard Cornford" wrote in message news:et******** ***********@new s.demon.co.uk.. .
-Lost wrote:
>Richard Cornford wrote:
>>-Lost wrote:
<snip>
>>>Might I inquire as to what you are developing in
JavaScript nowadays?
<snip>
>>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
agreement).

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
way.
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.attachMov ie('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.d ir) * this.speed;
var yspeed = Math.sin(this.d ir) * this.speed;
this._x += xspeed;
this._y += yspeed;
if (this._x stagewidth) {
this._x = 0;
}
if (this._y stageheight) {
this._y = 0;
}
};

++t;
}
}
}

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.

-Lost
Mar 17 '07 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3759
by: Elf M. Sternberg | last post by:
One of the complaints about prototype.js (google for it if you're not familiar with it) is that it's poorly documented. I have this inkling that the key to understanding prototype.js is in the bind function. The problem with Javascript is that the "this" operator is poorly overloaded and it is often hard to understand in the context of object-oriented javascript So, let's start with the definition:
16
25419
by: sneill | last post by:
How is it possible to take the value of a variable (in this case, MODE_CREATE, MODE_UPDATE, etc) and use that as an object property name? In the following example I want 'oIcon' object to have the properties: mode1, mode2, and mode3. This seems simple but I can't quite figure it out... Any ideas anyone?
10
4744
by: Robert | last post by:
Hi, I would like to determine if a property is available in an Event prototype. I tried doing this using: if (Event.prototype.srcElement) but I got an "Illegal operation on WrappedNative prototype object" exception. Is there anyway to see if it already has been defined.
12
2200
by: petermichaux | last post by:
Hi, I've been reading the recent posts and older archives of comp.lang.javascript and am surprised by the sentiments expressed about the prototype.js library for a few reasons: 1) The library has been referred to as "junk" many times which is a strong opinion against the relatively high popularity of the library. I know popularity doesn't make something good.
4
2096
by: reggiestyles | last post by:
Hi, I've got a question about prototype and event handling. I've got several div's (dynamic number) on a page that I want to set as active or inactive (basically, I'm using scriptaculous' Effects to set Opacity to 1 for the active div and 0.5 for the inactive ones). Using prototype's event handling, I can see two ways to get this done:
4
10378
by: danf | last post by:
Can anyone tell me what the difference is between these two protoype methods? They are extensions of Javascript's Function class. Is bindAsEventListener just used to be compatible with IE's Event model? I'm thinking the only difference between the 2 methods is that bindAsEventListener passes the event into the function. I want to know how I can practically apply these.
1
2533
by: tdan | last post by:
I do not know how to get Event.stopObserving() to work in the context I am using it. I am displaying a Color Selection Table and attaching 2 events: 1. onmouseover to display the color to the user 2. onmouseup to select the color and hide the Table The onmouseup event should also call Event.stopObserving() so that mouse clicks are no longer being observed. An alert is shown when the mouse is clicked indicating the event handler is...
6
2628
by: TriFuFoos | last post by:
Hi there, I was wondering if anyone knew if/how to assign an event to a global variable? I tried to do it and IE 7 came back with an error saying "Member not found" My code looked similar to the following: var globalEvevnt; function showPopup(event){ globalEvent = event;
5
8085
by: howa | last post by:
Hi, Consider a simple example, e.g. var a = { 'a': 'b', 'c': 'd' }
0
9455
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9271
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10031
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9869
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9838
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8709
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5140
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.