A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [AS2] How do I Create Object-Orientated Functions?

  1. #1
    Member
    Join Date
    Apr 2009
    Posts
    62

    Question [AS2] How do I Create Object-Orientated Functions?

    Hello to all,
    I would like to know how to create an object-orientated functions in Actionscript 2. I'm actually not sure if that is what it's called...please correct me if I'm wrong. Anyway here's an example of how I want to be able to call my functions:
    PHP Code:
    missile.create(); 
    or
    PHP Code:
    missile.fire(); 
    Check out my firefox theme "PacStrata" here

  2. #2
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    Code:
    missile.create=function(){
    //blah blah blah
    }
    That's how you would make a function that you could call in that manner.
    Z¡µµ¥ D££

    Soup In A Box

  3. #3
    Member
    Join Date
    Apr 2009
    Posts
    62
    I'm guessing "missile" is a previously created object, right?

    EDIT: What about doing something like this(javascript)
    PHP Code:
    cat.prototype.changeName = function(name) {
        
    this.name name;
    }

    firstCat = new cat("pursur")
    firstCat.changeName("Bill")
    firstCat.talk() //alerts "Bill says meeow!" 
    in Actionscript?
    Last edited by Vadersapien; 12-18-2009 at 03:57 AM.
    Check out my firefox theme "PacStrata" here

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center