>From the documentation here is what they say about prototype :

prototype (Object.prototype property)
public static prototype : Object

A reference to the superclass of a class or function object. The prototype
property is automatically created and attached to any class or function
object you create. This property is static in that it is specific to the
class or function you create. For example, if you create a custom class, the
value of the prototype property is shared by all instances of the class, and
is accessible only as a class property. Instances of your custom class
cannot directly access the prototype property, but can access it through the
__proto__ property.

Which means prototype is read only and that if you want to change it's value
you do so through __proto__

Another way to achieve what you want would be to add the following to your
class

 

class PixView extends MovieClip {

static var symbolName:String = "__Packages.PixView ";
static var symbolOwner:Function = PixView ;

var className:String = "PixView ";

function PixView {
// constructor code
}

// do your stuff

static var symbolLinked = Object.registerClass(symbolName, symbolOwner);

}

Then you can do the following anywhere, on stage or in another class:

import PixView;
var pv:PixView = PixView(this.attachMovie(PixView.symbolName, "pv",
this.getNextHighestDepth()));

and that's it. You have a MovieClip of the class PixView on stage.

 

Alain


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mendelsohn,
Michael
Sent: April 25, 2008 8:13 AM
To: Flash Coders List
Subject: [Flashcoders] __proto__ but not prototype?

Hi list...

I have a class (pixViewer extends MovieClip) and an empty MovieClip
(linkage:emptyMC, not registered to any class in the linkage dialog).  I
want attached this emptyMC to the stage and I want it to be an instance of
pixViewer.

__proto__ works, but why won't prototype or registerClass?

//works:
var pv:MovieClip = _root.createEmptyMovieClip("pixViewer", 180);
pv.__proto__ = new pixViewer(); pv.onLoad();

/*
Why doesn't this work:
pv.prototype = new pixViewer();
pv.registerClass(pixViewer);
*/


Thanks,
- MM

_______________________________________________
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

Reply via email to