"Applying And Animating Filter Effects" - Syntax Error Help
Hi there,
I was just trying out Jesse Marangoni's tutorial on animating the glow filter. I entered the code exactly as it appears in the tutorial, but I get a syntax error for the first line( import flash.filters.GlowFilterwhenever I try to preview the movie. Any ideas? Do I have to configure anything regarding these classes before I call / import them?
Cheers in advance,
biscuit.
KirupaForum > Flash > Flash 8 (and earlier)
Posted on: 08-03-2006, 09:46 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Help With "Applying And Animating Filter Effects"
ATTENTION! This problem was solved simply by applying myself to the goal, testing, and going with my gut. I apologize for posting this but hopefully it might help some people.
To fix my problem I simple put the duplicate actions on a different layer and then changed the variables and instance information. Thanks a lot.
I'm trying to use the "Applying and Animating Filter Effects" tutorial and it was extremely simple and easy. I applied it to my movie clip, but I'd like to apply it to more then one. For some reason, when I duplicate the movie clip, give it a new Instance Name, duplicate the filter effect animation actionscript and change the instance name in there to the new one and change the variables, instead of doing the same thing as the first movie clip it continues glowing larger and larger forever untill it dissapears. When I take my mouse off the new movie clip the glow increase stop, but doesn't go back down, and when I point at it again after that it just continues glowing larger again.
?
Please help me, thank you so much.
Flash 8 And Animating Filter Effects
I read throught this tutorial:
http://www.kirupa.com/developer/flas...er_effects.htm
And it soes pretty much what I am looking for, however. If you change the color of the glow effect suddenly, it doesn't work right anymore. I changed it from the blue it is set to by default, and changed it to a yellow (FFFFCC). But when i doo that the glow overtakes the text. Does anyone have any idea why this would happen? Or does anyone else know how to animate a filter effect.
I am looking to make a button that will glow (animated, not just a one frame rollover state) when rolled over.
Let me know if anyone has any insight on this.
[Flash8]Help Needed / Applying And Animating Effects
I am using the Tutorial "Applying and Animating Filter Effects" by Jesse Marangoni, and I keep getting this error message: **Error** Scene=Scene 1, layer=suede, frame=1:Line 2: The class or interface 'flash.filters.GlowFilter' could not be loaded.
Any Ideas why this keeps coming up?
Thanks
Jeff
Animating Filter Effects, How Would I Slow The Speed?
Hello, I'm learning about animating filter effects from the tutorial here:
http://www.kirupa.com/developer/flas...er_effects.htm
My question is, how would I change the speed of the effect and slow it down.
The problem is I'm only changing the strength of glowfilter from 0 to 2 on a mouseover, and since the code adds one 1 to it every frame, its a little choppy.
Here's my code:
Code:
import flash.filters.GlowFilter;
var gf:GlowFilter = new GlowFilter(0xFFFFFF, 100, 3, 3, 0, 3, false, false);
bar_mc.stackedWord.filters = [gf];
bar_mc.stackedWord.onRollOver = function() {
this.onEnterFrame = function() {
if (gf.strength < 2) {
gf.strength++;
} else {
delete this.onEnterFrame;
}
this.filters = [gf];
};
};
bar_mc.stackedWord.onRollOut = function() {
this.onEnterFrame = function() {
this.filters = [gf];
if (gf.strength > 0) {
gf.strength--;
} else {
delete this.onEnterFrame;
}
};
};
Any help would be appreciated!
Thanks
Applying Filter Within Actionscript
I've got some code which is generating a menu from an admin panel.
Therefore the text is not an object on the stage, but code in the actionscript.
I am looking for a way to apply an effect for rollover states to all generated text.
it could be something as simple as the text vibrating.
or the text blurring.
any suggestions would be appreciated
gallery_mc["menu_item"+MILayer].onRollOver = function() {
//this is where the filter or effect should happen, but I'm not sure how to
//make a filter happen without attaching it to an object or symbol
};
Applying A 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 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);
Applying A Filter To Masked Dynamic Text - How?
Hi chaps,
has anyone come across this problem before? I am trying to apply a glow filter to some dynamic text, which is under a mask. In the Flash editor, I see the glow just fine, but in the player the glow isn't working. In fact, I can't seem to apply any filter to the dynamic text that will show up.
I've tried converting the dynamic text to a movie clip, applying the glow to the movie clip and then masking the movie clip - still no joy. It seems that applying a mask removes the filtering effect.
Can anyone offer a work around - or at least confirm that this is actually happening and I'm not doing something stupid?
cheers,
Ric.
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
Applying A Glow Filter Stuffs Up The Alpha
Hey
I attach clips to the stage and apply a glow filter to them. I also set the _alpha to 0.
Then I use a loop to fade them up to 60% alpha.
_alpha += 10;
But when I trace the alpha, it has a load of numbers behind the decimal. eg. 40.688897398...
Any ideas how I can make the fading rounded? Thanks.
Tree Component - Applying Shadow Filter
Does anyone know how to apply the shadow filter to the tree component?
I tried (with tree the instance name of the component):
ActionScript Code:
import flash.filters.DropShadowFilter;this.tree.setFilters(3);var isDropShadow:Boolean = true;function setFilters(dis):Void { // Define a new array for the filters. var filtersArr:Array = new Array(); // If isDropShadow is true, make a new // DropShadowFilter object, and add it to the array. if(isDropShadow) { //(distance:Number, angle:Number, color:Number, alpha:Number, blurX:Number, blurY:Number, strength:Number, quality:Number, inner:Boolean, knockout:Boolean, hideObject:Boolean) var dropShadow:DropShadowFilter = new DropShadowFilter(dis, 81, 0x000000, .3, 5, 5, 4, 15, false, false, false); filtersArr.push(dropShadow); } // Assign the filters array to the filters property // of imageClip in order that the filters will // get applied. tree.filters = filtersArr;}
Applying Glow Filter To Dynamic Text On Rollover
Can you apply a filter (glow for example) to dynamic text in a text field that has been generated with asfunction in anchor tags?
ActionScript Code:
function loadlist (record) {
this.listbox_mc.theList.htmlText += "<a href="asfunction:_parent.updatemsgbox,"+record+"">" + ta[record] + "</a>" + "
";
this.listbox_mc.theList.htmlText += "<a href="asfunction:_parent.updatemsgbox,"+record+"">" + da[record] + "</a>" + "
";
}
When "theList" is populated from the loadlist function, it contains hyperlinks to blog entries. I want to apply a glow filter to the hyperlinks on rollover. Can it be done, and if so, how? I've have made many attempts at coding that needle in a haystack, but no luck yet.
Finding New Width And Height After Applying Blur Filter.
How???
Code:
trace(drawer.width);
drawer.filters[cloudBlurFilter];
trace(drawer.width);
var temp:BitmapData=new BitmapData(drawer.width, drawer.height, true,0 );
temp.draw(drawer, idMatrix);
trace(temp.width);
temp.applyFilter(temp,new Rectangle(0,0, temp.width, temp.height), origin, cloudBlurFilter);
trace(temp.width);
Trace output still the same both before and after applying filter for either Sprite or BitmapData. The width and height still remains the same.
64
64
103.80000000000001
103.80000000000001
103
103
36.75
36.75
36
36
82.7
82.7
Help!
Applying Blur Filter With Actioscript On Carousel Menu
Hi all..
I made a carousel-type of menu with a tutorial I once found about 3d manipulation with actionscript.
I apply this code on the rotating mc's
Code:
onClipEvent(load){
y=100;
speed=0;
radius=150;
xcenter=0;
ycenter=0;
zcenter=100;
angle=144;
fl=180;
}
onClipEvent(enterFrame){
z=Math.sin(angle*Math.PI/180)*radius+zcenter;
scale=fl/(fl+z);
x=Math.cos(angle*Math.PI/180)*radius;
_x=x*scale+xcenter;
_y=y*scale+ycenter;
_xscale= _yscale = scale*100;
angle+=speed;
_alpha=scale*100;
speed =(_root._xmouse-250)/150;
if(angle>359){
angle-=360;
}
}
Somewhere in the code you see this line
Code:
_alpha=scale*100;
This is used to give the MC an alpha color when it moves to the back and takes it away when it comes to the back. Giving the MC a sort of fade out in the mist effect.
Now I want to add a blur effect too. When the mc moves to the back give it a blur filter and take it away when it moves to the front.
I have no idea how to do this. I found this blur filter tutorial but I cant seem to connect the 2 set of codes together.
Code:
var myBlur = new flash.filters.BlurFilter(50,50,1);
var myTempFilters:Array = circle_mc.filters;
myTempFilters.push(myBlur);
circle_mc.filters = myTempFilters;
Can anyone help. Tnx
[F8] Animating The Glow Filter
Hi -- I'm trying to figure out the correct way to use filters as mouse over events for mc's, and I'm close but I'm kind of stuck. This code almost works, the problem is if you skip from one button to another quickly, the glow doesn't finish fading out on the first mc, it just stays where it was when you rolled over the second button. The hack would be to make a unique glowFilter variable for each mc, but that kind of defeats the purpose. Can anyone tell me what I'm doing wrong here? Here's the code --
Code:
import flash.filters.*;
//
var fullglow:Number = 3;
var speed:Number = 10;
//
var glowCo:Number = 0xccccff;
var glowAl:Number = 0.65;
var glowX:Number = 5;
var glowY:Number = 5;
var glowSt:Number = 0;
var glowQu:Number = 3;
var glowIn:Boolean = false;
var glowKn:Boolean = false;
//
var over:GlowFilter = new GlowFilter(glowCo, glowAl, glowX, glowY, glowSt, glowQu, glowIn, glowKn);
/*
=============================================
* glow functions
=============================================
*/
function overGlow(clip) {
this.onEnterFrame = function() {
over.strength += (fullglow-over.strength)/speed;
clip.filters = [over];
};
}
//
function outGlow(clip) {
this.onEnterFrame = function() {
over.strength += (0-over.strength)/speed;
clip.filters = [over];
};
}
/*
=============================================
* mouse events
=============================================
*/
btn1_btn.onRollOver = function() {
overGlow(mc1_mc);
};
btn1_btn.onRollOut = function() {
outGlow(mc1_mc);
};
btn2_btn.onRollOver = function() {
overGlow(mc2_mc);
};
btn2_btn.onRollOut = function() {
outGlow(mc2_mc);
};
btn3_btn.onRollOver = function() {
overGlow(mc3_mc);
};
btn3_btn.onRollOut = function() {
outGlow(mc3_mc);
};
btn4_btn.onRollOver = function() {
overGlow(mc4_mc);
};
btn4_btn.onRollOut = function() {
outGlow(mc4_mc);
};
Many thanks --
Animating The Glow Filter
Hi -- I'm trying to figure out the correct way to use filters as mouse over events for mc's, and I'm close but I'm kind of stuck. This code almost works, the problem is if you skip from one button to another quickly, the glow doesn't finish fading out on the first mc, it just stays where it was when you rolled over the second button. The hack would be to make a unique glowFilter variable for each mc, but that kind of defeats the purpose. Can anyone tell me what I'm doing wrong here? Here's the code --
Code:
import flash.filters.*;
//
var fullglow:Number = 3;
var speed:Number = 5;
//
var glowCo:Number = 0xccccff;
var glowAl:Number = 0.65;
var glowX:Number = 5;
var glowY:Number = 5;
var glowSt:Number = 0;
var glowQu:Number = 3;
var glowIn:Boolean = false;
var glowKn:Boolean = false;
//
var over:GlowFilter = new GlowFilter(glowCo, glowAl, glowX, glowY, glowSt, glowQu, glowIn, glowKn);
/*
=============================================
* glow functions
=============================================
*/
function overGlow(clip:MovieClip) {
this.onEnterFrame = function() {
over.strength += (fullglow-over.strength)/speed;
clip.filters = [over];
};
}
//
function outGlow(clip:MovieClip) {
this.onEnterFrame = function() {
over.strength += (0-over.strength)/(speed*2);
clip.filters = [over];
};
}
/*
=============================================
* mouse events
=============================================
*/
btn1_btn.onRollOver = function() {
overGlow(mc1_mc);
};
btn1_btn.onRollOut = function() {
outGlow(mc1_mc);
};
btn2_btn.onRollOver = function() {
overGlow(mc2_mc);
};
btn2_btn.onRollOut = function() {
outGlow(mc2_mc);
};
btn3_btn.onRollOver = function() {
overGlow(mc3_mc);
};
btn3_btn.onRollOut = function() {
outGlow(mc3_mc);
};
btn4_btn.onRollOver = function() {
overGlow(mc4_mc);
};
btn4_btn.onRollOut = function() {
outGlow(mc4_mc);
};
Many thanks --
Animating A DropShadow Filter
ok I've been trying to animate a drop shadow filter and so far have been unsucessful, I tried doing it with a for loop but for some reason that didn't work, I also tried an onEnterFrame but without success either
here's what I've done
for
ActionScript Code:
var ds: DropShadowFilter = new DropShadowFilter(2, 35, 0x000000, 0, 5, 5, .8, 3, false, false, false);preloader.filters = [ds];for (var i:Number =0; i <=60; i++) { ds.alpha++; trace(ds.alpha); preloader.filters = [ds];}
the trace just gives me 1 the entire time....
as for the onEnterFrame
ActionScript Code:
this.onEnterFrame = function() { ds.alpha += (60 - ds.alpha)/2; preloader.filters = [ds]; if (ds.alpha == 60) { delete this.onEnterFrame; } }
that doesn't work either... any ideas on how I can animate the BlurFilter, I just want it to go from an alpha of 0 to an alpha of 60...
Creating And Animating A Filter
Hey, everyone.
I'm trying to create an animated filter effect in flash 8 with actionscript.
Currently, I'm using the properties inspector to create the filter.
It's set to
BlurX: 24
BlurY:24
Strength 100
Quality Low
Colour #ffffff
I would like to do this in actionscript. I've got the following code
body.filters =[new flash.filters.GlowFilter(24, 24, 3)];
nothing really happens with this code.
Any suggestions?
Cheers,
-Atrus
Animating A Filter With A Tween
Hello,
I have a question on the Blur filter.
I have applied a blur to the begining of a MC, and I would like to fade the blur out once the animation is complete.
While I'm able to remove the initial blur, it is not a gradual, smooth transition. It merely "snaps" back with no blur applied. Can someone assist me on how to smooth the transition?
Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
import flash.filters.*;
function headerBarAnimation (){
var headerBarStartX:Number = headerBar_mc._x = 550;
headerBar_mc.filters = [new BlurFilter(30, 0, 1)];
var headerBarX:Tween = new Tween(headerBar_mc,"_x",Regular.easeOut,headerBarStartX,headerBarStartX-550,12,false);
var headerBarAlpha:Tween = new Tween(headerBar_mc,"_alpha",Regular.easeOut,0,100,8,false);
headerBarX.onMotionStopped = function(){
headerBar_mc.filters = [new BlurFilter(0, 0, 1)];
}
}
headerBarAnimation();
Animating Blur Filter With Actionscript
Hey guys,
I've been scouring the internet for the past hour or so in search of how to do this. It's very simple, but every example seem to want me to bring a loaded movie clip, or trace mouse position. I don't need that!
Basically I have a button that when clicked comes to the front (using behaviours), moves to a new position, scales and then I want every other button behind it to blur. Obviously I want them to blur gradually to keep the flow going.
Here's my current code so you can see where its going:
on (release) {
import mx.transitions.easing.*;
import mx.transitions.Tween;
import flash.filters.BlurFilter;
//Bring to Front Behavior
mx.behaviors.DepthControl.bringToFront(_root.testi monials_content.testimonial1);
//End Behavior
//gets rid of buttons
gotoAndPlay("no_buttons");
//brings to centre
var testimonialX:Tween = new Tween(testimonial1, "_x", mx.transitions.easing.Back.easeOut, -377, 0, 10, false);
testimonialX.onMotionFinished = function() {
//scaling
var testimonialH:Tween = new Tween(testimonial1, "_height", mx.transitions.easing.Bounce.easeOut, 134, 333, 10, false);
var testimonialW:Tween = new Tween(testimonial1, "_width", mx.transitions.easing.Bounce.easeOut, 146, 363, 10, false);
//blurs other testimonials
}
}
All the instances are already on the stage so I don't want to go calling anything else in.
So how do I simply say I want testimonial to blur over 5 frames or so?
Cheers!
**Error** TempInit : Line 1, Column 5 : [Compiler] Error #1084: Syntax Error: Expecti
Hi,
I'm trying to convert my AS2 project to AS3. I got rid of all errors but one :
**Error** tempInit : Line 1, Column 5 : [Compiler] Error #1084: Syntax error: expecting identifier before 45.
var 45:MovieClip;
I got no idea what tempInit is, and no where do I declare a variable called 45...
After searching the web for hours I am tired and thus asking for your help.
Thank you,
Applying Multiple Effects?
hi everyone, i just wanted to know if it's not possible to apply more than just one effect to an instance of a symbol? e.g. if i change the alpha of an instance, then also want to change the tint it takes away the initial alpha effect.
thx for your help!
Filter Effects
Any help would be very, very welcome,
I'm a bit new to this fangled flash thingy. My background is PhotoShop and photography, video and still.
I've notice in flash there are some that apply "shimmer" and "ripple" effects to photos..
How is this done, it looks like a photoshop plugin, but then exported to flash...
Can anyone shed some light on this?
Thanks......
Applying The Same Layers And Effects To Different Images
I have images of a cube that are different colors, but same dimensions. I import one by one onto my stage in Flash CS3 and then apply some alpha lighting and glow effects. There has got to be a more efficient way to do apply the same effects over and over instead of how I'm doing it now which seems very tedious?? I'm looking for a similar process like Photoshop where you can drag layers to different canvases...
thanks
Please Help: DuplicateMovieClip With Filter Effects
i'm been spending hours and hours trying to figure this issue out but i cannot seem to solve it for the life of me.
i have questions:
i've been able to duplicate my movie but only one of buttons has a mouse over effect. how do i get my other buttons to have their own unique mouse over?
now that i figured out a way to get my buttons to go down 5 rows, how do i get to also go across ten rows?
lastly, how can i dynamically create text fields inside each of those buttons and how would i access them individually once the buttons have been created?
PHP Code:
import flash.filters.DropShadowFilter;
var mc:MovieClip = createDropShadowRectangle ("DropShadowAlpha");
var container:MovieClip = setUpContainer ();
var ln:Number = 5;
var spacer:Number = 5;
var duplicate:MovieClip;
for (var i:Number = 1; i < ln; i++) {
var newY:Number = i * (container._height + spacer);
duplicate = container.duplicateMovieClip ("clip-" + i, i, {_y:newY});
trace (duplicate);// _level0.clip-[number]
}
function setUpContainer ():MovieClip {
var mc:MovieClip = this.createEmptyMovieClip ("container", this.getNextHighestDepth ());
var w:Number = 50;
var h:Number = 50;
mc.beginFill (0xf0f0f0);
mc.lineTo (w,0);
mc.lineTo (w,h);
mc.lineTo (0,h);
mc.lineTo (0,0);
mc.endFill ();
mc.onRelease = function () {
//...will use tween effect here
};
var filter:DropShadowFilter = new DropShadowFilter (2, 45, 0x000000, 0.8, 16, 16, 1, 3, false, false, false);
var filterArray:Array = new Array ();
filterArray.push (filter);
mc.filters = filterArray;
return mc;
}
any help on how to achieve these results will greatly be appreciated
Easing Filter Effects
Ok. Let me start by saying I'm getting better at Actionscript but I'm still far from where I need to be. Hopefully you guys can help.
I am trying to pull off an effect where a logo emerges from the background using "DropShadowFilter". The Background is white and the logo is white so I only want to animate the "DropShadowFilter". Doing this in the timeline makes it look a little choppy. So I thought I would try using actionscript.
Here's what I have so far to make the mc "emerge":
Code:
import flash.filters.*;
var ds:DropShadowFilter = new DropShadowFilter(0, 0, 0x000000, 0, 0, 0, 1, 3, false, false, false);
mc1.filters = [ds];
mc1.onEnterFrame = function() {
this.onEnterFrame = function() {
ds.blurX += (10-ds.blurX)/10;
ds.blurY += (10-ds.blurY)/10;
ds.alpha += (10-ds.alpha)/10;
mc1.filters = [ds];
};
};
Yes, this code does the job, but, Is there a way to add Robert Penner's Easing to this? What I'm looking for specifially is the "Elastic.EaseInOut" added to it so that it will have a liquid type of effect.
Thanks in advance. I hope I'm explaining this properly.
Mike.
Please Help: DuplicateMovieClip With Filter Effects
i'm been spending hours and hours trying to figure this issue out but i cannot seem to solve it for the life of me. :confused:
i have questions:
i've been able to duplicate my movie but only one of buttons has a mouse over effect. how do i get my other buttons to have their own unique mouse over?
now that i figured out a way to get my buttons to go down 5 rows, how do i get to also go across ten rows?
lastly, how can i dynamically create text fields inside each of those buttons and how would i access them individually once the buttons have been created?
ActionScript Code:
import flash.filters.DropShadowFilter;
var mc:MovieClip = createDropShadowRectangle ("DropShadowAlpha");
var container:MovieClip = setUpContainer ();
var ln:Number = 5;
var spacer:Number = 5;
var duplicate:MovieClip;
for (var i:Number = 1; i < ln; i++) {
var newY:Number = i * (container._height + spacer);
duplicate = container.duplicateMovieClip ("clip-" + i, i, {_y:newY});
trace (duplicate);// _level0.clip-[number]
}
function setUpContainer ():MovieClip {
var mc:MovieClip = this.createEmptyMovieClip ("container", this.getNextHighestDepth ());
var w:Number = 50;
var h:Number = 50;
mc.beginFill (0xf0f0f0);
mc.lineTo (w,0);
mc.lineTo (w,h);
mc.lineTo (0,h);
mc.lineTo (0,0);
mc.endFill ();
mc.onRelease = function () {
//...will use tween effect here
};
var filterropShadowFilter = new DropShadowFilter (2, 45, 0x000000, 0.8, 16, 16, 1, 3, false, false, false);
var filterArray:Array = new Array ();
filterArray.push (filter);
mc.filters = filterArray;
return mc;
}
any help on how to achieve these results will greatly be appreciated
Please Help: DuplicateMovieClip With Filter Effects
i'm been spending hours and hours trying to figure this issue out but i cannot seem to solve it for the life of me. :confused:
i have questions:
1. i've been able to duplicate my movie but only one of buttons has a mouse over effect. how do i get my other buttons to have their own unique mouse over?
2. now that i figured out a way to get my buttons to go down 5 rows, how do i get to also go across ten rows?
3. lastly, how can i dynamically create text fields inside each of those buttons and how would i access them individually once the buttons have been created?
ActionScript Code:
import flash.filters.DropShadowFilter;var mc:MovieClip = createDropShadowRectangle ("DropShadowAlpha");var container:MovieClip = setUpContainer ();var ln:Number = 5;var spacer:Number = 5;var duplicate:MovieClip;for (var i:Number = 1; i < ln; i++) { var newY:Number = i * (container._height + spacer); duplicate = container.duplicateMovieClip ("clip-" + i, i, {_y:newY}); trace (duplicate);// _level0.clip-[number]}function setUpContainer ():MovieClip { var mc:MovieClip = this.createEmptyMovieClip ("container", this.getNextHighestDepth ()); var w:Number = 50; var h:Number = 50; mc.beginFill (0xf0f0f0); mc.lineTo (w,0); mc.lineTo (w,h); mc.lineTo (0,h); mc.lineTo (0,0); mc.endFill (); mc.onRelease = function () { //...will use tween effect here }; var filter:DropShadowFilter = new DropShadowFilter (2, 45, 0x000000, 0.8, 16, 16, 1, 3, false, false, false); var filterArray:Array = new Array (); filterArray.push (filter); mc.filters = filterArray; return mc;}
i've been told to use the clone(); method but there's nothing solid i've been able to find with google or in the flash docs.
any help on how to achieve these results will greatly be appreciated.
thank you
Advanced Filter Effects
Hi,
This new tutorial was great, but is this kind of thing possible in AS2? Would like to know if it can be done.
Cheers
Actionscript With Filter Effects
Ok. Let me start by saying I'm getting better at Actionscript but I'm still far from where I need to be. Hopefully you guys can help.
I am trying to pull off an effect where a logo emerges from the background using "DropShadowFilter". The Background is white and the logo is white so I only want to animate the "DropShadowFilter". Doing this in the timeline makes it look a little choppy. So I thought I would try using actionscript.
Here's what I have so far to make the mc "emerge":
Code:
import flash.filters.*;
var ds:DropShadowFilter = new DropShadowFilter(0, 0, 0x000000, 0, 0, 0, 1, 3, false, false, false);
mc1.filters = [ds];
mc1.onEnterFrame = function() {
this.onEnterFrame = function() {
ds.blurX += (10-ds.blurX)/10;
ds.blurY += (10-ds.blurY)/10;
ds.alpha += (10-ds.alpha)/10;
mc1.filters = [ds];
};
};
Yes, this code does the job, but, Is there a way to add Robert Penner's Easing to this? What I'm looking for specifially is the "Elastic.EaseInOut" added to it so that it will have a liquid type of effect.
Thanks in advance. I hope I'm explaining this properly.
Mike.
Please Help: DuplicateMovieClip With Filter Effects
i'm been spending hours and hours trying to figure this issue out but i cannot seem to solve it for the life of me.
i have questions:
1. i've been able to duplicate my movie but only one of buttons has a mouse over effect. how do i get my other buttons to have their own unique mouse over?
2. now that i figured out a way to get my buttons to go down 5 rows, how do i get to also go across ten rows?
3. lastly, how can i dynamically create text fields inside each of those buttons and how would i access them individually once the buttons have been created?
PHP Code:
import flash.filters.DropShadowFilter;
var mc:MovieClip = createDropShadowRectangle ("DropShadowAlpha");
var container:MovieClip = setUpContainer ();
var ln:Number = 5;
var spacer:Number = 5;
var duplicate:MovieClip;
for (var i:Number = 1; i < ln; i++) {
var newY:Number = i * (container._height + spacer);
duplicate = container.duplicateMovieClip ("clip-" + i, i, {_y:newY});
trace (duplicate);// _level0.clip-[number]
}
function setUpContainer ():MovieClip {
var mc:MovieClip = this.createEmptyMovieClip ("container", this.getNextHighestDepth ());
var w:Number = 50;
var h:Number = 50;
mc.beginFill (0xf0f0f0);
mc.lineTo (w,0);
mc.lineTo (w,h);
mc.lineTo (0,h);
mc.lineTo (0,0);
mc.endFill ();
mc.onRelease = function () {
//...will use tween effect here
};
var filter:DropShadowFilter = new DropShadowFilter (2, 45, 0x000000, 0.8, 16, 16, 1, 3, false, false, false);
var filterArray:Array = new Array ();
filterArray.push (filter);
mc.filters = filterArray;
return mc;
}
i've been told to use the clone(); method but there's nothing solid i've been able to find with google or in the flash docs.
any help on how to achieve these results will greatly be appreciated.
thank you
Applying Effects To Dynamic Text Boxes
Hi,
I'm just starting to delve into AS, so this should be easy. I'm applying a simple alpha fade to the onEnterFrame event of a movie clip using AS, and inside that movie clip there is a dynamic text box that gets its content from an XML file. The fade works fine on everything except the text - the whole movie clip fades in, but the text just instantly "jumps into existence". Can someone explain this to me please? It doesn't seem like this is the type of issue that would require me to paste my code in here, but if it is, just let me know. Thanks!
How Much Do The Filter Effects Affect Size Of Swf?
i just happened to notice that i have been using the filters ALOT lately on a project im working on. My question...how are they affecting the outcome? obviously there is some kind of consequence in using them if you have the "quality" option within them. Can this affect how smooth a tween looks? does anyone else use them? and also do you think having a lot of filters "on" but set at 0 matters at all?
....just a thought
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();
}
}
}
How To Retain Filter Effects From Photoshop
Hi,
I was wondering if it is possible to retain filter effects in an image in photoshop and import into flash.
(ie.Overlay, lighten, screen, etc.)
Is this possible and if so will it slow down the speed of the swf. file by a massive amount?
Cheers
Page 2 - Please Help: DuplicateMovieClip With Filter Effects
Quote: Originally Posted by Tann San you would not belive the amount I have drunk tonight, by most scientifical estimates I should be lying up in a hospital right about now, anyhow, I shall attempt to answer ye questions.
those are well deserved drinks for all of your help throughout this forum.
thank you!!
Quote:
1) "mc" is going to be different over time. You have set it up in function which is a child function of a particular MovieClip. What you should do is point it to this._parent.mc and then do the same when you're setting mc i.e. when a clip is selected. Personally I would either set a single variable each time a clip is selected and then prior to setting that variable re-scale the old clip or I'd create a function that checked all clips to see which where scaled to the big value.
actually no function was needed.
i applied this method.
PHP Code:
var scaleToggle:Boolean = true;
var scaledMC:String;
var mcName:String; //<<====================
mcTest.onRelease = function () {
trace (scaledMC);
};
function setUpContainer (new_depth:Number):Void {
var mc:MovieClip = this.createEmptyMovieClip ("container" + new_depth, new_depth);
var labelFmt:TextFormat = new TextFormat ();
labelFmt.font = "Arial";
labelFmt.color = 0x000000;
labelFmt.size = 10;
var label:TextField = mc.createTextField ("label", 1, 0, 0, 0, 0);
label.html = true;
label.autoSize = "right";
//label.border = true;
label.setNewTextFormat (labelFmt);
mc.beginFill (0xf0f0f0);
mc.lineTo (width,0);
mc.lineTo (width,height);
mc.lineTo (0,height);
mc.lineTo (0,0);
mc.endFill ();
mc.filters = [new DropShadowFilter (2, 45, 0x000000, 0.9, 5, 5, 1, 3, false, false, false)];
label._x = (mc._width * 0.5) - (label._width * 0.5);
var mcX:Number;
var mcY:Number;
var twSpeed:Number = 1;
var twStyle = Elastic.easeOut;
mc.onRelease = function () {
if (scaleToggle) {
scaleToggle = false;
mcX = mc._x;
mcY = mc._y;
mc.swapDepths (100);
var mcMoveUpX:Tween = new Tween (mc, "_x", twStyle, mcX, Stage.width * 0.5, twSpeed, true);
var mcMoveUpY:Tween = new Tween (mc, "_y", twStyle, mcY, Stage.height * 0.5, twSpeed, true);
var mcScaleUpX:Tween = new Tween (mc, "_xscale", twStyle, 100, 300, twSpeed, true);
var mcScaleUpY:Tween = new Tween (mc, "_yscale", twStyle, 100, 300, twSpeed, true);
mcName = mc._name;
} else if (scaleToggle == false && mcName == mc._name) { //<<====================
var mcMoveDownX:Tween = new Tween (mc, "_x", twStyle, mc._x, mcX, twSpeed, true);
var mcMoveDownY:Tween = new Tween (mc, "_y", twStyle, mc._y, mcY, twSpeed, true);
var mcScaleDownX:Tween = new Tween (mc, "_xscale", twStyle, 300, 100, twSpeed, true);
var mcScaleDownY:Tween = new Tween (mc, "_yscale", twStyle, 300, 100, twSpeed, true);
scaleToggle = true;
}
};
}
Quote:
2) Tween them to Stage.width * 0.5 and Stage.height * 0.5.
actually this did not work.
do you think executing the script above inside an empty mc and then centering that mc would be a more simple approach?
Quote:
3) this.textfield._x = (this.square._width * 0.5) - (this.textfield._width * 0.5); that is by having the textfield width as some tiny value like 10px at the start and then assigning the text to it and then finally using autoSize = "left" on it (maybe "right").
this was a bit confusing. because with the mc.createTextField, the width and height settings set to 0, 0 with autosize set to either left or right it does not work.
if autosize is disabled then i would have to set the height and width settings to an appropriate size to accommodate the test.
Applying Simple Effects To Dynamic Text Boxes
Just to clarify, I'm not talking about the textarea component in flash.
Scenario:
I have a text box (clicked on the text tool and dragged out a typing space) that I want to fade in/out. The first thing I did was create a new symbol and create the text box there.
On the stage I made the symbol fade in/out via Alpha settings and I know I'm doing everything right since I've made simple effects like this for a while.
It seems to work in Flash when I drag the red block along the top of the timelines and drag it left and right, but when I test or export the movie, nothing happens with respect to the fading effect.
I also tried applying a gradient mask to a dynamic text box with similar results: no go.
Any ideas?
Photoshop Style Filter Effects In Flash
Is there a way to achieve the "difference" and "exclusion" style filter effects in Flash? For example, I have a black and white movie clip in the background which moves. I want text on top of this clip, but I want the appearance of the text to change based on what colors are going on behind the text, kind of like how in Photoshop when you apply an exclusion or difference fiter on something with a multi-colored layer beneath it. Any suggestions?
Advanced Filter Effects/Sound Spectrum
hi,
i've watched the tutorials on advanced filter effects and sound spectrum display for as3.
Now I wonder if there's a possibility to "offset" the blurry circles that are dynamically created by the sound from these dots. In other words: I want the circles to be off the stage (at the bottom) and the glowing spectrum to be on the stage, about 30 pixels from the bottom.
The effect is shown in a screenshot of the Zune Media Player Software (http://shadowsillusion.com/blog/wp-cont ... ection.jpg) at the bottom there's a orange/pink glow.
thanks for posting a solution
Philipp
http://www.freenet-homepage.de/phbu/
This is "my" code:
Code:
//global
function reposbg ():void {
mywidth = stage.stageWidth;
myheight = stage.stageHeight;
}
var mywidth:Number;
var myheight:Number;
reposbg ();
//XML
var xmlloader:URLLoader = new URLLoader ();
xmlloader.load (new URLRequest("directory.xml"));
xmlloader.addEventListener (Event.COMPLETE, loaded);
var xml:XML;
function loaded (e:Event):void {
xml = new XML(e.target.data);
//fire up the jukebox!
initialize ();
}
//Jukebox
var s:Sound;
var myrequest:URLRequest;
var mycontext:SoundLoaderContext;
var mychannel:SoundChannel;
function initialize ():void {
var rdm:Number = Math.round(Math.random()*xml.jukebox.item.length());
trace (xml.jukebox.item[rdm].attribute("song"));
trace (xml.jukebox.item[rdm].attribute("artist"));
trace (xml.jukebox.item[rdm].attribute("album"));
var loadsong:String = new String (xml.jukebox.item[rdm].attribute("name"));
myrequest = new URLRequest("jukebox/tracks/"+loadsong);
s = new Sound ();
s.load (myrequest,mycontext);
mycontext = new SoundLoaderContext(5000);
mychannel = s.play ();
mychannel.addEventListener (Event.SOUND_COMPLETE, nexttrack);
mychannel.soundTransform = new SoundTransform(1, 0);
}
addEventListener (Event.ENTER_FRAME, loop);
var ba:ByteArray = new ByteArray();
var bmd:BitmapData = new BitmapData(mywidth, myheight, true, 0x000000);
var bm:Bitmap = new Bitmap(bmd);
addChild (bm);
var sp:Sprite = new Sprite();
addChild (sp);
var blur:BlurFilter = new BlurFilter(8,8,3);
var colorMatrix:ColorMatrixFilter = new ColorMatrixFilter([0, 0, 0, 0, 0,
2, 1, 1.1, 0, 0,
0, 2, 1, 0, 3,
0, 0, 0, 1, 0]);
function loop (e:Event):void {
sp.graphics.clear ();
sp.graphics.lineStyle (1, 0x666666, 0.8);
SoundMixer.computeSpectrum (ba, true);
for (var i:uint=256; i>0; i--) {
var left:Number = -ba.readFloat()*30 + (myheight+5);
sp.graphics.drawCircle ((mywidth/2)/512*(i*2), left, 0.5);
}
for (var p:uint = 256; p<512; p++) {
var right:Number = -ba.readFloat()*30 + (myheight+5);
sp.graphics.drawCircle ((mywidth/2)/512*(p*2), right, 0.5);
}
bmd.draw (sp);
bmd.applyFilter (bmd,bmd.rect,new Point(0,0),blur);
bmd.applyFilter (bmd,bmd.rect,new Point(0,0),colorMatrix);
}
function nexttrack (e:Event):void {
}
Advanced Filter Effects Tutorial Problem
Everything works, but my main "Ai" clip is blurred as well. In the tutorial the "Ai" is sharp and the trail is blurred. Any ideas why? My code and .swf are attached.
**Error** Scene 1, Layer 'actions', Frame 1, Line 664: 1087: Syntax Error: Extra Char
Scene 1, Layer 'actions', Frame 1, Line 664: 1087: Syntax error: extra characters found after end of program.
}
I am new to importing classes and I have been practicing making a photo gallery. I am stuck and I want to know if someone can help me with the error I am getting.
If it is convenient, you can download and test my .zip at www.dhtmlguy.freeservers.com
Thanks in advance!
AS3 Error #1086: Syntax Error: Expecting Semicolon Before Btn
1086: Syntax error: expecting semicolon before button.
HI
PLs help me
import fl.transitions.Tween;
import fl.transitions.easing.*;
var homeX:Number = 503;
var homeY:Number = 328;
var aboutX:Number = 505;
var aboutY:Number = 829;
var princeX:Number = -336;
var princeY:Number = 317;
var princessX:Number = 1470;
var princessY:Number = 316;
var galleryX:Number = 489;
var galleryY:Number = -284;
var xTween:Tween;
var yTween:Tween;
xTween = new Tween(main_mc,"x",Strong.easeInOut,main_mc.x,homeX ,2,true);
yTween = new Tween(main_mc,"y",Strong.easeInOut,main_mc.y,homeY ,2,true);
abt_btn.addEventListener(MouseEvent.CLICK, navigate);
prince_btn.addEventListener(MouseEvent.CLICK, navigate);
princess_btn.addEventListener(MouseEvent.CLICK, navigate);
gallery_btn.addEventListener(MouseEvent.CLICK, navigate);
function navigate(event:MouseEvent):void
{
if(event.target == abt_btn)
{
setTween(aboutX,aboutY);
}
else if(event.target == prince_btn)
{
setTween(princeX,princeY);
}
else if(event.target == princess_btn)
{
setTween(princessX,princessY);
}
else
//if(event.target == gallery_btn)
{
setTween(galleryX,galleryY);
}
}
function setTween(tweenX:Number,tweenY:Number):void
{
xTween.begin = main_mc.x;
yTween.begin = main_mc.y;
xTween.finish = tweenX;
yTween.finish = tweenY;
xTween.start();
yTween.start();
}
xTween.stop();
yTween.stop();
}
this is my code but i am getting 1086 syntax error :Expecting semicolon before gallery button pls help me to recover it
Making Fast Animating Effects
Hello,
First post so please be gentle.
I was wondering what the general way for you great Flashers was to make animations speed up. I tried doing it the motion tween way with shortened frame lengths and a high fps. Is that how you guys normally speed your movies or do you use actionscript. My animations always look jumpy. Like when it animates you can see it blink a little. I want my effects to move the way you guys have it move, very crisp, clean motions.
Thanks,
Scott "Tom Collins" Norm
Syntax Error Error? Quick Question
I have some code to stream a mp3 and a slider to control the volume. It works fine. I put it into another flash file and then it doesn't. My original is in Flash 8, and the new is in MX2004, I figure that this is why I've got the error message. So I converted the MX2004 to F8 and still I get an error message with my code. Now I can't stream this sound, could someone point out my mistake to me? Thank You
Code:
var game_sound:Sound = new Sound();
game_sound.onLoad = function(success:Boolean):Void {
if (success) {
trace("Sound Loaded");
game_sound.start(loops,1000);
game_sound.setVolume(20);
}
};
game_sound.loadSound("atmosphe-PSION-3280_hifi.mp3", false);
Animating Text With Actionscript And Several Effects Using Load Movie Problem.
Hi everybody. Hope you're all ok.
I have this code I use for animating text with actioscript, and it works wonderfully. But I have found a problem.
First, this is the code which duplicates the movie clip that contains the animation AND the text box which contains the letter to be changed:
duplicateMovieClip ("letteranimation", "letteranimation" + x, x);
setProperty ("letteranimation" + x, _x, Number(StartXPosition)+Number(characterInLine*kern ing));
setProperty ("letteranimation" + x, _y, Number(StartYPosition)+Number(linenumber*linespace ));
setProperty ("letteranimation" + x, _visible, True);
set ("letteranimation" + x + ".letter.letter", substring(MyTextDragMovie.MyText,x, 1));
x = Number(x+1);
This works with no problems for me.
Now, since I want to let anybody to load different text effects, I load another movie (later will be able to load any movie which contain each a different letter animation).
I load another movie called Text1.swf on Target=letteranimation (as you can tell, letteranimation is the movieclip that is duplicated).
I made this Text1.swf on the main timeline of the Text1.fla.
Since after many experiments, I could see that if I loaded anything on a target, the target itself (the movieclip) still remained, it wasn't removed, but what was removed was the content, replaced with the loaded one. That's why I made the Text1.swf on the main timeline of its fla.
Now, I made also more experiments, trying to detect the communication and the paths I needed to describe for the functions of the loaded movie with my main movie.
I found that, according me of course, although I loaded an external movie (Text1.swf) the behaviours and paths of the functions remain the same, as if I didn't load an external movie. BUT also, it seemed that when loading this content on the target, only respected me the objects and their animations (of Text1.swf), and NOT the Idnames of the movieclips contained on the Text1.swf !!!
I experimented a lot, and only I could use, for example, tell target=letteranimation, but if I wanted to still use tell target=letteranimation.letter.letter of just letteranimation.letter, no way it would work. I tried to use "_level1" and stuff, but nothing worked !!!
So, if anyone can help me about this LITTLE issue, that would be more than great.
P.S. Also, the Text1.swf is EXACTLY the same as my letteranimation that I have on my main movie.
Again, I still can use telltarget=letteranimation, but not telltarget=letteranimation.letter. It's like letter doesn't exist.
Is it a bug? If it's a bug, then what a DRAG.
|