Welcome, Guest
  • Author Topic: extends MovieClip  (Read 2821 times)

    Elena

    • Server what's that
    • *
    • Posts: 50
      • View Profile
      • Email
    extends MovieClip
    « on: 09/18/03, 11:42 »
    hi,

    Let's say that I have a subclass extending the  class Movieclip... I know how to assign this new class to certain movieclip from the library -->linkage--> AS 2 class...but how can I assign this class directly with scripting from the main timeline?.

    And another thing is how prototype works in AS2 since AS2 is based in classes rather than prototypes?...If I extend a class (lets say Array) , how can I call this subclass from the timeline?....

    Sorry, but I'm getting really confuse  :P

    Elena

    • Server what's that
    • *
    • Posts: 50
      • View Profile
      • Email
    Re:extends MovieClip
    « Reply #1 on: 09/18/03, 11:47 »
    maybe you get confuse, so lets put an example:

    testM.as :
    Code: [Select]

    class testM extends MovieClip {
        function moveme() {
          this._x += 10;
       }
    }


    and i want to assign this subclass to the movieclip that I have on the maintimeline with the instance name Myclip...
    If  I'm going to the library-->linkage-->AS2 class: testM and in the maintime line :

    Code: [Select]

    Myclip.moveme()


    everything works...but I want to skip the linkage part...

    :P

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re:extends MovieClip
    « Reply #2 on: 09/25/03, 02:34 »
    To add simply functionality to existing Classes you can still use prototype ... if you plan more complex behaviours, then subclassing is the choice

    Jorge