Yeah, unfortunately the world has accepted Javascript without much complaint. But here's a simple example of simulating a class in Javascript - put this in a js file:
(function(window){ function Person(name, address){ this.name = name; this.address = address; } Person.prototype.sayHello = function(){ console.log(this.name + " says hello from"+this.address); }; Person.SPECIES = "human"; window.Person = Person; }(window)); Then in HTML you can do this after importing the above js file: var jason = new Person("Jason Merrill", "123 Smith Street"); jason.sayHello(); Jason Merrill Instructional Technology Architect II Bank of America Global Learning 703.302.9265 (w/h) _______________________ -----Original Message----- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of David Hunter Sent: Friday, October 26, 2012 11:23 AM To: Flash Coders List Subject: Re: [Flashcoders] AS3 Thanks Kevin, I guess what I meant was a more object orientated approach, which I have enjoyed learning and using in AS3. I'll look into those libraries you mentioned. David On 26 October 2012 16:11, tom rhodes <tom.rho...@gmail.com> wrote: > how depressing that a simple AS3 question has turned into a thread > about how everyone is now coding JS!! > > whilst we're on that subject though... > > http://haxe.org/doc/targets/js > http://www.haxejs.org/ > > is about as close as you are going to get to AS3 in terms of JS. i > can't recommend haxe enough for a million reasons but the JS target > has just improved massively in the code it generates and haxe 3 is a > few months away which should have the complete html5 spec covered as > standard, including webgl. > > On 26 October 2012 16:40, Ross Sclafani <ross.sclaf...@gmail.com> wrote: > > > my framework lets you code like this: > > > > > > _package('com.neuromantic.display.shapes', > > > > _import( 'com.neuromantic.display.shapes.Oval'), > > > > _class( 'Circle' )._extends( 'Oval',{ > > Circle: function ( size ) { > > this._super( size, size ); > > } > > > > }) > > ); > > > > > > > > Ross P. Sclafani > > design / technology / creative > > > > http://ross.sclafani.net > > http://www.twitter.com/rosssclafani > > http://www.linkedin.com/in/rosssclafani > > [347] 204.5714 > > > > > > > > let go of even your longest held beliefs, the only truth is in > > observation. > > > > On Oct 26, 2012, at 10:25 AM, Kevin Newman <capta...@unfocus.com> wrote: > > > > > JS doesn't have classes, and emulating them is somewhat tricky > > > using > the > > prototype chain (it can be done though). > > > > > > The easiest way to emulate classes though is to use a framework > > > like > > underscore.js (which Backbone.js is built on). > > > > > > Kevin N. > > > > > > > > > On 10/26/12 9:21 AM, David Hunter wrote: > > >> I'd > > >> really like to learn to approach javascript from a class-based > approach, > > > > > > _______________________________________________ > > > 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 > -- David Hunter www.davidhunterdesign.com +44 (0) 7869 104 906 @DHDPIC _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ---------------------------------------------------------------------- This message w/attachments (message) is intended solely for the use of the intended recipient(s) and may contain information that is privileged, confidential or proprietary. If you are not an intended recipient, please notify the sender, and then please delete and destroy all copies and attachments, and be advised that any review or dissemination of, or the taking of any action in reliance on, the information contained in or attached to this message is prohibited. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Sender. Subject to applicable law, Sender may intercept, monitor, review and retain e-communications (EC) traveling through its networks/systems and may produce any such EC to regulators, law enforcement, in litigation and as required by law. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or free of errors or viruses. References to "Sender" are references to any subsidiary of Bank of America Corporation. Securities and Insurance Products: * Are Not FDIC Insured * Are Not Bank Guaranteed * May Lose Value * Are Not a Bank Deposit * Are Not a Condition to Any Banking Service or Activity * Are Not Insured by Any Federal Government Agency. Attachments that are part of this EC may have additional important disclosures and disclaimers, which you should read. This message is subject to terms available at the following link: http://www.bankofamerica.com/emaildisclaimer. By messaging with Sender you consent to the foregoing. _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders