Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




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  



KirupaForum > Flash > Flash 8 (and earlier)
Posted on: 01-09-2007, 12:39 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

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...

How To Apply More Than One Filter Via Script...
Hi all...
Like the topic says...

How can I apply two filters (ie. Glow and Blur) via script on the same MC?

Thanks...

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

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);
}

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 appritieted

The code itself is in 2 classes, first is Ripples.as
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 Initialized");
      var subobj = new RippleCanvas();
      this.addChild(subobj);

      }
   }
}


And second is RippleCanvas.as
Code:

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

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?

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);

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?

Dynamically Apply A Textformat?
Does anyone know how to dynamically apply a textformat to some dynamically generated text? I have been struggling with this for far too long...

Something in the line of
eval("headline" + i + ".setTextFormat(myformat)");

although this doesn't work! Neither does
eval("headline2.setTextFormat(myformat)");

but

eval(headline.setTextFormat(myformat));

does work, although it's not dynamic. Argh!

Any help would be very much appeciated!

Dynamically Apply GlowFilter
Hey

Has anyone worked out how to dynamically apply Glowfilter to a dynamic textField? I found an example of getting it to work on a movieClip with a textField inside it, but I don't want to have to put each textField in a separate movieClip to get it to work...

[F8] Apply Dropshadow To Dynamically Created Mc?
I'm trying to add a dropshadow filter to a dynamiaclly created movieclip, without success. I have a thumbnail which, when clicked, simply creates a new movieclip and loads a larger version of the image in the centre of the movie, which the user can then click to remove it. All this works fine, except I can't get the shadow to work! Here is the code on my thumbnail:


Code:
on (release) {
_root.createEmptyMovieClip("container",10);
_root.container.createEmptyMovieClip("imgHolder", 1);
loadMovie("images/ca_3.png", _root.container.imgHolder);
_root.container._x = 80;
_root.container._y = 60;
_root.container.width = 640;
_root.container.height = 480;

var myGlow = new GlowFilter (0x000066, 0.7, 9, 9, 3, 3, true, false);
var myDrop = new DropShadowFilter(12, 45, 0x000000, .6, 8, 8, 1, 2, false, false, false);

// Applies the filters to the object
_root.container.filters = [myGlow, myDrop];

_root.container.onPress = function() {
_root.container.removeMovieClip();
};
}
I have import flash.filters.*; in frame 1 of my main root timeline. The above code is placed in an externally loaded swf. Any ideas?

Adding A Filter Dynamically
Greeting. this is likely a retarded question, but it also looks like the right forum to post it in so thats alright. I am trying to set optionEnable and optionDisable variables for some movieclips that are submenu buttons. so i made

var optionDisable:GlowFilter = new flash.filters.GlowFilter(color:#FFFFFF, null, blurX:7, blurY:7, strength:50, quality:3, false, false);

var optionEnable:GlowFilter = new flash.filters.GlowFilter(color:#FFCC00, null, blurX:7, blurY:7, strength:146, quality:3, false, false);

and then tried to manually activate them with

this.updatesButton.GlowFilter(optionEnable);
this.showreelButton.GlowFilter (optionDisable);

can someone enlighten me on how to remedy my bogus ways?

[F8] Apply Functions To Dynamically Created Things?
I'm creating some text fields at runtime, and i wanna add functions to them..

like

Text1.onRelease = function(){
yadda yadda yadda
}


How do I do that?

How Do I Dynamically Apply The Same OnPress() Function To Several Movieclips?
Simply, when you click on a movieclip, it fades up a la


Code:
var revealTween:Tween = new Tween(mcHighlight, "_alpha", Strong.easeOut, 0, 75, 12, false);
I'm trying to write a template as this is an oft repeated type of interactivity where I just need to set a variable for the number of movieclips rather than define an onPress function for each one.

I have a for-loop which I've used for the reveal and reset button...


Code:
for (var i:Number = 1; i <= numOfHighlights; i++)
... but I'm not sure how to get this to tell each individual movieclip to run that tween itself alone when clicked. I presume I can do it this way, or is there another way?

[FMX 2K4-P] AS2.0 - Apply Style Without Dynamically Loading CSS Sheet
I've found a million tutorials on doing this by loading a CSS file, which is fine, but I don't want to load CSS...I'd rather just modify the thing with actionscript. I've done this before with one of my files, but can't seem to find it. If anybody has a link or can help me out with this one, I'd appreciate it.

Load MC From Library And Apply Script To MC Dynamically
I have several swf movie files that load into levels within my folio, these levels being 2,3 and 4. I have a ball within the root file located currently in the library with an identifier name of "ball" that i want to dynamically load to level 5 and have the following script appied to it...

BALL FOLLOW CODE"
onClipEvent (load) {
_root.ball_mc
_x = 0;
_y = 0;
speed = 3;
}
onClipEvent (enterFrame) {
_root.ball_mc
endX = _root._xmouse;
endY = _root._ymouse;
_x += (endX-_x)/speed;
_y += (endY-_y)/speed;
}

So I've applied this script to an on clip event:

ATTACH MOVIE CODE:
_root.attachMovie("ball", "ball_mc", 5);

Q: Now how do I go about targeting this newly attached movie to the ball follow code above???

Any help would be great, cheers!!!

How Apply Filters To Dynamically Loaded Images?
Using Flash 8;

Hello,

I am trying to add simple drop shadows to a few dynamically loaded images and it's not working. If I create a plain box or rectangle, the drop shadow filter works fine, but not with loaded .jpg's. Can anyone help!! Here's my code:

import Flash.filters.DropShadowFilter;
_root.createEmptyMovieClip("Window1", _root.getNextHighestDepth());
Window1.loadMovie("image1.jpg");
Window1._x = 200;
Window1._y = 150;
var dropShadowropShadowFilter = new DropShadowFilter(10, 45, 0x000000, 0.4, 5, 5, 1, 2);
Window1.filters = [dropShadow];

//Note: image1.jpg resides in the same folder as .swf.

Thanks, Dave.

[FMX 2K4-P] AS2.0 - Apply Style Without Dynamically Loading CSS Sheet
I've found a million tutorials on doing this by loading a CSS file, which is fine, but I don't want to load CSS...I'd rather just modify the thing with actionscript. I've done this before with one of my files, but can't seem to find it. If anybody has a link or can help me out with this one, I'd appreciate it.

Apply Tween Classes To Dynamically Loaded Images
I am creating a picture slide show with dynamically loaded pictures. I have the various tweens set up to fire randomly, and to apply their 'special effects' to the loaded picture. I have searched for the answer to this, but have not found anything that worked here.

My question is: How can I get the code to run through all the pictures, one at a time, and apply a random tween to each one? As it is right now, all of the pictures are loaded on top of each other, which is not what I need for this to do. Here is the code: ....

[F8]AS2.0 Dynamically Load Jpg Into MovieClip And Apply Class Instance
I'm working on a photo-sharing demo using AS2.0, and I have a question that I would very much appreciate help with. I would like to dynamically load photos (stored as jpgs in the .fla's local directory) into MovieClips, and apply a class instance to them. Currently, for debugging, I've imported jpgs to the Stage, converted them to MovieClips, and then accessed their linkage properties, setting them to the class I need them to implement. But for the final application all of this will have to be done with code.

I know how to dynamically load the jpg into a MovieClip using loadImage(), and I know how to create a MovieClip that is an instance of a class by using attachMovie() with a library symbol and the class name. How do I combine the two? Is there a way to access the linkage properties of a MovieClip dynamically?

Thanks!

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

[F8] Dynamically Create A Textbox, Embed The Font And Apply A Stylesheet
havin a bit of trouble here lads.

can someone show me how to.

I can create the textbox and embed the font no problem but when the style sheet goes on it all disappears.


anyone?

Apply Typed Text To A Dynamic Text Field Without Selecting It
I'm trying to make a Dos like flash application, although I'm finding the problem where the cursor in DOS is different the the vertical one in regular text fields like on internet browsers. My attempt was to have an invisible movie clip that said...

onClipEvent (enterframe) {
if (Key.isDown(97)) {
_root.dos = _root.dos + "a"; }
if (Key.isDown(98)) {
_root.dos = _root.dos + "b"; } //...

and etc. But this isn't working, I always get capitcal characters. Is there a more appropriate way to confront this problem? If anyone knows how, please help me :)

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]);
}

Apply CSS To A MC's Text Field
Here are the source files. The question is not so much a question as it is a problem, and the problem is...I cannot get my externally loaded CSS to apply to my text field. Now this isn't a normal text field because I know how to do the simple way. This text field is a item inside of a Movie Clip. And the movie clip has its own class (homePanel.as .:INCLUDED IN THE ZIP FILE:.) and the style sheet is applied via my_mc.setStyle(); look at the method please and tell me what I am doing wrong.

How Can I Apply CSS In Dynamic Text Using XML
Hello Sir,

