[lively-kernel] startStepping error

Dan Ingalls danhhingalls at gmail.com
Mon Jul 12 07:42:31 CEST 2010


Hi, Patrick -

I don't have time to actually debug this, and others may be able to 
help you.  But, assuming you got morph.stepByVelocities to work once, 
I think the problem is that it's required for a morph to be in a 
world before you can use stepping.  Normally you would do this by 
calling super at the beginning, but I don't think your commented 
version of that will work.  Try instead...

BoxMorph.subclass("LauncherMorph", {
	addMorph: function($super, morph) {
		$super(morph);
		morph.velocity=pt(10,0);
		morph.angularVelocity=Math.PI/16;
		morph.moveOriginBy(morph.innerBounds().center());
		//morph.stepByVelocities();
		morph.startStepping(1000,"stepByVelocities");
	}
});

The rule is: if you wish to call an overridden method, then add the 
pseudo-argument '$super' at the beginning of the declared arguments. 
Thereafter you can use $super to refer to the overridden procedure.

If the problem is what I think it is, this should help.

Good luck
	- Dan
-------------------------------

>Hi, Folks. I have this script (below) in a TextMorph. When I 
>evaluate each line it seems to work fine, until the last line which 
>causes this error "Type Error: Cannot call method 'startSteppingFor' 
>of null". How do I debug this?
>
>BoxMorph.subclass("LauncherMorph", {
>	addMorph: function(morph) {
>		//super(morph);
>		morph.velocity=pt(10,0);
>		morph.angularVelocity=Math.PI/16;
>		morph.moveOriginBy(morph.innerBounds().center());
>		//morph.stepByVelocities();
>		morph.startStepping(1000,"stepByVelocities");
>	}
>});
>morph1 = new LauncherMorph(new Rectangle(50,100,80,360));
>morph1.openInWorld();
>morph2 = Morph.makeRectangle(new Rectangle(20,20,40,40));
>morph1.addMorph(morph2);
>
>Here's a link to my test 
>page: <http://www.lively-kernel.org/repository/lively-wiki/users/pshouse/test.xhtml>http://www.lively-kernel.org/repository/lively-wiki/users/pshouse/test.xhtml
>
>Thanks,
>Patrick
>
>_______________________________________________
>lively-kernel mailing list
>lively-kernel at hpi.uni-potsdam.de
>http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.hpi.uni-potsdam.de/archive/lively-kernel/attachments/20100711/816bc255/attachment-0001.htm 


More information about the lively-kernel mailing list