A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Build PROTOTYPE functions in AS2

Hybrid View

  1. #1
    Peace and good Vibes Pippomusic's Avatar
    Join Date
    Jan 2002
    Location
    Rome, Italy
    Posts
    169

    Build PROTOTYPE functions in AS2

    Hello

    In AS1, planning applications, I have been extending lots of built-in classes unsing prototype funcions.
    Especially MovieClip.

    How can I do the same in ActionScript 2.0?

    thanks
    Pippo

  2. #2
    Senior Member devnull_2k's Avatar
    Join Date
    Oct 2001
    Location
    Limehouse, Ontario - Never heard of it? Not surprised.
    Posts
    785
    code:

    class ClassName extends MovieClip
    {
    var property1:Type;
    var property2:Type;
    function ClassName(arg1:Type, arg2:Type,...argN:Type)
    {
    //constructor
    }

    function SetSomething(arg:Type):Void
    {
    property1 = arg;
    }

    function GetSomething():Type
    {
    return property1;
    }
    }

    Last edited by devnull_2k; 12-22-2003 at 12:03 PM.
    The future belongs to those who prepare for it today.

  3. #3
    Peace and good Vibes Pippomusic's Avatar
    Join Date
    Jan 2002
    Location
    Rome, Italy
    Posts
    169
    thanks...
    so, does every movieclip benefit from this?
    or should I link something in the library?

    I wish to find a way, as in AS1, to provide functionalities to all movieclips, not only the ones linked in the library...

    Ones created with createEmptyMovieClip too....

    thank you and wisdom
    Pippo

  4. #4
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food ™
    Posts
    3,789
    Something like this might work... Put an empty movieclip in the library with a linkage name of "Empty" - a AS 2.0 Class Name of EmptyMovieClip...

    code:
    // EmptyMovieClip.as 
    class EmptyMovieClip extends MovieClip {
    function EmptyMovieClip(t:MovieClip, n:String, d:Number) {
    t.attachMovie("Empty", n, d);
    }
    }

    // Movie.as
    myMC = new EmptyMovieClip(this, "myMC");


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