I am in trouble becouse i got text through XML file in a flash file but i want to apply CSS on text which i wrote in XML file and that text is displayed in a dynamic text field in flash.
Sir i am really in trouble please help me. what will be the action script for this type of work.
please give me solution as soon as possible.

please help me

Apply CSS To A MC's Text Field
Here are the source files. The question is not so much a question as it is a problem, and the problem is...I cannot get my externally loaded CSS to apply to my text field. Now this isn't a normal text field because I know how to do the simple way. This text field is a item inside of a Movie Clip. And the movie clip has its own class (homePanel.as .:INCLUDED IN THE ZIP FILE:.) and the style sheet is applied via my_mc.setStyle(); look at the method please and tell me what I am doing wrong.

Apply A Stroke To Dynamic Text?
Go to the niketeam web site, select test drive, select a jersey style then click through "next step" six times, you should be at the page to apply an outline to the text on the jersey. If you go back one page you can select the font, if you go back two pages you can type in your team name.

With some help here I figured out the text on an arch and arc. I have no clue how they are stroking the text that appears to be dynamic, since you can go back and change your team name and the stroke around the text remains!

Any ideas?

Thanks

Apply Text Formats To Strings?
Let's say I have a textfield I'm loading a lot of information into, and I would like to apply formats to certain sections or words in the textfield. Is there a way to apply text formats to only PORTIONS of a textfield?

Apply External Css To Extenal Text
I found this that loads on external css file:

code:
//Create a new style sheet object
var myCSS = new TextField.StyleSheet();

//Specify the location of the CSS file that you created earlier
var cssURL = "example.css";


//Hard code some HTML text to display (for example purposes)
exampleText = "<p class='headline'>Tutorial Takes Forever To Write</p>";
exampleText += "<p><span class='byline'>Bath, UK</span>";
exampleText += "--Flash developer NWebb seemed to take ";
exampleText += "forever to finish his CSS-Flash tutorial, ";
exampleText += "but it is finished now and you can find it ";
exampleText += "<a href='http://www.nwebb.co.uk'>here</a> ";
exampleText += "along with a few others.</p>";


//Load CSS file
myCSS.load(cssURL);
//define onLoad handler
myCSS.onLoad = function(success) {
if (success) {
/* If the style sheet loaded without error,
assign it to the text object, and assign the HTML text to the
text field*/
myText.styleSheet = myCSS;
myText.text = exampleText;
}
};


And i use this to load some external text:
code:
loadVariables("content/pages/page.lang.php?page=home&type=FLA&lang="+_root.lang , this);


with the external text I just created a 'dynamic' text box and set the 'Var:' the the properties box to '_root.Vhome1'.

'Vhome1' is the variable that the php script prints.

what I need to do is aply the css to the externaly loaded text.

I tried this:

code:
//Create a new style sheet object
var myCSS = new TextField.StyleSheet();

//Specify the location of the CSS file that you created earlier
var cssURL = "example.css";

loadVariables("page.lang.php?page=home&type=FLA&la ng="+_root.lang, this);
exampleText = _rootVhome1;

//Load CSS file
myCSS.load(cssURL);
//define onLoad handler
myCSS.onLoad = function(success) {
if (success) {
/* If the style sheet loaded without error,
assign it to the text object, and assign the HTML text to the
text field*/
myText.styleSheet = myCSS;
myText.text = exampleText;
}
};



But it didn't work.

Any ideas?

Cheers
Chris

Apply Different Styles To Text From Database
Hi I have the folowing code which takes data from a mysql database and displays in a flash movie


Code:

// split variables into array
names = names.split("|");
messages = messages.split("|");
numbers = numbers.split("|");
fontnumber = fontnumber.split("|");
var max = 10;
var hspace = 96;
var vspace = 41;
var totalWidth = hspace*(names.length/max);
var totalHeight = vspace*max

for (i=0; i<(names.length-1); i++) {
var y = i%max;
var x = (i-y)/max;
var clip = _root.zoomBox.container.theWall.itemInstance.duplicateMovieClip("itemInstance"+i, i);
clip._x+=x*hspace;
clip._y+=y*vspace;

// set variables
clip.nameinput = names[i];
clip.messageinput = messages[i];
clip.number = numbers[i];
}
this works fine but I now want to be able have a choice of fonts applied to different blocks. This would be defined in the databse as a number 1 - 5.

I have the php sode working fine but I cant seem to get flash to apply the font styles to the dynamically made movieclips.

this is what I have tried but is not working... I have embedded the fonts in the movie.


