Difference between revisions of "Talk:Ui-concepts.as"

From Organic Design wiki
(that component stuff isn't making sense)
(Yip, that's making a lot of sense :-))
Line 1: Line 1:
Not quite sure what the aim is with ''component'' - but you usually create an object, maybe with something like:
 
:<tt>myObj = {}</tt>
 
Then put methods in it eg, <tt>myObj.myMeth = function( param ) { stuff };</tt>, but you've got a function and added a function to that, or something like that... --[[User:Nad|Nad]] 16:05, 4 Apr 2006 (NZST)
 
----
 
and remember semicolons on function-declarations that are also assignments. And its ok to have your functions inside the ''with'' without the ''object.method'' syntax like you had it if you like - just remember the smikalins.
 
 
'''male-bald isn't a valid identifier'''
 
 
and you have to use the method declaration syntax of
 
:<tt>object.method = function(parameters) { code };</tt>
 
 
 
 
 
here's an example fragment with events from a working swf:
 
here's an example fragment with events from a working swf:
 
<pre>
 
<pre>

Revision as of 04:24, 4 April 2006

here's an example fragment with events from a working swf:

	hours.onPress = function() {
		this.nbrRotationInit = 0;
		this.nbrPosX = fncGetX(this);
		this.nbrPosY = fncGetY(this);
		var nbrMyRotation = fncGetRotation(this);
		this.nbrRotationInit = nbrMyRotation-this._rotation;
		this.onEnterFrame = fncRotate;
		_global.drag = 'hour';
		};
	hours.onRelease = hours.onReleaseOutside = function() {
		delete this.onEnterFrame;
		_root.updateTime();
		_global.drag = '';
		};
	hours.onMouseMove = function() {
		if (_global.drag == 'hour') {
			_root.minute._rotation = this._rotation*12;
			_global.hour = int((_root.hours._rotation+360)/30)%12;
			}
		};