[Flashcoders] extends MovieClip and static methods
Hi, Is it possible to have a class that extends MovieClip linked to a movie in the library and have statics methods and vars in it ?? L ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] extends MovieClip and static methods
Sorry I was not receiving mails when I send that: Hi, Is it possible to have a class that extends MovieClip linked to a movie in the library and have statics methods and vars in it ?? L if any answer can you repost ? thx :) L ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] extends MovieClip and static methods
Hi, Laurent, I don't see why not... if you're having trouble, the number one culprit when doing library linkage is often that the Flash IDE has an incorrect Class name and is secretly creating an unrelated class file behind the scenes. Double check your linkage settings, make sure the package is correct, etc. -jonathan On Mon, Oct 6, 2008 at 7:39 AM, laurent [EMAIL PROTECTED] wrote: Sorry I was not receiving mails when I send that: Hi, Is it possible to have a class that extends MovieClip linked to a movie in the library and have statics methods and vars in it ?? L if any answer can you repost ? thx :) L ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] extends MovieClip and static methods
Hi Jonathan, No the linking is good, I actually compile the fla containing that class with no problem. But when compiling my main that refer the the static method of that class it throw me errors about 1119: Access of possibly undefined property body through a reference with static type client.frenchdandy:CaddyView. like one mc on stage is undefined. of course because it will be defined when the mc containing that class will be added to the main stage...so why is it checking now??!! thx L jonathan howe a écrit : Hi, Laurent, I don't see why not... if you're having trouble, the number one culprit when doing library linkage is often that the Flash IDE has an incorrect Class name and is secretly creating an unrelated class file behind the scenes. Double check your linkage settings, make sure the package is correct, etc. -jonathan On Mon, Oct 6, 2008 at 7:39 AM, laurent [EMAIL PROTECTED] wrote: Sorry I was not receiving mails when I send that: Hi, Is it possible to have a class that extends MovieClip linked to a movie in the library and have statics methods and vars in it ?? L if any answer can you repost ? thx :) L ___ 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
[Fwd: Re: [Flashcoders] extends MovieClip and static methods]
Hi Jonathan, No the linking is good, I actually compile the fla containing that class with no problem. But when compiling my main that refer the the static method of that class it throw me errors about 1119: Access of possibly undefined property body through a reference with static type client.frenchdandy:CaddyView. like one mc on stage is undefined. of course because it will be defined when the mc containing that class will be added to the main stage...so why is it checking now??!! thx L jonathan howe a écrit : Hi, Laurent, I don't see why not... if you're having trouble, the number one culprit when doing library linkage is often that the Flash IDE has an incorrect Class name and is secretly creating an unrelated class file behind the scenes. Double check your linkage settings, make sure the package is correct, etc. -jonathan On Mon, Oct 6, 2008 at 7:39 AM, laurent [EMAIL PROTECTED] wrote: Sorry I was not receiving mails when I send that: Hi, Is it possible to have a class that extends MovieClip linked to a movie in the library and have statics methods and vars in it ?? L if any answer can you repost ? thx :) L ___ 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
Re: [Flashcoders] extends MovieClip and static methods
ok being less demanding, I made the call to my static method from the mc ( menu ) containing the class and from my main, I call menu.function(); that call the static one. No call of the static method is made from outside de mc it's compiled in. It's a workaround, I have no idea if it's possible to do what I wanted. L laurent a écrit : Hi Jonathan, No the linking is good, I actually compile the fla containing that class with no problem. But when compiling my main that refer the the static method of that class it throw me errors about 1119: Access of possibly undefined property body through a reference with static type client.frenchdandy:CaddyView. like one mc on stage is undefined. of course because it will be defined when the mc containing that class will be added to the main stage...so why is it checking now??!! thx L jonathan howe a écrit : Hi, Laurent, I don't see why not... if you're having trouble, the number one culprit when doing library linkage is often that the Flash IDE has an incorrect Class name and is secretly creating an unrelated class file behind the scenes. Double check your linkage settings, make sure the package is correct, etc. -jonathan On Mon, Oct 6, 2008 at 7:39 AM, laurent [EMAIL PROTECTED] wrote: Sorry I was not receiving mails when I send that: Hi, Is it possible to have a class that extends MovieClip linked to a movie in the library and have statics methods and vars in it ?? L if any answer can you repost ? thx :) L ___ 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] extends MovieClip
Look into the [Inspectable] metadata tag. If you place it before a class variable or property, then setting the class under the component definition will automatically populate the parameters. class MyClass { //... [Inspectable(defaultValue=default)] public var myVar:String; [Inspectable] public function get myProp():Number { return _prop; } public function set myProp(value:Number):Void { _prop = isFinite(value) ? Math.floor(value) : 0; } private var _prop:Number; //... } There are other options: enumeration, different types, etc. On 2/16/07, David Cohn [EMAIL PROTECTED] wrote: Hey all, As per my earlier thread, I've been playing around with the Component Definition dialog box in order to create a class which extends MovieClip, where the class can be passed parameters (or, set in the Parameters tab as the case may be). This seems to implement what I want, but I'm puzzled about the behavior of the Component Definition dialog box. What I do is: -- Set Linkage...: AS 2.0 Class: MyPackage.myClass -- Open Component Definition... and enter Parameters like: Parameters: TypesType typeA String Degree nDegree 37.5Number -- Now, what puzzles me is the behavior of the AS 2.0 Class field in this dialog box: AS 2.0 Class: MyPackage.myClass(val) -- this seems to work; the parameters are set correctly for the instance. Puzzlement 1: val can be *anything*, as long as it's just one word (e.g. it can't be sType,nDegree) and the parameters are set correctly! AS 2.0 Class: MyPackage.myClass() -- this gives me a syntax error AS 2.0 Class: MyPackage.myClass -- Puzzlement 2: this causes all the parameters to disappear next time the dialog box is open, and the parameters aren't set for the instance! Am I using this thing right? I can't make heads or tails of what's going on! Thanks, --Dave ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com -- T. Michael Keesey Director of Technology Exopolis, Inc. 2894 Rowena Avenue Ste. B Los Angeles, California 90039 -- The Dinosauricon: http://dino.lm.com Parry Carney: http://parryandcarney.com ISPN Forum: http://www.phylonames.org/forum/ ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] extends MovieClip
Also, leave the Parameters in the Component Definition window blank, it's there for backwards compatibility and will be filled in automatically if you use [Inspectable] metadata in your class. But for that to work you need to fill in the class (including package) in the AS 2.0 Class field - just below the paramaters in the Component Definition window. When you make changes to a class' [Inspectable] metadata, those changes are not reflected in the fla immediatly. For instance, if you add new Inspectable metadata and you have a movieclip instance on stage, you won't see the properties show up in the Parameters. You'll have to compile the fla first, or make the movieclip a compiled clip and recompile it each time you change the class. regards, Muzak - Original Message - From: T. Michael Keesey [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: Saturday, February 17, 2007 9:08 AM Subject: Re: [Flashcoders] extends MovieClip Look into the [Inspectable] metadata tag. If you place it before a class variable or property, then setting the class under the component definition will automatically populate the parameters. class MyClass { //... [Inspectable(defaultValue=default)] public var myVar:String; [Inspectable] public function get myProp():Number { return _prop; } public function set myProp(value:Number):Void { _prop = isFinite(value) ? Math.floor(value) : 0; } private var _prop:Number; //... } There are other options: enumeration, different types, etc. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] extends MovieClip
Hey all, As per my earlier thread, I've been playing around with the Component Definition dialog box in order to create a class which extends MovieClip, where the class can be passed parameters (or, set in the Parameters tab as the case may be). This seems to implement what I want, but I'm puzzled about the behavior of the Component Definition dialog box. What I do is: -- Set Linkage...: AS 2.0 Class: MyPackage.myClass -- Open Component Definition... and enter Parameters like: Parameters: TypesType typeA String Degree nDegree 37.5Number -- Now, what puzzles me is the behavior of the AS 2.0 Class field in this dialog box: AS 2.0 Class: MyPackage.myClass(val) -- this seems to work; the parameters are set correctly for the instance. Puzzlement 1: val can be *anything*, as long as it's just one word (e.g. it can't be sType,nDegree) and the parameters are set correctly! AS 2.0 Class: MyPackage.myClass() -- this gives me a syntax error AS 2.0 Class: MyPackage.myClass -- Puzzlement 2: this causes all the parameters to disappear next time the dialog box is open, and the parameters aren't set for the instance! Am I using this thing right? I can't make heads or tails of what's going on! Thanks, --Dave ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] extends MovieClip
Hey all, Is it possible to use a class extends MovieClip on a pre-existing (authored) MovieClip? I'd like to seamlessly do something like: class blah extends MovieClip { public function blah() { this.onRelease = function() { // handle release here }; }; }; ... but I can't see how to set this up (I'm using ActionScript 2.0, but is there a 3.0 only solution?). If not, what do people think is the most elegant way to handle this, e.g.: class blah { public function blah( caller:MovieClip ) { caller.onRelease = function() { (blah instance).handleRelease(); }; }; public function handleRelease() { // handle release here }; }; ...I'd like to make this as seamless as possible for the graphic designers. Thanks, --Dave ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] extends MovieClip
Sounds like you are trying to extend an instance of a MovieClip, rather than MovieClip itself. Naturally, you can extend a class that extends MovieClip, but not an instance. Are you really thinking of instance.onRelease= function () { // whatever } perhaps? - Original Message - From: David Cohn [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Sunday, February 04, 2007 8:07 PM Subject: [Flashcoders] extends MovieClip Hey all, Is it possible to use a class extends MovieClip on a pre-existing (authored) MovieClip? I'd like to seamlessly do something like: class blah extends MovieClip { public function blah() { this.onRelease = function() { // handle release here }; }; }; ... but I can't see how to set this up (I'm using ActionScript 2.0, but is there a 3.0 only solution?). If not, what do people think is the most elegant way to handle this, e.g.: class blah { public function blah( caller:MovieClip ) { caller.onRelease = function() { (blah instance).handleRelease(); }; }; public function handleRelease() { // handle release here }; }; ...I'd like to make this as seamless as possible for the graphic designers. Thanks, --Dave ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] extends MovieClip
Hello :) try this code : class Component extends MovieClip { // constructor function Component() { } / Init AsBroadcaster static private var _INIT_BROADCASTER_ = _global.AsBroadcaster.initialize( Component.prototype ) ; public var addListener:Function ; public var broadcastMessage:Function ; public var removeListener:Function ; / public function onPress():Void { // your code this.broadcastMessage( onClick , this) ; } } If you want use a method inside the class... no problemo but now if you want use a listener and a movieclip who extend this class : var mc:MovieClip ; // the movieclip in the _root for example // Inherit the custom class mc.__proto__ = Component.prototype ; Component.prototype.call(mc) ; mc.addListener(this) ; this.onClick = function ( target:MovieClip ) { trace( click : target ) ; } If you want a better solution .. you can use my openSource framework VEGAS ( http://vegas.riaforge.org/ ) and the package vegas.util.factory.. in this package you can find the class DisplayFactory : http://svn.riaforge.org/vegas/AS2/trunk/src/vegas/util/factory/DisplayFactory.as If you want test this class.. 1 - download vegas 2 - install in your actionscript preference (in flash) the classpath of vegas in AS2/trunk/src 3 - Test the examples in AS2/trunk/bin/test/vegas/util/factory : http://svn.riaforge.org/vegas/AS2/trunk/bin/test/vegas/util/factory/ You can use the composition pattern and not the extend pattern to control a movieclip... in my framework you can use the DisplayObject AS2 class in the asgard.display package. EKA+ :) 2007/2/4, David Cohn [EMAIL PROTECTED]: Hey all, Is it possible to use a class extends MovieClip on a pre-existing (authored) MovieClip? I'd like to seamlessly do something like: class blah extends MovieClip { public function blah() { this.onRelease = function() { // handle release here }; }; }; ... but I can't see how to set this up (I'm using ActionScript 2.0, but is there a 3.0 only solution?). If not, what do people think is the most elegant way to handle this, e.g.: class blah { public function blah( caller:MovieClip ) { caller.onRelease = function() { (blah instance).handleRelease(); }; }; public function handleRelease() { // handle release here }; }; ...I'd like to make this as seamless as possible for the graphic designers. Thanks, --Dave ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com