-
Peace and good Vibes
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
-
Senior Member
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.
-
Peace and good Vibes
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
-
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|