[Tweener] _DisplacementMap_mapPoint_x?

Zeh Fernando zeh at zehfernando.com
Sat Aug 30 16:14:49 PDT 2008


Yeah, I'll have to investigate this further. I can't do this right now, 
but thanks for the report, I'll have a look at it.

Zeh

Mitch Rosefelt wrote:
> Thanks Zeh:
> I've got this working by animating w/out Tweener, but the mapPoint tween 
> is definitely throwing an error.
> In the code below, the Tweener based scaling works, but not the 
> mapPoint.  Also, the displacement scale pops back to its initial value 
> when the Tween is complete (perhaps user error?)
> 
> import flash.display.BitmapData;
> import flash.display.Loader;
> import flash.events.MouseEvent;
> import flash.filters.DisplacementMapFilter;
> import flash.geom.Point;
> 
> import caurina.transitions.Tweener;
> import caurina.transitions.properties.*;
> caurina.transitions.properties.FilterShortcuts.init(); // _Displacement_*
> caurina.transitions.properties.DisplayShortcuts.init(); // _scale
> 
> var objToDisplace:MovieClip = dog_mc;
> var dispSourceMap:MovieClip = dispShere_mc;
> 
> // Convert MC to Bitmap to use as displacement map
> var dispMap:BitmapData  = new BitmapData (this.dispSourceMap.width, 
> this.dispSourceMap.height, false, 0x00808080);
> var mtx:Matrix = new Matrix();
> mtx.translate(this.dispSourceMap.width/2, this.dispSourceMap.height/2);
> 
> // Add image to displacement map
> dispMap.draw(this.dispSourceMap, mtx);
> this.dispSourceMap.visible = false;
> 
> //Create Displacement Map Filter
> //Choices for pixels outside of map are INGNORE, WRAP, CLAMP, COLOR
> var dmf:DisplacementMapFilter = new DisplacementMapFilter;
> dmf.mapBitmap = dispMap;
> // Center the displacement the object
> dmf.mapPoint = new Point(objToDisplace.width/2-dispMap.width/2, 
> objToDisplace.height/2-dispMap.height/2);
> //trace (objToDisplace.name+": Height is 
> "+objToDisplace.height+dmf.mapPoint);
> dmf.componentX = BitmapDataChannel.RED;
> dmf.componentY = BitmapDataChannel.BLUE;
> dmf.mode = DisplacementMapFilterMode.WRAP;
> dmf.scaleX = 30;
> dmf.scaleY = 30;
> objToDisplace.filters = [dmf];
> 
> 
> //trace (objToDisplace.width);
> addEventListener(Event.ENTER_FRAME, onEnterFrame);
> function onEnterFrame(event:Event):void
> {
>    objToDisplace.filters = [dmf];
> }
> 
> //Tweener.addTween(objToDisplace,{x:(objToDisplace.x - 40), time:3, 
> delay:1, transition:"linear"});
> Tweener.addTween(objToDisplace,{_DisplacementMap_mapPoint_x:(objToDisplace.x 
> + 40), time:3, delay:1, transition:"linear"}); //Error
> 
> Tweener.addTween(objToDisplace,{_DisplacementMap_scaleX:120, time:3, 
> transition:"linear"}); //Works, but resets when finished
> 
> 
> 
> Zeh Fernando wrote:
>> Hey Mitch,
>>
>> I'm not really sure what's happening. If FilterShortcuts is properly 
>> inited before the tween, it should work.
>>
>> Zeh
>>
>> Mitch Rosefelt wrote:
>>> Hi All:
>>> I'm trying to use the _DisplacementMap_mapPoint_x to hold a 
>>> displacement map in place while the object being displaced is moved 
>>> across the Stage.
>>> At this point the displacement is being applied and the object moves 
>>> across the screen with the displacement.
>>> When I run the movie, it plays, but I get this error:
>>> ## [Tweener] Error: The property '_DisplacementMap_mapPoint_x' 
>>> doesn't seem to be a normal object property of [object MovieClip] or 
>>> a registered special property.
>>> I'm able to run the "Beating Heart" example (which is tre cool) with 
>>> no problem.
>>>
>>> Any suggestions will be appreciated.
>>> Thanks.
>>> Mitch
>>>
>>> // Code:
>>>
>>> import flash.display.BitmapData;
>>> import flash.display.Loader;
>>> import flash.events.MouseEvent;
>>> import flash.filters.DisplacementMapFilter;
>>> import flash.geom.Point;
>>>
>>> import caurina.transitions.Tweener;
>>> import caurina.transitions.properties.*;
>>> caurina.transitions.properties.FilterShortcuts.init(); // 
>>> _Displacement_*
>>> caurina.transitions.properties.DisplayShortcuts.init(); // _scale
>>>
>>> var objToDisplace:MovieClip = dog_mc;
>>>
>>> Tweener.addTween(objToDisplace,{x:(objToDisplace.x - 40), time:3, 
>>> delay:1, transition:"linear"});
>>> //Move the displacement map in the opposite direction:
>>> Tweener.addTween(objToDisplace,{_DisplacementMap_mapPoint_x:(objToDisplace.x 
>>> + 40), time:3, delay:1, transition:"linear"});
>>> _______________________________________________
>>> Tweener mailing list
>>> Tweener at lists.caurinauebi.com
>>> http://lists.caurinauebi.com/listinfo.cgi/tweener-caurinauebi.com
>>>
>> _______________________________________________
>> Tweener mailing list
>> Tweener at lists.caurinauebi.com
>> http://lists.caurinauebi.com/listinfo.cgi/tweener-caurinauebi.com
>>
>>
> _______________________________________________
> Tweener mailing list
> Tweener at lists.caurinauebi.com
> http://lists.caurinauebi.com/listinfo.cgi/tweener-caurinauebi.com
> 


More information about the Tweener mailing list