Code:
// font declarations
var fontStyle1:TextFormat = new TextFormat();
fontStyle1.font = "arial";
fontStyle1.size = 24;
fontStyle1.bold = true;
fontStyle1.color = 0x11ff13;
//----
var fontStyle2:TextFormat = new TextFormat();
fontStyle2.font = "times";
fontStyle2.size = 16;
fontStyle2.bold = true;
//----
var fontStyle3:TextFormat = new TextFormat();
fontStyle3.font = "gill_sans";
fontStyle3.size = 15;
fontStyle3.bold = true;

// split variables into array
names = names.split("|");
messages = messages.split("|");
numbers = numbers.split("|");
fontnumber = fontnumber.split("|");

var max = 10;
var hspace = 96;
var vspace = 41;
var totalWidth = hspace*(names.length/max);
var totalHeight = vspace*max

for (i=0; i<(names.length-1); i++) {
var y = i%max;
var x = (i-y)/max;
var clip = _root.theWall.itemInstance.duplicateMovieClip("itemInstance"+i, i);
clip._x+=x*hspace;
clip._y+=y*vspace;

// set variables
clip.nameinput = names[i];
clip.messageinput = messages[i];
clip.number =numbers[i];
_root.theWall["itemInstance"+i].messageinput.setTextFormat(_root.fontStyle1);
_root.theWall["itemInstance"+i].messageinput.embedFonts = true;

}
anyone be able to help?

How To Apply Dynamic Text Effects
hi! all of you... i have to create the flash application just like on the following URL - http://www.designashirt.com/design.asp

could any one plz help me... abt how to create the effects on text, that are done in this movie....

its really urgent.... plz reply... if any one has any clue to do so.

Apply AS To Existing Dynamic Text Box
I want to import an external text file into a dynamic text box to preview as a block of text that can be formatted in Flash.

I have AS to create a text field, and import the external file (see AC below). This works beautifully.
I also have AS that allows me to apply formatting to text (see AC below).
I am having trouble doing both (importing AND formatting the same text; see my attempt below).

I would be happy to create a dynamic text field in Flash, applying text properties to that, and import the text into this field, but am having trouble figuring out how to reference an EXISTING text field in my AS.

Thanks in advance for any assistance you can provide.
--Nathan

My system specifications:
Mac OS 10.4.10
Flash CS3







Attach Code

// to IMPORT THE EXTERNAL TEXT FILE:

var external_txt:TextField = new TextField();
var externalReq:URLRequest = new URLRequest("magalog_bullets.txt");
var externalLoad:URLLoader = new URLLoader();

externalLoad.load(externalReq);

externalLoad.addEventListener(Event.COMPLETE, textReady);

external_txt.x = 5;
external_txt.y = 10;
external_txt.border = true;
external_txt.width = 100;
external_txt.height = 100;
external_txt.wordWrap = true;

addChild(external_txt);

function textReady(event:Event):void
{
external_txt.text = event.target.data;
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// to STYLE TEXT:

var myText:TextField = new TextField();
var myFormat:TextFormat = new TextFormat();

myFormat.font = "Trebuchet";
myFormat.color = 0x3A6594;
myFormat.size = 12;

addChild(myText);
myText.text = "this is what I want the text to say";
myText.autoSize = TextFieldAutoSize.LEFT;

myText.setTextFormat(myFormat);

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// my attempt to COMBINE the importing and formatting of the text:

var external_txt:TextField = new TextField();
var externalReq:URLRequest = new URLRequest("magalog_bullets.txt");
var externalLoad:URLLoader = new URLLoader();

externalLoad.load(externalReq);

externalLoad.addEventListener(Event.COMPLETE, textReady);

external_txt.x = 5;
external_txt.y = 10;
external_txt.border = true;
external_txt.width = 100;
external_txt.height = 100;
external_txt.wordWrap = true;

addChild(external_txt);

var myFormat:TextFormat = new TextFormat();

myFormat.font = "Trebuchet";
myFormat.color = 0x3A6594;
myFormat.size = 12;

external_txt.setTextFormat(myFormat);

function textReady(event:Event):void
{
external_txt.text = event.target.data;
}

Scrolling Upload Text And Apply Css
I used the tutorial to load to my movie external text in a .txt file. I need to know how can i apply css to that imported text...

How To Apply CSS To XML Text Links [renamed]
I want a xml text loaded in a normal textfield.
I want to embedd the font to the textfield (so not in the xml file)
I also want to add links to the xml text and change the look of the link with css.

I know i want a lot, but is this possible or does somebody have a tutorial for this or a better sulotion.

I just want a text file with links in it in Flash and want it to be possible to change it outside of flash so in a XML or text or html file i dont care.
As long as i can make links in the text file without the ugly link stripe under the text (so it should be changable with CSS)

Can You Apply Transitions To Dynamic Text?
I have a scene that contains one dynamic text field, which calls text from a text file. It's working fine.

I'd like to apply a transition so that the text wipes in, but as soon as I apply a transition, no text is displayed when I test the scene.

Have I missed a trick?

Thanks :-)

