Jul 1, 2009

GTweenFilter error: no filter at index '0'

Error: GTweenFilter: no filter at index '0'.
at com.gskinner.motion::GTweenFilter/updatePropertyTarget()[com\gskinner\motion\GTweenFilter.as:73]
at com.gskinner.motion::GTweenFilter/init()[com\gskinner\motion\GTweenFilter.as:88]
at com.gskinner.motion::GTween/setPosition()[com\gskinner\motion\GTween.as:737]
at com.gskinner.motion::GTween/handleTick()[com\gskinner\motion\GTween.as:826]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at HybridTicker/tick()[com\gskinner\motion\GTween.as:906]


This is the error you will see when you use GTweenFilter to do a blur, drop shadow or any other special property tweening.
I used the following code:

var blurTween:GTweenFilter = new GTweenFilter(obj, 0.6, {blurX:0,blurY:0}, {delay:1.0});


I was also getting the same error. I tried to give a filter index in the tween, but no help:

var blurTween:GTweenFilter = new GTweenFilter(obj, 0.6, {blurX:0,blurY:0}, {delay:1.0, filterIndex:0});
 
Then I came to know that I should first add respective filters to the target object and then use its tweening.
Thus I changed my code to make it:

obj.filters = [new BlurFilter( 0, 0, BitmapFilterQuality.MEDIUM )];
var blurTween:GTweenFilter = new GTweenFilter(obj, 0.6, {blurX:0,blurY:0}, {delay:d, filterIndex:0});


It is working now.

No comments:

Post a Comment

I love comments.