Loading...
 
[Show/Hide Right Column]

Development

Flex Overloading

Overloading methods in Flex is NOT supported. There's a strange mix of strong typing and loose typing (a holdover from an ecmascript base?) going on. It seems it's possible to pass like as many arguments into a method as you want, but god forbid you establish different methods to handle it. So you have to set up overloading manually.

The basis for this comes from Farata systems(external link) and Darron Schall(external link). In this project, I use it for showing the current time of the video plus the status (playing/paused/seeking/etc):


	private function updateStatus( ... rest ):void {
		if (rest.length > 0){
			baseStatus = rest0 + "";
		}

		tf.text = video_screen.formattedTime + " " + baseStatus;
	}



"... rest" allows any number of comma-delimited variables. So in this case, if an argument is passed in we change the baseStatus string and then write it to the screen via the tf Text control. Otherwise we just update the time.

No guarantees about the awesomeness of this code, sorry.

(Now, what if you want to specify precisely what variables are allowed, and configurations thereof, instead of just some pot luck array? Well, you can't. Too bad.)