A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Dynamic Flash Filters

  1. #1
    live? gangsta?
    Join Date
    May 2006
    Posts
    14

    Dynamic Flash Filters

    Hi, I have downloaded the newest 3D Flash Animator to check out the new flash filters. But I can only set these filter at startup and I can't change their properties.

    Is there any way to change the properties of flash filters dynamically in 3D Flash Animator?

    I have found something in the flash documentation but I think it's not very useful:
    Code:
    import flash.filters.BlurFilter;
    //create a new movie clip called holder_mc
    var holder_mc:MovieClip = createEmptyMovieClip("holder_mc", 10);
    //create a nested movie clip called img_mc
    holder_mc.createEmptyMovieClip("img_mc", 20);
    //load an image into img_mc
    holder_mc.img_mc.loadMovie("http://www.helpexamples.com/flash/images/image2.jpg");
    //apply a blur filter
    holder_mc.filters = [new BlurFilter(10, 10, 2)];
    //position the movie clip on the Stage
    holder_mc._x = 75;
    holder_mc._y = 75;
    //adjust the blur filter when the mouse moves
    holder_mc.onMouseMove = function() {
      var tempFilter:BlurFilter = holder_mc.filters[0];
      tempFilter.blurX = Math.floor((_xmouse / Stage.width) * 255);
      tempFilter.blurY = Math.floor((_ymouse / Stage.height) * 255);
      holder_mc.filters = [tempFilter];
    };

    Thanks,
    livegangsta

  2. #2
    Senior Member kusco's Avatar
    Join Date
    Nov 2001
    Posts
    681
    Try these ...

    var _f = new flash.filters.BevelFilter;
    _f.angle = 45;
    _f.distance = 4;
    _f.blurX = 4;
    _f.blurY = 4;
    _f.highlightAlpha = 1;
    _f.highlightColor = 16777215;
    _f.knockout = false;
    _f.quality = 1;
    _f.shadowAlpha = 1;
    _f.shadowColor = 0;
    _f.strength = 1;
    _f.type = "inner";
    var _fa = this.filters;
    _fa.push (_f);
    this.filters = _fa;

    ////////////

    var _f = new flash.filters.BlurFilter;
    _f.blurX = 4;
    _f.blurY = 4;
    _f.quality = 1;
    var _fa = this.filters;
    _fa.push (_f);
    this.filters = _fa;

    /////////////

    var _f = new flash.filters.DropShadowFilter;
    _f.alpha = 1;
    _f.angle = 45;
    _f.distance = 4;
    _f.blurX = 4;
    _f.blurY = 4;
    _f.color = 0;
    _f.inner = false;
    _f.knockout = false;
    _f.quality = 1;
    _f.strength = 1;
    var _fa = this.filters;
    _fa.push (_f);
    this.filters = _fa;

    //////////////////

    var _f = new flash.filters.GlowFilter;
    _f.alpha = 1;
    _f.blurX = 4;
    _f.blurY = 4;
    _f.color = 0;
    _f.inner = false;
    _f.knockout = false;
    _f.quality = 1;
    _f.strength = 1;
    var _fa = this.filters;
    _fa.push (_f);
    this.filters = _fa;

    //////////////////

    var _f = new flash.filters.GradientBevelFilter;
    _f.angle = 45;
    _f.distance = 4;
    _f.blurX = 4;
    _f.blurY = 4;
    _f.colors = new Array (16777215,12632256);
    _f.alphas = new Array (1,1);
    _f.ratios = new Array (0,255);
    _f.knockout = false;
    _f.quality = 1;
    _f.strength = 1;
    _f.type = "inner";
    var _fa = this.filters;
    _fa.push (_f);
    this.filters = _fa;

    //////////////////

    var _f = new flash.filters.GradientGlowFilter;
    _f.angle = 45;
    _f.distance = 4;
    _f.blurX = 4;
    _f.blurY = 4;
    _f.colors = new Array (16777215,12632256);
    _f.alphas = new Array (1,1);
    _f.ratios = new Array (0,255);
    _f.knockout = false;
    _f.quality = 1;
    _f.strength = 1;
    _f.type = "inner";
    var _fa = this.filters;
    _fa.push (_f);
    this.filters = _fa;
    Cheers,
    kusco
    (3DFA Support Team)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center