?
Solved

Using the blur filter with the tween class

Posted on 2008-06-11
7
Medium Priority
?
1,071 Views
Last Modified: 2012-05-05
Hi all,

I want to blur an object from say 25 to 0 using the blur filter and the tween class. So far I have:

var blur:Tween= new Tween(my_mc,"blurX",Strong.easeOut,45,0,2,true);
my_mc.filters = [new BlurFilter];

The object stays blurred at 45. I want it to go from 45 to no blur ie 0
Can you help, thanks.
0
Comment
Question by:systems_mitsui
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 18

Expert Comment

by:Antonio Estrada
ID: 21764216
Here you go:

-V
import mx.transitions.Tween;
import flash.filters.BlurFilter;
 
var myTween:Tween = new Tween(my_mc,"blur",Strong.easeOut,45,0,2,true);
myTween.onMotionChanged = function() {
	var blurFilter:BlurFilter;
	var filterArray:Array = new Array();
	blurFilter = new BlurFilter(my_mc.blur,my_mc.blur,2);
	filterArray.push(blurFilter);
	my_mc.filters = filterArray;
}

Open in new window

0
 

Author Comment

by:systems_mitsui
ID: 21764428
Hi,

I used your script but object is still staying blured, not going to 0
0
 
LVL 18

Expert Comment

by:Antonio Estrada
ID: 21764519
Interesting...

Here's a *.fla sample for you to check out.

http://evilrealm.polygonized.com/BlurTween.fla

-V
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:systems_mitsui
ID: 21776719
Hi bud, you code worked.

However when I amended it to do a tween of X first, then use onMotionFinished to call a blur function afterwards it just doesn't move, then does a long blur.


How can I do X and Y tween, then invoke the onMotionfinished to do a blur, or more importantly do a blur as it moves across an  X or Y line [to simulate fast motion]
Here is the code I now have

import mx.transitions.Tween;
import flash.filters.BlurFilter;
 
 
var myTween:Tween =new Tween(my_mc,"_x",158.0,180.0,Bounce.easeOut,1,true);

 
 myTween.onMotionFinished=function() {

      var myTween:Tween = new Tween(my_mc,"blur",Strong.easeOut,45,0,2,true);

        var blurFilter:BlurFilter;
        var filterArray:Array = new Array();
        blurFilter = new BlurFilter(my_mc.blur,my_mc.blur,2);
        filterArray.push(blurFilter);
        my_mc.filters = filterArray;
}


0
 
LVL 18

Expert Comment

by:Antonio Estrada
ID: 21779504
Ah, you want to have 3 Tweens at the same time.

An _x Tween, a _y Tween and a blur Tween.

Here are three examples:

<code>

-V
/* Example 1: _x and blur Tweens (simulating fast motion) */
 
import mx.transitions.Tween;
import flash.filters.BlurFilter;
 
var xTween:Tween = new Tween(my_mc,"_x",Strong.easeOut,0,280,2,true);
var blurTween:Tween = new Tween(my_mc,"blur",Strong.easeOut,45,0,2,true);
blurTween.onMotionChanged = function() {
        var blurFilter:BlurFilter;
        var filterArray:Array = new Array();
        blurFilter = new BlurFilter(my_mc.blur,0,2);
        filterArray.push(blurFilter);
        my_mc.filters = filterArray;
}
 
/* Example 2: _y and blur Tweens (simulating fast motion) */
 
import mx.transitions.Tween;
import flash.filters.BlurFilter;
 
var yTween:Tween = new Tween(my_mc,"_y",Strong.easeOut,0,280,2,true);
var blurTween:Tween = new Tween(my_mc,"blur",Strong.easeOut,45,0,2,true);
blurTween.onMotionChanged = function() {
        var blurFilter:BlurFilter;
        var filterArray:Array = new Array();
        blurFilter = new BlurFilter(0,my_mc.blur,2);
        filterArray.push(blurFilter);
        my_mc.filters = filterArray;
}
 
/* Example 3: _x, _y and blur Tweens */
 
import mx.transitions.Tween;
import flash.filters.BlurFilter;
 
var xTween:Tween = new Tween(my_mc,"_x",Strong.easeOut,0,280,2,true);
var yTween:Tween = new Tween(my_mc,"_y",Strong.easeOut,0,280,2,true);
var blurTween:Tween = new Tween(my_mc,"blur",Strong.easeOut,45,0,2,true);
blurTween.onMotionChanged = function() {
        var blurFilter:BlurFilter;
        var filterArray:Array = new Array();
        blurFilter = new BlurFilter(my_mc.blur,my_mc.blur,2);
        filterArray.push(blurFilter);
        my_mc.filters = filterArray;
}

Open in new window

0
 
LVL 18

Accepted Solution

by:
Antonio Estrada earned 2000 total points
ID: 21856872
So, did you try this out?

-V
0
 

Author Closing Comment

by:systems_mitsui
ID: 31476611
Sorry, been away on biz and hols. Yes it worked fine thank you
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses
Course of the Month8 days, 22 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question