[Golist] OverlapMonitor and "locking" a tween
Robert Sköld
robert at bennybula.com
Sat Apr 5 01:32:31 PDT 2008
Thanks, altough i did figure out a much better way to "lock" those
tweens. Instead of messing with the manager parts (which works great
for it's own purpose btw) I've just overidden the stop method, and
just let it return false unless it's complete (or the variable locked
is false).
example:
override public function stop() : Boolean {
return ( _locked && !_complete ) ? false : super.stop();
}
I totally stared myself blind at first at the overlapmonitor, but i
must say it works great!
So thanks for Go! :)
/bob
On Apr 5, 2008, at 03:49, Moses Gunesch wrote:
> I dunno that's a tough one... personally I wouldn't guess that
> anything is a common issue yet, I haven't seen many people dabbling
> in manager mechanics so far. I'm excited to see what you come up
> with though and once I get this writing thing out of the way I'll
> help you debug if need be.
> - m
>
>
> On Apr 3, 2008, at 5:29 AM, Robert Sköld wrote:
>
>> 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
>>
>>
>> _______________________________________________
>> GoList mailing list
>> GoList at goasap.org
>> http://goasap.org/mailman/listinfo/golist_goasap.org
>
> _______________________________________________
> GoList mailing list
> GoList at goasap.org
> http://goasap.org/mailman/listinfo/golist_goasap.org
More information about the GoList
mailing list