[f8as2]Can I Apply CSS To Input Text?
Are you able to attach a style sheet to an input textfield? If so, how do I go about doing that?

would it be a

textfield.onChanged = function{
textfield.htmlText = "<.myStyle>"+text+"</.myStyle>";
}

type of thing?

Apply Gradient For Editable Text
Hi guys,

I found many gradient example on the net but they only show me to how to make gradient to a canvas, a box or even some ellipse ( display object ) , but what I really want is gradient color for text ( editable text ) ( apply gradient created for text ).

Is there a way out or a good explanation, guide, link, please some comments, thanks for reading.

Regards.s

Scrolling Upload Text And Apply Css
I used the tutorial to load to my movie external text in a .txt file. I need to know how can i apply css to that imported text...

How To Apply CSS To XML Text Links [renamed]
I want a xml text loaded in a normal textfield.
I want to embedd the font to the textfield (so not in the xml file)
I also want to add links to the xml text and change the look of the link with css.

I know i want a lot, but is this possible or does somebody have a tutorial for this or a better sulotion.

I just want a text file with links in it in Flash and want it to be possible to change it outside of flash so in a XML or text or html file i dont care.
As long as i can make links in the text file without the ugly link stripe under the text (so it should be changable with CSS)

How To Apply Dynamic Text, In This Case?..
Last edited by arn : 2005-07-14 at 08:42.
























hello everybody!
I've made a movieclip containing a dynamic textfield with "Var" called:
varTexte2

and one Action layer containing this actionscript:


varTexte = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum just test text.";
this.i = 0;
this.onEnterFrame = function() {
var _l1 = this;

_l1.i = _l1.i+4;
if (_l1.i<=varTexte.length/3) {
varTexte2 = new String(varTexte.substr(0, _l1.i)+chr(random(80)+21)+chr(random(80)+21)+chr(random(80)+21)+chr(random(80)+21)+" "+varTexte.substring(varTexte.length/3, varTexte.length-2*varTexte.length/3+_l1.i)+chr(random(150)+21)+chr(random(98)+21)+chr(random(150)+21)+chr(random(98)+21)+" "+varTexte.substring(2*(varTexte.length/3), varTexte.length-varTexte.length/3+_l1.i)+chr(random(150)+21)+chr(random(98)+21)+chr(random(150)+21)+chr(random(98)+21));

} else {
varTexte2 = varTexte;
// end if

_l1.onEnterFrame = null;
}
// end if
};




How can I get the same text effect while loading the text from an external .txt file?


Thanks for you efforts!


Best,

Arn


http://www.electronicnature.com

Apply Font Styles To Text Field
Hi all,

I have nothing but themost basic noob knowledge of Flash and actionscript, so I would really appreciate some help!

I created a Flash with a text field that pareses and RSS feed. Just copied the AS from here:

http://www.yourminis.com/developers/...s/as3/rss.aspx

Fair enough, easy, copy&paste and it works.

Now I want to style this text field: font colorm link color, header color, background color etc. With CSS/HTML this would take me 10 secs.

I have literally spent 6 hours reading documentation, tutorials, trial and arror. Nothing works. Is it THAT difficult to style text inside an element with AS???

Any help would be much appreciated. Maybe an example I can paste into the code referenced above so I can see how this would work, as anything else I read just never did!

Thanks for the help!

Chris

Apply Stylesheet On Dynamic Text Loaded From XML
Hi,

I tried to apply a stylesheet on a textArea where text loaded from XML but its not working. It back to default text style. //solved - thanks jason !!


Problem 2 - is it possible to attach a movieclip or image inside textArea component?


Thanks!

How To Apply Scrollbar To The Static Text Field?
To be able to have Bold or Italic word in the a text field I have to use Static Text Field. At the same time want to have a scrollbar which I can not apply to static text field.

I have 2 choices:
a. Eiether be able to to change the text in Dynamic Text Field to be flexible for Bold and Italic properties or
b. I need to make Static Text Field to have scrollbar.

Do you have a hint?
//Thanx





























Edited: 02/11/2007 at 11:52:01 AM by SwedKim

Copyright © 2005-08 www.BigResource.com, All rights reserved