Web Analytics Made Easy -
StatCounter open source DynAPI - CodingForum

Announcement

Collapse
No announcement yet.

open source DynAPI

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • open source DynAPI

    For a computer programmer JavaScript is not difficult. It is pretty easy to look at some code for the first time and figure out what is going on.

    This is especially true if you have gratuated from an old-fashioned top-down programmer to an object oriented computer programmer. I mean, most Javascript has a look where things are sectioned off into functions.

    This is pretty much true until one gets into DHTML and a very cool open-source thingy called DYNAPI that is all open source and is all javascript. With DHTML (aka Dynamic HTML) you can do a lot of interesting things which, when run on an IE browser, looks a lot like Flash: http://www.gelsana.com/examples/dynapi.fx.fader.html

    So naturally I want to experiment with this and figure out how do modify the examples to this.

    The javascript (.js) file looks like this.
    http://www.gelsana.com/Flash2.html

    Some of it is easy to understand but some of it looks like object oriented programming.

    Does anyone know how all this works or where I can go to find out how it works?

    If you have used the open source javascript code called DynAPI, that would be great. You could give me some insight.

    But it is open source and so it should not be hard to look at the code and figure out what is going on if you are good at JavaScript.

    Here, I have made a new copy of the .js file and highlighted a class (http://www.gelsana.com/flash2.htm)

    DynObject is defined as a function but then right away it is used as an object. After the function declaration

    Code:
    function DynObject() {
    .
    .
    .
    };
    we see DnyObject used as a class with a member “prototype” on this line

    Code:
    var p = DynObject.prototype;
    What does this mean?

  • #2
    I understand that javascript can use functions as objects or classes.
    But how do I learn how this all works together?
    For instance, in the copy of the DynAPI javascrpt file you can see this bit of code
    Code:
    function DynObject() {
        this.id = "DynObject"+DynObject._c++;
        DynObject.all[this.id] = this;
    };
    Where is .id defined? Is it an element of the DynObject class that is
    predefined with all javascript classes? Is the same true for the element .all as well?

    Following this object declaration (if that is what it is) there is this
    line of code:
    Code:
    var p = DynObject.prototype;
    Where is .prototype defined? Is it also a predefined element?
    How is it used?

    Comment


    • #3
      Here we meet again :-)

      http://www.javascriptkit.com/javatutors/proto.shtml
      http://www.w3schools.com/jsref/jsref_prototype_math.asp

      Related with the objects set and handle, you may also consult
      JSON
      KOR
      Offshore programming
      -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

      Comment

      Working...
      X