4 Replies Latest reply on Aug 29, 2013 2:16 PM by kglad

    Help - displacementmapfilter (learning something new)

    JonnyDL Level 1

      I'm tring to expand my as2 skills with some animations. I found this and became interested in learning more. I went on the web and found a simple tutorail

      http://www.emanueleferonato.com/2007/12/03/understanding-flash-displacement-map-filter/

       

      It lays it out in a fashion I can understand, and experiment with, however the example I'm using/reusing to learn from is not working as expected. I was hoping someone familuar with this filter could see what Im doing wrong.

       

      Problem: when the displacementmapfilter is run it leaves a white border on the right egde and bottom edge (as if the map is not the right size)

      Screen shot 2013-08-29 at 3.44.14 PM.png

      I can't seem to see why thy don't match up. Hopefully, Some one can show me my error. I then hope to experiment somemore with the filter

      If any one has any websites that have tutorials for this filter please add them to the post.

      Here is my code if you need it. it should be identical to the tutorail

       

      attachMovie("bg","bg",1);

      attachMovie("ball","displace",2);

      ///places objects on stage

       

       

      channel1 = 1;

      //Assigning the value 1 (red) to the variable that will represent the X component

       

       

      channel2 = 2;

      //Assigning the value 2 (green) to the variable that will represent the Y component

       

       

      x_mult = 40;

      //Setting the variable that will represent the X scale to 40

       

       

      y_mult = 40;

      //Setting the variable that will represent the Y scale to 40

       

       

      mode = "clamp";

      //Setting the variable that will represent the filter mode to “clamp”

       

       

      offset = new flash.geom.Point(0, 0);

      //defining a new point for the offset of the displacement map

       

       

      bmp = new flash.display.BitmapData(bg._width,bg._height);

      //creating a new BitmapData item of the same size of the movie.

       

       

      displacement_map = new flash.filters.DisplacementMapFilter(bmp, offset, channel1, channel2, x_mult, y_mult, mode);

      //Create the displacement map itself

       

       

      bmp.draw(displace);

      //Draw the displacement map in the bitmap data

       

       

      bg.filters = [displacement_map];

      //Applying the displacement filter to the checkered object

       

       

      displace._visible = false;

      //Setting the displacement map to invisible;