[Golist] OverlapMonitor and "locking" a tween

Robert Sköld robert at bennybula.com
Thu Apr 3 02:29:45 PDT 2008


Hey all!

First of all, i've manage to "fix" the tweens i had issues with  
earlier by using the OverlapMonitor instead of the self-made hack i  
did. It works great, but...

I'm trying to add a "locking" feature to the tweens, so that if they  
have locked="true" as an attribute (it's an xml-based parser) it's not  
supposed to be "overridden" by the OverlapMonitor and other newer  
tweens.
And it's working somewhat ok, besides when the tween that overlaps the  
"locked" tween is the same as the "locked" tween.
For example: if the same tween is ran twice by clicking the same  
button. Then the tween "restarts" but from the same position, but with  
the same duration. But not if i have another tween started from  
another button which overlaps with the running "locked" tween.

One problem seems to be that if the tween is the same as an already  
running tween it is stopped/removed even before it's "managed", so  
there's no way to stop it from being overridden.

I'm sure this must be a common issue, so any suggestions on how to  
solve this?



Some code (the IManageable part) from my Animate class (the rest is  
more or less the tutorial, but with some color transformation stuff):

		public function getActiveTargets() : Array {
			return [ target ];
		}
		public function getActiveProperties() : Array {
			return _properties;
		}

		public function isHandling( properties : Array , handler :  
IManageable ) : Boolean {
			return properties.every( hasProperty );
		}
		
		private function hasProperty( property : Property , index : int ,  
arr : Array ) : Boolean {
			for each( var prop : Property in _properties ) // Property is a  
local class with name,start,change and end properties.
				if( prop.name == property.name )
					return true;
			return false;
		}

		public function releaseHandling( ...params ) : void {
			var handler : Animate = params[0] as Animate; // added the  
parameter in OverlapMonitor.reserve();
			if( _locked ) {
				// Since the handler didn't start yet, we need to remove it  
instead of stopping it.
				trace( "Handler removed: " + GoEngine.removeItem( handler ) ,  
"id:" + handler.id );
			} else {
				trace( "Target stop: " + stop() , "for" , this.id );
			}
		}


Any help would be much appreciated!

/ bob




More information about the GoList mailing list