@Andy:
Yes, your method is mentioned in the current thread about "Override
_xscale and _yscale setter in AS2 " as follows:
"Don't use extending. Use composition..." :-)
But you have always to write wrappers for the usual MovieClip methods
or you have to offer a reference to the MovieClip you're using in your
composition:
class Something
{
private var mc:MovieClip; // not shared
public function attachMovie(...) {
mc.attachMovie(...); // wrap method
}
}
or:
class Something
{
public var mc:MovieClip; // share mc
}
@Ian:
Yes I do prefer the static create method by myself, but I always have
to write the "individual" create method. I thought, I could perhaps
leave this out. But I learned in another thread about FDT that Eclipse
offers class templates. I use ASDT/Flashout, so I'll check, if this
applies to my workflow, too.
Thank you both!
Matthias
2007/1/18, Ian Thomas <[EMAIL PROTECTED]>:
*sigh* The line:
return MyClip(ClipUtils.createCodeClip(" com.mycompany
,MyClip",parent,initObj,depth,inst));
should of course have read:
return MyClip(ClipUtils.createCodeClip("com.mycompany.MyClip
",parent,initObj,depth,inst));
Sorry!
Ian
On 1/18/07, Ian Thomas <[EMAIL PROTECTED]> wrote:
>
> On 1/17/07, Matthias Dittgen <[EMAIL PROTECTED]> wrote:
>
> >
> > And is there a way to automate the writing of SymbolName,SymbolLinked
> > and create for all my classes which extend MovieClip?
>
>
>
> Personally, I use b) (for clips which aren't in the library). There's no
> way to automate the writing of symbolName etc. (unless you start looking at
> preprocessors), but you can get rid of symbolName etc. completely to make
> life easier. For example:
>
> class com.mycompany.MyClip extends MovieClip
> {
> public static function
> create(parent:MovieClip,initObj:Object,depth:Number,inst:String):MyClip
> {
> return MyClip(ClipUtils.createCodeClip(" com.mycompany
> ,MyClip",parent,initObj,depth,inst));
> }
> }
>
> where ClipUtils looks like this:
>
> class ClipUtils
> {
> public static function
>
createCodeClip(classPath:String,parent:MovieClip,initObj:Object,depth:Number,inst:String):MovieClip
>
> {
> if (depth===undefined)
> depth=parent.getNextHighestDepth();
> if (inst===undefined)
> inst="inst"+depth;
> var constructor:Function=getConstructorFromPath(classPath);
> Object.registerClass("__Packages."+classPath,constructor);
> return parent.attachMovie
> ("__Packages."+classPath,inst,depth,initObj);
> }
>
> public static function
> getConstructorFromPath(classPath:String):Function
> {
> var arr:Array=classPath.split(".");
> var obj:Object=_global;
> for(var i:Number=0;i<arr.length;i++)
> {
> obj=obj[arr[i]];
> }
> return Function(obj);
> }
> }
>
>
> In case it's not clear, you can then write:
>
> var clip:MyClip=MyClip.create(parentMovie);
>
> and everything else will default to something appropriate.
>
> Hope that makes sense,
> Ian
>
_______________________________________________
[email protected]
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
_______________________________________________
[email protected]
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