Apply Animated Filter To An Image
I'm at war with this code for a week now .. I managed to get ripple effect, but it doesn't apply to image positioned behind. So I need some directions on how to achieve that.Right now the image is steel and doesn't move with the ripples. Any help is appritietedThe code itself is in 2 classes, first is Ripples.asCode: package{ import flash.display.Sprite; import flash.events.*; import RippleCanvas; public class Ripples extends Sprite { private var subobj:RippleCanvas; public function Ripples() { trace("Ripples Initialized"); var subobj = new RippleCanvas(); this.addChild(subobj); } }}And second is RippleCanvas.asCode: package{ import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.Sprite; import flash.events.*; import flash.events.*; import flash.geom.*; import flash.filters.*; import flash.display.BlendMode; public class RippleCanvas extends Sprite { internal var sourceBmp:BitmapData; internal var paintBmpData:BitmapData; internal var paintBmpData2:BitmapData; private var buffer:BitmapData; private var paintBmp:Bitmap; private var output:Bitmap; private var brush:Sprite; private var logo:Sprite; private var filter:BitmapFilter; private var filter2:BitmapFilter; private var disp:BitmapFilter; private var outputBmpData:BitmapData; private var surface:BitmapData; internal var pt = new Point(0,0); internal var matrix1 = new Matrix(); public function RippleCanvas() { paintBmpData = new BitmapData(128, 98, false, 0x40); //new image(166,240); paintBmpData2 = new image(166,240); //new BitmapData(128, 98, false, 0x40); logo = new Sprite(); brush = new Sprite(); brush.graphics.beginFill(0xFFFFFF,1); brush.graphics.drawCircle(0,0,4); trace ("RIppleCanvas started..");// surface = new BitmapData(128, 98, true, 0x000000); surface=new image(166,240); surface.blendMode = BlendMode.ADD; surface.draw(logo); sourceBmp=new image(166,240); sourceBmp.blendMode = BlendMode.ADD;// sourceBmp = new BitmapData(128, 98, false, 0x40); buffer = paintBmpData.clone(); outputBmpData = new BitmapData(128, 98, false, 0x40); //new image(166,240); scaleX = 8.0; scaleY = 8.0; this.addEventListener(MouseEvent.MOUSE_DOWN, this.downEvent, false, 0, true); this.addEventListener(MouseEvent.MOUSE_UP, this.upEvent, false, 0, true); this.addEventListener(Event.ENTER_FRAME, this.update, false, 0, true); paintBmp = new Bitmap(paintBmpData); var cmat:Array = [ 1, 1, 1,1, 1, 1, 1, 1, 1 ] ; filter = new ConvolutionFilter(3, 3, cmat, 9, 0); filter2 = new BlurFilter(4,4); output = new Bitmap(outputBmpData);// output.blendMode = BlendMode.ADD; // paintBmp.blendMode = BlendMode.ADD; addChild(output); addChild(paintBmp); //var tf = new TextField(); //tf.text = "testing123"; //addChild(tf); disp = new DisplacementMapFilter(paintBmpData2, new Point(), 4, 4, 48, 48, DisplacementMapFilterMode.IGNORE ); this.filters = new Array(new BlurFilter(16, 16)); this.blendMode = BlendMode.ADD; } function update(e:Event) { if(parent!=null){ var localPt:Point = parent.globalToLocal(new Point(parent.mouseX*0.125, parent.mouseY*0.125)); var m:Matrix = new Matrix(); m.translate(localPt.x, localPt.y); sourceBmp.draw(brush, m, null, 'invert'); } trace (localPt); paintBmpData.applyFilter(sourceBmp, paintBmpData.rect, pt, filter); paintBmpData.draw(paintBmpData, matrix1, null, 'add'); paintBmpData.draw(buffer, matrix1, null, 'difference'); paintBmpData.draw(paintBmpData, matrix1, new ColorTransform(0, 0, 0.98609374, 1, 0, 0, 2, 0)); paintBmpData2.draw(paintBmpData, matrix1); outputBmpData.applyFilter(surface, outputBmpData.rect, pt, disp); buffer = sourceBmp; sourceBmp = paintBmpData.clone(); } public function downEvent(e:Event) { if(e.stageX == 0 && e.stageY == 0) return; var curPt:Point = parent.globalToLocal(new Point(e.stageX, e.stageY)); e.stopPropagation(); } public function upEvent(e:Event) { e.stopPropagation(); } }}Code itself is in a mess right now as I tryed every single combination, without any success.. so plz help
Actionscript 3.0
Posted on: Sun Mar 09, 2008 11:51 am
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Apply Blur Filter On Image In Different Layer?
I have one load which loads image randomly from external folder.
and another layer which has 5 columns. I wish to do a mouse over thing and one of the column will become blur.
I tried to use the blur filter, but can't seem to get it work on image that loads randomly from external folder.
this is the action script code I used for loading external images:
Quote: pic_arr = ["images/1", "images/2", "images/3", "images/4", "images/5"];
onLoad = function() {
ranNum = Math.floor(Math.random()*pic_arr.length);
holder_mc.loadMovie(pic_arr[ranNum]+".jpg");
};
any help?
Bitmapdata, Apply Filter To One Channel? Realease A Filter
Hi there, I have two question:
Is it possible to apply a filter only to one channel or to access only one channel?
I've found somewhere:
Display.BitmapData.Channel.ALPHA
Is it something we can access at runtime?
When I appply a filter to a Bitmapdata, the Bitmapdata isn't really modified but just filtered, so if for example I copy one of its channel to another bitmapdata, I copy the source bitmap without the filter...
What I'd like to do is "release" the filter so it definetely modify the image. Is it a function to do so or can I only perform this by doing a screenshot of my MovieClip?
Thank you inadvance for your help.
[F8] Apply Filter To Mc Drawn With Api
Obvioulsy I'm blind.... WHY is't this code working...??!!!!!
Code:
import flash.filters.GlowFilter;
this.createEmptyMovieClip("mc_line",1);
with ("mc_line"){
lineStyle(20, 0xd1bca3,100);
_root.moveTo(0, 160);
_root.lineTo(Stage.width, 160);
// glow on the line
var glow:GlowFilter = new GlowFilter(0x003a68, 0.5, 0, 10, 5, 10,true);
var myTempFilters:Array = mc_line.filters;
myTempFilters.push(glow);
mc_line.filters = myTempFilters;
}
I've tried the glow-on-the-line part inside and outside the with statement.
The glow-on-the-line part works fine if I put an instance of a movie clip on the stage but not as above...
Why?!
I'd be greatful for a hint in the right direction...
Apply Filter @ Runtime
hi everybody.
I've got 4 dynamic TextFields inside a MovieClip.
on onRollOver I want to apply a DropShadowFilter to this MovieClip, and on onRollOut I want to remove the DropShadowFilter.
pretty simple task, I hope
..how do I do it?
here's my onRollOver and onRollOut-code:
ActionScript Code:
allContainer_mc.textHolder10.onRollOver = function(){
trace("onRollOver");
}
//
allContainer_mc.textHolder10.onRollOut = function(){
trace("onRollOut");
}
thanks
Apply Website Transition Filter?
Hey I'm new to AS , so I was wondering how would I go at attempting this?
On the website I'm building , I currently have it so when you click a link, it removes the current page and animates a new one, really simple, but how would I apply a filter transition? I downloaded a blur filter and installed it to flash cs3, so instead of just removing a page and motion tweening the new one, i would like to just do a motion blur tween between the current page, and the page clicked, how would I do that? This is my current code.
Should I upload the .fla file?
(EDIT) why wont it let me upload my code in CODE brackets? it gives me this error:
You have included 5 images in your message. You are limited to using 4 images so please go back and correct the problem and then continue again.
Change Color Then Apply Filter?
I have a simple circle movie clip in my library. The circle is green. I would like, at runtime, to change its color to blue, red, whatever. Then I want to apply a bevel filter to it.
The problem is that after I apply the color, the filter is ignored.
//First change color
var changeColor = new Color(mcCircle);
changeColor.setRGB(bitOnColor);
//Then apply filter
var innerBevel:BevelFilter = new flash.filters.BevelFilter();
var myFilters:Array = mcCircle.filters;
myFilters.push(innerBevel);
mcCircle.filters = myFilters;
Clearly I'm missing the point here. Anyone know the right way to do this? Thanks very much.
-jheske
Apply Text Filter Dynamically
How can I add a glow filter to a textfield via actionscript? I know the procedure for doing the same thing with a movieclip, but the TextField class (and TextFormat) don't seem to accept filters as a property?
What I have so far:
ActionScript Code:
import flash.filters.*;var text_glow:GlowFilter = new GlowFilter(0xFF0000, 80, 10, 10, 100, 3, false, false);var some_txt:TextField;//Want to apply filter to text field
Unable To Apply Blur Filter
The code below fades three mc instances into each other. The movieclip instances are called, picture1_mc, picture2_mc,picture3_mc. They are based on three bitmap images that also sit in the library. I manually converted the original bitmaps into movieclips on the stage area. The fade code works fine, but what I would like to do is allow the user to
mouse click and cause a blur effect whilst the images are cycling along. My problem is that Im not sure how to apply this within my mousedown function. The applyFilter method seems to call for bitmaps but I'm dealing with movieclips. Thanks for any guidance
import flash.display.BitmapData;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.filters.BlurFilter;
var filter2:BlurFilter = new BlurFilter(Math.ceil(Math.random()*5), Math.ceil(Math.random()*5), 3);
init = function () {
currentIndex = 1;
currentLayer = 1;
howLongToWait = 0;
_root.attachMovie("picture1_mc", "pic1", 0);
addNewPic();
};
addNewPic = function () {
clearInterval(myInterval);
if (currentIndex%3 != 0) {
currentIndex++;
} else {
currentIndex = 1;
}
newlyAdded_mc = _root.attachMovie("picture"+currentIndex+"_mc", "pic"+currentIndex, currentLayer++);
newlyAdded_mc._alpha = 0;
newlyAdded_mc.onEnterFrame = function() {
this._alpha += 2;
if (this._alpha>=100) {
this.onEnterFrame = null;
myInterval = setInterval(addNewPic, howLongToWait*100);
}
};
};
// run init()
init();
onMouseDown = function ()
{
//problems here!!!!!!!!!
var pointoint = new Point(_root._xmouse, _root._ymouse);
var rec:Rectange = new Rectangle(100,100,6,6);
//problem applying filter
//????.applyFilter(?????,rect,point,filter2)
};
myListener = new Object();
Mouse.addListener(myListener);
[AS3.0] Apply Filter To TextField Programmatically
Hi there!
I tried this using
Code:
textField.filters = [new GlowFilter()]
or just like in Flash8 passing the .filters array ref to another array and pushing filter to that array [was it?], but none of these steps worked.
Applying filter to Sprite, within which the TextField (_title) is contained:
Code:
var tit:Sprite = new Sprite();
tit.addChild(_title);
tit.filters = [new GlowFilter(0xFFFFFF,1,5,5,2,2)]
addChild(tit);
worked, however this method (using extra sprite for a textfield) is just too dirty, let alone we want to apply filters to multiple textfields..
Anyone knows how to apply filter directly to TextField instance in AS3.0?
Thanks!
Apply Filter To Just One Bitmap Data, No The Others?
Greetings,
I was following lee's tutorial on how to create advanced effects on bitmap data (like using the blur filter). I am not used to working with bitmap data and don't find it's creation and structure intuitive. Something I am not understanding is how to just blur a single clip and build the draw loop so that only that clips bitmap data gets drawn and blurred while other clips stay untouched. Any object I put onto the main timeline ends up bluring. I tried creative a sprite that contained the clip and then targeted that sprite, but still, any clip, or any object on the stage was blured and redrawn. Any help would be appreciated. Thanks!
Code:
import caurina.transitions.*;
var bmd:BitmapData = new BitmapData(550, 400, true, 0x000000);
var bm:Bitmap = new Bitmap(bmd);
var s:Sprite = new Sprite();
addChild(s);
s.addChild(bm);
var bf:BlurFilter = new BlurFilter(8, 8, 3);
var cmf: ColorMatrixFilter = new ColorMatrixFilter([1,0,0,0,0,
0,1,0,0,0,
0,0,1,0,0,
0,0,0,1,0]);
var logo:Logo = new Logo();
s.addChild(logo);
logo.scaleX = logo.scaleY = .14;
function mover(){
var myY:Number = Math.random()*stage.stageHeight;
var myTrans:String
myY <= logo.y ? myTrans = "easeOutExpo" : myTrans = "easeOutBounce";
Tweener.addTween(logo,{x:Math.random()*stage.stageWidth,
y:myY, time: 1,
rotation:Math.random()*300, onComplete:mover,
transition:myTrans});
}
mover();
addEventListener(Event.ENTER_FRAME, loop);
function loop(e:Event):void{
bmd.draw(s);
bmd.applyFilter(bmd, bmd.rect, new Point(0,0), bf);
bmd.applyFilter(bmd, bmd.rect, new Point(0,0), cmf);
bmd.scroll(0, -5);
}
Unable To Apply Blur Filter On Mouse Down Event
The code below fades three mc instances into each other. The movieclip instances are called, picture1_mc, picture2_mc, picture3_mc. They are based on three bitmap images that also sit in the library. I manually converted the original bitmaps into movieclips on the stage area. The fade code works fine, but what I would like to do is allow the user to
mouse click and cause a blur effect whilst the images are cycling along. My problem is that Im not sure how to apply this within my mousedown function. The applyFilter method seems to call for bitmaps but I'm dealing with movieclips. Thanks for any guidance
import flash.display.BitmapData;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.filters.BlurFilter;
var filter2:BlurFilter = new BlurFilter(Math.ceil(Math.random()*5), Math.ceil(Math.random()*5), 3);
init = function () {
currentIndex = 1;
currentLayer = 1;
howLongToWait = 0;
_root.attachMovie("picture1_mc", "pic1", 0);
addNewPic();
};
addNewPic = function () {
clearInterval(myInterval);
if (currentIndex%3 != 0) {
currentIndex++;
} else {
currentIndex = 1;
}
newlyAdded_mc = _root.attachMovie("picture"+currentIndex+"_mc", "pic"+currentIndex, currentLayer++);
newlyAdded_mc._alpha = 0;
newlyAdded_mc.onEnterFrame = function() {
this._alpha += 2;
if (this._alpha>=100) {
this.onEnterFrame = null;
myInterval = setInterval(addNewPic, howLongToWait*100);
}
};
};
// run init()
init();
onMouseDown = function ()
{
//problems here!!!!!!!!!
var point:Point = new Point(_root._xmouse, _root._ymouse);
var rec:Rectange = new Rectangle(100,100,6,6);
//problem applying filter
//????.applyFilter(?????,rect,point,filter2)
};
myListener = new Object();
Mouse.addListener(myListener);
One Animated Filter, Multiple Buttons...
I have a filter I've applied to multiple buttons, and it animates (using onEnterFrame) with onRollOver and onRollOut functions applied to each button. The problem is, sometimes when I roll over one button, it also animates the filter on another button (because they are using the same filter).
I know the obvious solution is to have a different filter applied to each button, but I'm concerned that this would slow things down. Also, I can't help but think there is another way to solve this, particularly because this issue only occurs some of the time, not all of it.
Here is the AS code I'm using.
Code:
import flash.filters.*;
var buttonShadow:DropShadowFilter = new DropShadowFilter(0, 0, 0x000000, 20, 5, 5, 5, 3, false, false, false);
b1.filters = b2.filters = [buttonShadow];
var buttonOver = function (targetMC) {
targetMC.onEnterFrame = function() {
buttonShadow.blurX += (20 - buttonShadow.blurX) / 5;
buttonShadow.blurY = buttonShadow.blurX;
targetMC.filters = [buttonShadow];
if (buttonShadow.blurX == 20) {
delete targetMC.onEnterFrame;
}
};
};
var buttonOut = function (targetMC) {
targetMC.onEnterFrame = function() {
buttonShadow.blurX += (5 - buttonShadow.blurX) / 5;
buttonShadow.blurY = buttonShadow.blurX;
targetMC.filters = [buttonShadow];
if (buttonShadow.blurX == 5) {
delete targetMC.onEnterFrame;
}
};
};
b1.onRollOver = b2.onRollOver = function() {
buttonOver(this);
}
b1.onRollOut = b2.onRollOut = function() {
buttonOut(this);
}
Turn Off An Animated Filter Transition
Hi,
I have found that this bit of code perfectly fades a glow filter on and off continuously.
ActionScript Code:
import flash.filters.GlowFilter;
import mx.transitions.Tween;
import mx.transitions.easing.Regular;
this._parent.imagesMC.networkDiagram.Network.glow = 0;
var tween_glow:Tween = new Tween(this._parent.imagesMC.networkDiagram.Network, "glow", Regular.easeInOut, 1, 7.5, 1, true);
tween_glow.onMotionChanged = function() {
var gf:GlowFilter = new GlowFilter(0x5CA4DE, .75, this.obj.glow, this.obj.glow, 4, 3, false, false);
var filter:Array = new Array(gf);
this.obj.filters = filter;
};
tween_glow.onMotionFinished = function() {
this.yoyo();
};
however, on the next frame I need to stop the pulsing effect and turn the glow off. I've tried 'delete' as below which stops the function operating but leaves the glow filter in whatever state it was in when the function was deleted, whereas I'd like to fade the glow to off.
ActionScript Code:
delete tween_glow.onMotionChanged;
How could it be done?
One Animated Filter, Multiple Buttons...
I have a filter I've applied to multiple buttons, and it animates (using onEnterFrame) with onRollOver and onRollOut functions applied to each button. The problem is, sometimes when I roll over one button, it also animates the filter on another button (because they are using the same filter).
I know the obvious solution is to have a different filter applied to each button, but I'm concerned that this would slow things down. Also, I can't help but think there is another way to solve this, particularly because this issue only occurs some of the time, not all of it.
Here is the AS code. I've included a small sample file to illustrate the problem I'm having.
ActionScript Code:
import flash.filters.*;var buttonShadow:DropShadowFilter = new DropShadowFilter(0, 0, 0x000000, 20, 5, 5, 5, 3, false, false, false);b1.filters = b2.filters = [buttonShadow];var buttonOver = function (targetMC) { targetMC.onEnterFrame = function() { buttonShadow.blurX += (20 - buttonShadow.blurX) / 5; buttonShadow.blurY = buttonShadow.blurX; targetMC.filters = [buttonShadow]; if (buttonShadow.blurX == 20) { delete targetMC.onEnterFrame; } };};var buttonOut = function (targetMC) { targetMC.onEnterFrame = function() { buttonShadow.blurX += (5 - buttonShadow.blurX) / 5; buttonShadow.blurY = buttonShadow.blurX; targetMC.filters = [buttonShadow]; if (buttonShadow.blurX == 5) { delete targetMC.onEnterFrame; } };};b1.onRollOver = b2.onRollOver = function() { buttonOver(this);}b1.onRollOut = b2.onRollOut = function() { buttonOut(this);}
Thanks!
Animated Filter Values Vs Cpu Speed
i've tried to fake deep of field effect.
http://fufufu.juz.pl/!/park/
there are only 3 png bitmaps used.
bitmap casching dont work when the effects values are animated...
is it possible to use animated effect values without killin cpu??
Apply Glow Filter On Target MC While Dragging An Object And Rolling Over The Target
I can get my filter to apply to a movie clip if i simply rollover or roll out of it. When the mouse rolls out, the filter is set to undefined. The problem I am having is that I want the object that is in effect the hit area to glow (have a filter applied) when the draggable object is being dragged over it.
This would make is easier for the user to visually identify that where they are currently hovering over, whilst dragging, is the area that they should drop the object.
Part of my code looks like this
Code:
this.onRollOver = function () {
if(_global.isDragging == 1){
this.filters = glowFilterArray;
}
}
this.onRollOut = function () {
_global.isDragging = 0;
this.filters = undefined;
}
_global.isDragging is set to 1 at the onPress stage, when startDrag occurs.
_global.isDraggin is set to 0 onRelease of the draggable object.
Are there any ideas for a solution?
Glow Filter Grow+shrink On Animated Movieclip - Need Advice
I followed THECANADIAN's 'Applying and Animating Filter Effects' tutorial and ran into a little problem.
My interface is presented DIABLO style where there're a few characters to choose from and each character/movieclip is a looped animation. The script for applying the glow filter to grow/shrink on rollover/rollout appear to work fine but I noticed as long as the mouse is over the movieclip, the glow 'grow effect' repeats itself as soon as the character animation loops.
The actionscript sample can be found at:
http://www.kirupa.com/developer/flas...er_effects.htm
As in the blurX and blurY values grows from 3 to 20 repeatedly as long as the mouse stays over the animated movieclip.
Is the looping animation the cause of the problem (conflicting with the this.onEnterFrame function)? If it is, how do I work around it?
Any advice would be greatly appreciated.
Rgds,
Dan
How Can Apply A Dynamic Image?
hello..
I want to apply a self updating image into a flash web site.
Im not sure what to call this, so i will explain it.
I want to have a picture inside a flash website that will auto update. ie i basicaly want to set a move clip to "onClipEvent (load); { getURL ("http://www.mysite.com/images/img001.jpg", "?")}
and make that image appear like a image i imported into flash manuelly. and I can update the image just but changing the source file. Instead of having to open the flash movie file and manuelly changing the picture.
also if its possible I would like to dynamically resize the image that displays so that it always fits in the pictures location and auto resizes to fit.
I know how to do this in html. But im not sure how to apply this into a flash movie. Is it possible to use the html script inside the getURL tag? if so how would i need to code it in?
thanks in advance for any help you guys are able to provide.
Apply Mask To Last Image
I have created a banner with several images, each one with a mask and motion tween that reveals the image below each other. My issue is, how do I apply the mask/motion tween to the last image so that all of the images have the "wipe" effect? Right now, the last image is revealed, and it jumps to the first image without the "wipe" effect.
TIA
Can I Apply This Warping Effect To One Image?
I found this http://www.flashkit.com/movies/Effec...9206/index.php in the movies section. I am wondering if there is a way that I can use one image (the banner at the top of my site) and have it react to the mouse like that then just go back to normal when the mouse leaves. In that movie a bunch of little images are used.
[voronoi Image Filter]
Hi,
a few days ago I posted my first image processor experiment, based on delaunay triangulations. now, my second release is done, and this time I´ve played around with voronoi diagrams.
Launch.
The whole thing runs on my computer mostly by having up to ~24fps constantly.
Cheers
pwd
Apply Blend Mode To Image Loaded From URL?
Right now I have a section of my code that looks like this.
Code:
this.createEmptyMovieClip("two",this.getNextHighestDepth());
two.loadMovie(someURL);
var blend:Array = ["multiply", "screen", "overlay", "hardlight"];
var randblend:Number = Math.round(Math.random()*blend.length);
two.blendMode = blend[randblend];
trace(two.blendMode);
The trace works fine and shows a random blend mode, but the blend mode isn't actually applied visibly. I apply the blend mode in the same way to an image loaded from the library, and it works perfectly. I don't know why this isn't working... Is there any way to have the blend mode actually apply?
I figured out a way around this problem. I just added a movie clip inside of "two" and loaded the image into that, still applying the blend mode to two.
Help Loading Image With Some Filter Effects
Hi
I'm quite new to as3 coding, and right now I stumbled uppon some code that I can't make work the way I wish. Its simple ripple effect wich works with plain background color, but I'm trying to put some image behind that.. I'm right now out of ideas so any help is appritiated.
The efect itself is conteined in 2 as classes.
Ripples.as (main document class)
ActionScript Code:
package
{
import flash.display.Sprite;
import flash.events.*;
import RippleCanvas;
public class Ripples extends Sprite {
private var subobj:RippleCanvas;
public function Ripples() {
trace("Ripples started..");
var subobj = new RippleCanvas();
this.addChild(subobj);
}
}
}
RippleCanvas.as (subclass of Ripple)
ActionScript Code:
package
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.events.*;
import flash.geom.*;
import flash.filters.*;
public class RippleCanvas extends Sprite
{
internal var sourceBmp:BitmapData;
internal var paintBmpData:BitmapData;
internal var paintBmpData2:BitmapData;
private var buffer:BitmapData;
private var paintBmp:Bitmap;
private var output:Bitmap;
private var brush:Sprite;
private var logo:Sprite;
private var filter:BitmapFilter;
private var filter2:BitmapFilter;
//public var Mis:Boolean;
private var dispFilt:BitmapFilter;
private var outputBmpData:BitmapData;
private var surface:BitmapData;
internal var pt = new Point(0,0);
internal var matrix1 = new Matrix();
public function RippleCanvas()
{
paintBmpData = new BitmapData(128, 98, false, 0x40);
paintBmpData2 = new BitmapData(128, 98, false, 0x40);
logo = new Sprite();
brush = new Sprite();
brush.graphics.beginFill(0xFFFFFF,1);
brush.graphics.drawCircle(0,0,4);
trace ("RIppleCanvas started..");
surface = new BitmapData(128, 98, true, 0x000000);
surface.draw(logo);
//var ty:picture = new picture();
//var sourceBmp:Bitmap = new Bitmap(picture);
//addChild(sourceBmp);
sourceBmp = new BitmapData(128, 98, false, 0x40);
buffer = paintBmpData.clone();
outputBmpData = new BitmapData(128, 98, false, 0x40);
scaleX = 8.0;
scaleY = 8.0;
//this.addEventListener(MouseEvent.MOUSE_MOVE, this.moveHandler, false, 0, true);
this.addEventListener(MouseEvent.MOUSE_DOWN, this.downEvent, false, 0, true);
this.addEventListener(MouseEvent.MOUSE_UP, this.upEvent, false, 0, true);
this.addEventListener(Event.ENTER_FRAME, this.update, false, 0, true);
paintBmp = new Bitmap(paintBmpData);
var cmat:Array = [ 1, 1, 1,
1, 1, 1,
1, 1, 1 ] ;
filter = new ConvolutionFilter(3, 3, cmat, 9, 0);
filter2 = new BlurFilter(4,4);
output = new Bitmap(outputBmpData);
// output.blendMode = BlendMode.ADD;
//paintBmp.blendMode = BlendMode.ADD;
addChild(output);
addChild(paintBmp);
// var tf = new TextField();
// tf.text = "testing123";
// addChild(tf);
disp = new DisplacementMapFilter(paintBmpData2, new Point(), 4, 4, 48, 48, DisplacementMapFilterMode.IGNORE );
this.filters = new Array(new BlurFilter(16, 16));
}
function update(e:Event)
{
if(parent!=null) {
//&& Mis==true){
var localPt:Point = parent.globalToLocal(new Point(parent.mouseX*0.125, parent.mouseY*0.125));
var m:Matrix = new Matrix();
m.translate(localPt.x, localPt.y);
sourceBmp.draw(brush, m, null, 'invert');
}
//trace (localPt,Mis);
paintBmpData.applyFilter(sourceBmp, paintBmpData.rect, pt, filter);
paintBmpData.draw(paintBmpData, matrix1, null, 'add');
paintBmpData.draw(buffer, matrix1, null, 'difference');
paintBmpData.draw(paintBmpData, matrix1, new ColorTransform(0, 0, 0.98609374, 1, 0, 0, 2, 0));
paintBmpData2.draw(paintBmpData, matrix1);
outputBmpData.applyFilter(surface, outputBmpData.rect, pt, disp);
buffer = sourceBmp;
sourceBmp = paintBmpData.clone();
}
public function downEvent(e:Event)
{
if(e.stageX == 0 && e.stageY == 0)
return;
//trace("ok",Mis);
var curPt:Point = parent.globalToLocal(new Point(e.stageX, e.stageY));
//var Mis=true;
e.stopPropagation();
}
public function upEvent(e:Event)
{
//var Mis=false;
e.stopPropagation();
}
}
}
Read A Web Image And Filter Out Certain Dimensions.
Here is the pseudo-code to give you an idea what I want:
for (i == 0; i <= 100; i++) {
tempImg = get url ("http://mysite.com/" + i + ".jpg");
while (tempImg != fully loaded) {
??? //sit around and wait?
}
if (tempImg.width != 400 && tempImg.height != 320) {
trace("i" + ".jpg meet the requirements.");
}
}
Basically, I want it to go through my site from 001.jpg to 100.jpg, and return all the pictures that are not 400 x 320, but I don't know exactly how to code it.
The application doesn't need to display the images on-screen or anything fancy. Simple tracing will do for now.
Also, if it is easier, it can be done by file size.
Thanks,
Derek
(Actionscript 2.0)
[ Voronoi Based Image Filter ]
Hi,
a few days ago I posted my first image processor experiment, based on delaunay triangulations. now, my second release is done, and this time I´ve played around with voronoi diagrams.
Launch.
The whole thing runs on my computer mostly by having up to ~24fps constantly.
Cheers
pwd
[ Voronoi Based Image Filter ]
Last edited by drek : 2008-08-28 at 04:27.
Hi,
a few days ago I posted my first image processor experiment, based on delaunay triangulations. now, my second release is done, and this time I´ve played around with voronoi diagrams.
Launch.
The whole thing runs on my computer mostly by having up to ~24fps constantly.
cheers
drek
Applying Filter To Dynamically Loaded Image
I have a tool that dynamically loads a jpg image and then applies a filter to it.
If the image is on the same domain all works perfect.
If the image is on a different domain, The image loads fine, but applying the effect does not work.
I've traced everything down to this statement.
img.filters = [myFilter];
if img is a jpg loaded crossdomain applying the filter doesn't work.
I have allowdomain and loadpolicyfile statements in the app and they are working correctly.
I expect this is one of those bright flash security measures like trying to use bitmapdraw crossdomain, but hope there is a work around. I've invested too much time in this tool for some silly security problem.
Thanks,
SZ
New To Flash. How To Apply Logo Image Fade With Nested Timelines?
Hi all Flashers,
I am having a tough time trying to work out how to apply an image fade-in to a graphic which has previous tweens and masks applied to it. I have worked out how the masks layers work but cannot get a timeline fade effect to apply to the image after the mask has revealed the graphic. How should I have the image (in jpg format) set in properties. Graphic or movie clip?
I get the impression from what i have read that transitions are better applied with actionscript, is this correct or not? If so, can some kind soul walk me through the steps to applying this filter with ascript within a timeline with other tweens applied? Do many developers use the effects in timeline effects->transform/transition to apply effects?
TIA
Size Of Image Is Jumping While Image Is Animated
Look at
http://miratorg.dev.itlegion.ru/image/express.swf
move you mouse over the text and you will see a moving locomotive picture.
Now the problem is that if you watch closely you will see that the locomotive changes it horizontal size by 1 pixel.
There is no scaling in the flash, scale mode is set to noScale, it is a simple tweening animationg with only
horizontal movement. I tried png and gif formats - all the same.
Is there a way to fix this problem?
Colormatrix Filter And Blur Filter Tween
Last edited by sks447 : 2006-10-17 at 15:11.
I want to have a picture fade from blurry and grayscale to sharp and colorized. I have the blur to sharp part working ok. I have the grayscale to color to working ok. The only thing is the filters dont work together. Ive tried to push one into another with no luck yet. You can see the comments in the code below. Thanks.
ActionScript Code:
function blurFunction(myVar) {
// init what movieclip to blur
if (myVar == undefined) {
myVar = promoContainer.p1;
}
// BLUR FILTER
import flash.filters.BlurFilter;
import flash.filters.BitmapFilter;
import flash.filters.ColorMatrixFilter;
var blurFilter:BlurFilter = new BlurFilter(0, 0, 3);
desaturation = 1;
var filterArray:Array = new Array();
filterArray.push(blurFilter);
var blurX:Number = 100;
var blurY:Number = 100;
onEnterFrame = function () {
prevPromo._visible = false;
nextPromo._visible = true;
if (desaturation>=1) {
des = -0.03;
} else if (desaturation<=0) {
des = 0;
delete (onEnterFrame);
}
desaturation += des;
// color matrix
//myVar.filters = new Array(getDesaturationFilter(desaturation)); <---- I can have this....
blurX -= 10;
blurY -= 10;
blurFilter.blurX = blurX;
blurFilter.blurY = blurY;
// blur filter
//myVar.filters = filterArray; <---- Or I can have this but not both.......
if (blurY<=0) {
blurY=0;
blurX=0;
//delete (onEnterFrame);
}
};
}
function getDesaturationFilter(t:Number):BitmapFilter {
t = t != undefined ? t : 1;
var r = 0.212671;
var g = 0.715160;
var b = 0.072169;
trace("colormatrixfilter called");
return new ColorMatrixFilter([t*r+1-t, t*g, t*b, 0, 0, t*r, t*g+1-t, t*b, 0, 0, t*r, t*g, t*b+1-t, 0, 0, 0, 0, 0, 1, 0]);
}
Animated Masking A Dynamic Image Is Causing Dynamic Image To Disappear Intermedently.
You can find the file here of what I am trying to do:
http://www.yourfilelink.com/get.php?fid=462218
Please tell me if you are having problems downloading it.
This has always irritated me and I can't seem to find a way around it.
I dynamically load an image to a movie instance and the movie instance is masked. The masking is animation on it, so that it looks like the image is animated via masking. It works if the masking animation is one long shape motion tween, but if I make the masking animation frame by frame, the image being masked disappears and reappears only when it is a long shape tween of the mask.
Please refer to the downloadable sample to understand what I mean. Is there a way around this?
I have seen page flip samples that is able to do what I am trying to do, but they used really advanced actionscripting to do this. I am using timeline.
Somebody Can Tell Me What I Can Do With An Animated Image Database
Hi there ,
Is there anybody who can tell me how i can program the pictureanimation that you can find on http://www.huddles.com/officegallery...esentation.htm (then click the text link on the white contentpage)
the idea is to have a database (or maybe just an external map where the images are stored) where i can replace and rename images for this animation.
The animation from the pictures is NOT programmed, just a tweening between the pictures.
The way that i update it now is to open the libraryfrom the fla and replace the images (update link) but this isn't the right way because when i got a different number of pictures i got a problem.
Is there anybody who can help me with this issue
Image Animated Change
Might be too ambitious for the likes of me, but worth asking...
I have a jpeg picture of a car (good digital quality mono pic), I would like to animate it in flash changing from this picture to the same picture, but one that's had just the edges highlighted (like a pencil outline of the same pic).
I've currently changed the original pic in fireworks and tried re-inserting it back into flash.
I've converted the image to a symbol to be able to animate - perhaps this is the problem?
I've seen this done on other sites, but am worried the only way to do it is long and tedious.
Any ideas?
Thanks for any help.
Animated Image Move
I know how to make a single image move with the motion tween, but how do I make a full animation move across the stage, while animating?
Animated Image Sequence
i am aware many of the best animations use a sequence of images? which are custom made and exported as a group to them be used within flash - for adding text and sounds etc.
I am wondeing how do i create these (what sort of program) and then export as image1, image2, image3 etc.
Animated Image Fading
Yo Yo Again,
Don't mean to be a bothering pest or w/e but does anyone know how to make animated buttons that fade images in when you put your mouse over them. So when someone hovers over a button, the image fades in and when their mouse moves off the button, the image fades out.
Thanks dudes
Animated Image Loop With AS3
Hello. I'm new to AS3 and need some help creating an animated loop with dynamic images loaded from an xml document. I have it all working except I was wondering if there was a way for the images to transition in a way they look like an animated weather radar loop instead of it blanking out in between images. I'd like for it to look something like this: http://www.internet-graffiti.com/hurricane-rita.html, and less like an image gallery. Is there a way to do that? Here is my code:
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.text.*;
var picNumber = -1;
var imageLoader = new Loader();
var myXML:XML;
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("images2.xml"));
myLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void {
myXML = new XML(e.target.data);
for (var i:int = 0; i<myXML.*.length(); i++){
trace("My image number is " + (i+1) + " and it's URL is " + myXML.image[i]);
};
}
function loadImage(url:String):void {
// Set properties on my Loader object
//imageLoader = new Loader();
imageLoader.load(new URLRequest(url));
imageLoader.contentLoaderInfo.addEventListener(Pro gressEvent.PROGRESS, imageLoading);
imageLoader.contentLoaderInfo.addEventListener(Eve nt.COMPLETE, imageLoaded);
}
function imageLoaded(e:Event):void {
// Load Image
imageLoader.width = 650;
imageLoader.height = 425;
imageArea.addChild(imageLoader);
}
var myTimer:Timer = new Timer(200); // 1 second
myTimer.addEventListener(TimerEvent.TIMER, setURL);
myTimer.start();
function setURL(event:TimerEvent):void {
if (picNumber>=myXML.*.length()-1) {
picNumber = 0;
} else {
picNumber++;
}
trace("image: "+myXML.image[picNumber]);
loadImage(myXML.image[picNumber]);
}
Thanks for any help!
Animated Loading Image
Hi I want to create an animated image of a progressbar/loading image.
I want the image as a jpeg or gif.
Can this be done in FireWorks or Flash or other Adobe product?
I never used these before so is there any tutorial that will guide me?
Animated Scroller With Image Stripe.....
.... similar to http://www.pixelwurld.com/.
Is there an example of this on FlashKit? I searched the archives, but I couldn't find anything. My head is achey and I can't do the math to come up with this, and it's driving me cuckoo!
Thanks.
[CS3] How To: Animated Horizontal Image Marquee?
How do I make a horizontal scrolling marquee with about 25 images? I've been looking for tutorials but I cannot find any for this. I just want to make a basic animation the size of a banner that will play automatically on a website. Does anyone know how to makes on of these?
Animated Image/Information Viewer
Hey guys im working on a flash viewer with arrows on the bottom that allow you to scroll through a number of different images/information. I want it to fly in and fly out of the screen. The only way I could think of doing it (im somewhat of a flash noob) is to just make all the animations of the "fly ins" and then copy all the frames and reverse them. Then when u click back it plays the reverse animation. This makes it VERY TEDIOUS and a MAJOR PAIN if constant changes will need to be made..Anyone have any ideas how this can be done more effectively?
Here is a link of the FLA file if anyones interested how i did it.
http://www.megaupload.com/?d=3NJY0ZS3
Thanks in advance for your help guys! Later!
Jon
Exporting To Animated .gif Distorting Image
Hey All -
I've created a few banners for a friend, and when I export them to animated .gif format, the border essentially disappears and the imagery that I've developed in Flash becomes slightly distorted.
Is there perhaps a setting in the export dialogue that I'm failing to set that might be causing this behavior?
I'm using Flash MX.
Thanks in advance -
Tim
Flash Animated Image Outline
Hello all. I am looking to create a short animation of an image being outlined in flash, once outlined then have the image fade in. Does anyone know how to do this? I have done about an hour of searching and have not come up with anything. Any tutorials?
Insert Animated Image Background For A Navbar
Can you tell me how I can add a background flash mx file only for my buttons (navbar)?
Please specify the method with flash mx or dreamwaver mx.
Here is the animated flash mx background I want to add to my background buttons.
http://scctechnologies.com/test/matrix.swf
Best regards,
Dimnet
Subtle Animated Image Highlight Effects - How?
I'm looking for tutorial(s) or tips on creating animated highlighting effects over an image, similar to the header at: http://www.voxunity.com/contrasthost/
Any help would be apprieciated.
nellus...
Animated Gradient From Bitmap. (image Manipulation)
A few years ago i found a flash source with gradient animation made from image,
but as i have said it was a few years ago and i can't find this fla over the internet agian
doeas anyone know any examples of gradient animation that is made frombitmap?
TIA
wax
There Has To Be A Simpler Way To Do This Animated Image/Information Viewer
Hey guys im working on a flash viewer with arrows on the bottom that allow you to scroll through a number of different images/information. I want it to fly in and fly out of the screen. The only way I could think of doing it (im somewhat of a flash noob) is to just make all the animations of the "fly ins" and then copy all the frames and reverse them. Then when u click back it plays the reverse animation. This makes it VERY TEDIOUS and a MAJOR PAIN if constant changes will need to be made..Anyone have any ideas how this can be done more effectively?
Here is a link of the FLA file if anyones interested how i did it.
http://www.megaupload.com/?d=3NJY0ZS3
Thanks in advance for your help guys! Later!
Jon
Animated GIF In Flash - Losing Image Quality
I am trying to create an ainimated GIF in flash, it contains photos fading in and out - i am losing all the image quality in the photos when doing it though. Anyoone got a solution - image quality is set to max.
|