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




[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!



KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 04-01-2007, 02:45 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.

Adjust Color Filter Programmatically?
I can't find a way to apply the Adjust Color filter(s) programmatically. All the other filters, ie. Drop Shadow, Glow, etc., are in the flash.filters package, but Adjust Color isn't one of them. I mainly want to adjust the Saturation and Hue of a movie clip. Does anyone know if there is a way to do this via actionscript?

Thanks for any 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

Apply Text Filter Dynamically
How can I add a glow filter to a textfield via actionscript? I know the procedure for doing the same thing with a movieclip, but the TextField class (and TextFormat) don't seem to accept filters as a property?

What I have so far:


ActionScript Code:
import flash.filters.*;var text_glow:GlowFilter = new GlowFilter(0xFF0000, 80, 10, 10, 100, 3, false, false);var some_txt:TextField;//Want to apply filter to text field  

Unable To Apply Blur Filter
The code below fades three mc instances into each other. The movieclip instances are called, picture1_mc, picture2_mc,picture3_mc. They are based on three bitmap images that also sit in the library. I manually converted the original bitmaps into movieclips on the stage area. The fade code works fine, but what I would like to do is allow the user to
mouse click and cause a blur effect whilst the images are cycling along. My problem is that Im not sure how to apply this within my mousedown function. The applyFilter method seems to call for bitmaps but I'm dealing with movieclips. Thanks for any guidance
import flash.display.BitmapData;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.filters.BlurFilter;
var filter2:BlurFilter = new BlurFilter(Math.ceil(Math.random()*5), Math.ceil(Math.random()*5), 3);

init = function () {
currentIndex = 1;
currentLayer = 1;
howLongToWait = 0;
_root.attachMovie("picture1_mc", "pic1", 0);
addNewPic();
};
addNewPic = function () {
clearInterval(myInterval);
if (currentIndex%3 != 0) {
currentIndex++;
} else {
currentIndex = 1;
}
newlyAdded_mc = _root.attachMovie("picture"+currentIndex+"_mc", "pic"+currentIndex, currentLayer++);
newlyAdded_mc._alpha = 0;
newlyAdded_mc.onEnterFrame = function() {
this._alpha += 2;
if (this._alpha>=100) {
this.onEnterFrame = null;
myInterval = setInterval(addNewPic, howLongToWait*100);
}
};
};
// run init()
init();
onMouseDown = function ()
{
//problems here!!!!!!!!!
var pointoint = new Point(_root._xmouse, _root._ymouse);
var rec:Rectange = new Rectangle(100,100,6,6);
//problem applying filter
//????.applyFilter(?????,rect,point,filter2)
};
myListener = new Object();
Mouse.addListener(myListener);

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?

Autosize Textfield & Filter?
Hi there,
I have a dynamic textfield in a tickertape movieclip.
The textfield is set to autoSize = true and this works fine.
However if I apply a dropshadow filter the text dissapears or the filter does not apply.

The filter works fine when I don't use the autosize property

Suggestions anyone?

How To Apply Multiple Colors To Dynamic Textfield?
Hello,
I have to buttons on my stage called: button1_btn and button2_btn.
When you press on it, the color parameter is passed to the makeText function.

What i would like it to do, is when you press on button 1, a text is added to the dynamic
textfield debug_txt with the color that is passed. And when you press the button 2, the
text that was added in the first place stay's this color. And another sentence is added with
the color that is passed trough button2.

But what i created does not work.. Does anybody have experience with this?

This is the code i have so far:

function makeText(inputColor) {
var fmt:TextFormat = new TextFormat();
fmt.color = inputColor;
debug_txt.text += "this text should be changed to the input color?"+newline;
debug_txt.setTextFormat(fmt);
}


button1_btn.onPress = function() {
makeText("0xFF0000");
}
button2_btn.onPress = function() {

makeText("0xCCCCCC");
}




Regards,

[F8] Maintain Antialias On TextField With Filter
Applying a filter to a dynamically generated text field removes it's antialias. I understand that using a filter on an object automatically turns cacheAsBitmap on for that object. Does cacheAsBitmap always convert antialiased text to bitmap text?


Code:
label_mc = thumb_mc.createEmptyMovieClip("label", 3);

var txtFormat:TextFormat = new TextFormat();
txtFormat.font = "Frutiger-Roman";
txtFormat.size = 12;

var label_txt:TextField = label_mc.createTextField("label_txt", 0, 0, 5, 0, 0);
label_txt.setNewTextFormat(txtFormat);
label_txt.type = "dynamic";
label_txt.autoSize = "center";
label_txt.selectable = false;
label_txt.restrict = "A-Z a-z 0-9";
label_txt.embedFonts = true; //this doesn't seem to do anything
label_txt.text = "hello world";
label_txt.antiAliasType = "advanced";
label_txt.textColor = 0xFFFFFF;

addDropShadow(label_mc); //this fuction adds the filter, I know it works
Thanks,

afro

F8/AS2: AutoSizing A TextField With A DropShadow Filter
Hi!

I have an input Text Field with the autoSize property set to true, a DropShadow filter, and with a default text value of "Your text here".

When the user enters text in the Text Field, and if their entry exceeds the length of the default text, everything typed after that length is reached APPEARS to have been truncated.

However, when I turn the DropShadow off, the TextField expands to the requirements of the newly entered text. This proves that the TextField actually autosized, but just didn't show the additional characters when the DropShadow was applied. I can then turn the DropShadow back on, showing all of the text in the Text Field.

Does anyone know how to autoSize a textfield(so that the user can actually see the expanded TextField) when a DropShadow filter has been applied?

How Can I Apply A TextFormat To A Dynamic Textfield Inside A Button ?
Hi,

I have a dynamic textfield inside a button.
I load text to the textfield using a variable, I assigned _root.valvar variable to the textfield, and I change the text shown in textfield by changing _root.valvar value. That is fine.
I want to apply a TextFormat to it, because although I centered the text in design time, it is not being centered at all.
But how can I reference the textfield to apply the textformat to it ?

This is what I have:
main movie clip
button_btn ( the button)
txt_on (a dynamic textfield inside the button, which is shown when mouse is on button)
txt_off (another dynamic textfield inside the button)

I tried _root.button_btn.txt_on but that path does not seem to be right. I tried to get the path in the Actions panel directly, but it stops at the button, it does not let me access items inside the button.

Any ideas??

Thanks !!!!

DropShadow Filter On Textfield With Autosize=true Dosent Resize
Hey guys, Ive been scratching my head at this, hopefully someone knows a workaround. I create a new text field, set it unselectable, have it use embedded fonts, turn the border on so you can see where its art, attach my text format, then apply the dropshadow filter. Heres the weird part: If autoSize is true, it will render the dropshadow, if its false it wont. So why not just set autoSize=true and be happy? If the textfield is stretched larger than it was originally, flash seems to just stop drawing the field outside of the original space. For an example, make a new fla (or see attachments), make a dynamic or input text on the timeline, set it to Tahoma (or whatever, just update the code to reflect it) and have it embed at least the alphanumeric chars, then paste this code and run it. then comment out the autosize, filter, textformat, etc lines and see what happens. The drop shadow is red so its noticeable, but do you see how it just stops drawing? Any ideas? Thanks FK!


Code:
import flash.filters.DropShadowFilter

var _displayTextField:TextField = _root.createTextField("displayField",1,0,0,100,100);
_displayTextField.selectable = false;
_displayTextField.embedFonts = true;
_displayTextField.wordWrap = true;
_displayTextField.border = true;
_displayTextField.autoSize = true;
var tf:TextFormat = new TextFormat("Tahoma",12,0x333333, null,null,null,null,null,"center");
_displayTextField.setNewTextFormat(tf);
_displayTextField.text = "hello";
//(distance, angleInDegrees, color, alpha, blurX, blurY, strength, quality, inner, knockout, hideObject);
var _displayTextFilter:DropShadowFilter = new DropShadowFilter(2, 45, 0xFF0000, .8, 2, 2, .6, 1, false, false, false);
_displayTextField.filters = new Array(_displayTextFilter);
_displayTextField._width = 400

this.onEnterFrame = function() {
_displayTextField._width += 5;
};

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

What's Better To Do Programmatically, And What's Not?
I'm trying to map out what I should do by hand, and what to do through actionscript.. I mean, not in terms of exact operations, but generally.. Like, if I were to do site that had nothing really interactive to it, only cool graphics. Would it still be better to do all the animations programmatically?

I'm having a hard to time figuring out when to do things manually, and when not to. I mean, if a certain interaction needs to processed intelligently through scripting, then obviously I would script it, but it's the "just see, no touch" type animations that I wonder about. Like, how do you time things if you scripted all the animation? Do you set up delays or something? I'm sort of clueless in this department.

I'm just a beginner, and I' having a tough time getting the big picture, since I can find source files for individual effects, but not really for a whole site. (so I can learn how to organize the site) Are there tutorials that point in this direction?

Programmatically Converting .avi To .flv
Hi everybody,

I'm trying to decide what's the best way to do this...

The problem:
I have quite a handful of short videos (.avi) that I'd like to put on the internet. It's copy righted materials, so it's preferable that they're not cached in client's hard drive. My research told me that it's the job for streaming technology, and after further research it seems that flash streaming movies (.flv) are good candidates for this.

The goal:
I know there're apps out there that converts .avi to .flv, but I need to be able to automate this process. I'm a programmer and I can learn actionscript if needed, but before I spend my time to do that, I need to know if it's doable or not.

The automation process should roughly look like this:
1. The program reads video list from an input file.
2. The list basically are the location of the .avi files in the hard drive.
3. In the loop, the apps will sequentially convert each of the .avi movie to the .flv format.

The questions:
1. Can I achieve my goal using actionscript?
2. If not, can any body suggest a good way to do this? the keywords here is "to automate the process", so feel free to suggest any commercial software as long as it's programmable.

I really appreciate your feedback on this.

Thanks,
Leon

How To Programmatically Cause A Tween
I have two objects, and their motion path in an array with the (x,y) coordinates. The path is not a straight line, and the path of each is independent. How can I programatically cause a motion tween for both of the objects to move simlutaneously from the starting x,y coordinate to the ending x,y coordinate?

Programmatically Creating
Hey I am programmatically creating some movie clips, the problem I am having is that when I programmatically create my clips, they are on top of everything else. So how do I control which layer the movie clip is on when I use attatchMovie?

Programmatically Creating
Hey I am programmatically creating some movie clips, the problem I am having is that when I programmatically create my clips, they are on top of everything else. So how do I control which layer the movie clip is on when I use attatchMovie?

Programmatically Zoom In
Hi
I'm not much experienced with flash, so if my question is dumb, do bear over with me.

I have a flash movie, witch is rather large. Now I would like the movie to begin with a zoom of 200%, and I still want the user to be able to use the right-click menu to change this zoom.
I have tried this :

Code:
_root._xscale = 200;
_root._yscale = 200;
But even though it does zoom in, it makes it impossible to zoom out beyond the initial zoom.

WebServiceConnector ~ Programmatically
I have my webservice connected swf operating at a basic level.

Now I am ready to actually make it useful, so how do you programmatically set the properties of the WebServiceConnector's bindings?

Can you create the bindings in code?

I am trying to use a web service that has several methods and I want to assign it on the fly rather than adding a new WebServiceConnector for each method.

Adittionally, and I hope this is not too much for a single post, I want to bind the results to a variable. How would that be done?

My humble thanks in advance,

Getting Function Name Programmatically
I am hoping that there is a way to get the function name within a function programmatically.

Here is my problem:

I have a variable array of properties on an object: eg. my_arr =["a","b","c"]

For each property, there is an associated event broadcast. Eg. "on_c_update".

Now I want to write a centralized object that simply passes on these event broadcasts.

I can hard-code it like this:


ActionScript Code:
this.on_c_update = function() {
   this.broadcastMessage("on_c_update");
};

But how do I set these "middle-men" up dynamically?

Obviously the following code won't work because my_arr[i] is not defined at the time of the function call:


ActionScript Code:
for (var i in my_arr) {
  this["on_"+my_arr[i]+"_update"] = function() {
     this.broadcastMessage("on_"+my_arr[i]+"_update");
  };
}

So is there a way to do this?:


ActionScript Code:
for (var i in my_arr) {
  this["on_"+my_arr[i]+"_update"] = function() {
     this.broadcastMessage(this.functionname);
  };
}

Is there any way to get the function name, or any way to set variables on a function itself?

OnClipEvent For Programmatically Generated MLs
Hi all,

i duplicate a bunch of empty MLs by using duplicateMovieClip. Here is the code:

totalNo = 100;
for(var i = 0; i < totalNo; i++)
{
duplicateMovieClip (_root.image.field.imageML, "imageML" + i, i);

}

Then I want to assign a data onClipEnvent for each of MLs that are programmatically generated. Is that possible to implement? Something like this:

// this clip event will be assigned to _root.image.field.imageML1
onClipEvent(data)
{
// some code here
}

The problem is I can not phisically select the duplicated MLs then open the actionpanel to insert the code above.

Anyone has some idea about this?

Thanks

How To Flood An Area Programmatically?
Hi all,

What is the most elegant way in actionscript to flood an area?

case 1: an "L" shaped perimeter (like a bent thermometer), flooding it from one end to the other.

case 2: illustrate the before and after occupied area by an empire after an invasion (history map style)

Fun With Programmatically Generated Textfields
Has anyone ever come across a programming error or bug that would cause a programmatically generated textfield, that reads it's HTMLtext from a .txt file to do the following:

Some of the time it runs fine, some of the time the top half is fine but the rest of the text keeps going right out the side of the textfield.

This is Flash MX (not 2004, btw), and the only tags in the .txt file are <P> and </P>.

If my old programming professor saw this one, he'd probably say 'Damn, that's so far from right it isn't even wrong'. I've never come across anything like it.

Programmatically Run An OnRelease Function
Hi all.
I have the following code

PHP Code:




_root["pin"+i].onRelease = function() {
   trace(i)
}






Which is in a loop where i is incremental.

What I want is at the end of the loop to randomly choose a number and then run the on release function somthing like

_root["pin"+rndNumber].onRelease = true

Is there a way. The real function can not be made into a standalone function so needs to be in the loop

Have FLA Component But It Will Not Skin Programmatically
I have an FLA based component but I'm trying to set it up for skinning. I can do it manually, but I can not do it programmatically like:

window1.setStyle("lBarSkin", leftbarsilver);

window1 being the component instance name.

leftbarsilver being a movieclip in the library exported for as.

how do I define the skins and then how do I change them programmatically? Thanks

Any help? Suggestions? Advice? I've racked my brain on this for about 2 weeks now and don't know where else to go. Thanks.

How To Trigger Events Programmatically
I am trying to figgure out a way to trigger the soundCompleet event before it realy happens.
Can anyone help me with this?

How To Programmatically Change SWF Background
I am trying to figure out how to programmatically change the background of my pure ActionScript 3 application. I'm not using Flash (no canvas) or Flex framework. I'm building the SWF from FlashDevelop and setting the initial background in the project properties for compiling.

I have a Sprite for my main object in the display list. I have tried changing the opaqueBackground of that sprite but it doesn't have any effect. I tried to change the stage object opaqueBackground property but that produces a run time error. I tried to change parent. OpaqueBackground which confirms the sprite's parent is in fact the stage by giving the same run time error.

I am targeting the SWF for Flash 10 and testing it strictly in the Adobe Flash Player 10.

Jim Freer
http://freerpad.blogspot.com/

Controlling FLV Video Programmatically
Hi all,

I am new to Flash, and I'd like to be able to control the flash video I have imported programmatically, I just need an starting point, any article written on the subject?
Ideally I'd like to control the movement using mouse movements, but just need to know how do I access the flv video and how to change its current position or "playingheadtime" to the desired value.

Really appreciate your help,

mlin.





























Edited: 02/18/2007 at 08:55:04 PM by mamadlin

Grouping Symbols Programmatically
Hello,
I am drawing a graph that can be panned through a mask layer. I need to drag icons into the graph, and have the icons move with the graph when it is panned. So I guess I need a way to have the newly created a icons be incorporated into the graph and act as a group.

Thanks.

Programmatically Creating A ColorPicker In AS3
Has anyone else run into issues trying to import the ColorPicker class into a AS3 project. I am working an AS3 project that requires I use a ColorPicker to change colors within the project. After running into error after error from within the project I started a new project to see if I could duplicate the error:

In the new test project all I have is

import fl.controls.ColorPicker;

and I get this error everytime I publish or try to test the movie

1172: Definition fl.controls:ColorPicker could not be found.

Anyone got a clue to what's going on? I have contacted Adobe Tech Support but they were not able to help me solve the problem.

Any help would be greatly appreciated.

Thanks.

Programmatically Attach List
Hi,

I was wondering if there is a way to programmatically attach a listbox to the stage using actionscript 3?

I just have something like

var myList:List=new List()

Do I need to say "attach to the stage" in some way?

Thanks,
dub

AS3: Programmatically Fire MouseEvent
I'm using a combination of a purchased Component and SWFAddress.

The component handles its own events, but does give me access to modify how it is handled. And SWFAddress has it's own event handler as well...

What I'd like to do is create a few MovieClip "buttons" that are set up for SWFAddress, then when one of the Component items is clicked on, it tells the MovieClip "buttons" to react as if they were clicked on.

Is that possible? To programmatically fire an item's MouseEvent.CLICK ?

Or, is it possible to create a MouseEvent.CLICK object that can be a stand-in of sorts to send to the SWFAddress event handler?

Thanks,
Brandon

Change Visibility Programmatically
I need to be able to make a blue dot change to invisible at some frame. I have tried using a symbol named BD_D12, with type=movie clip (I've also tried type=button), but the following code doesn't seem to work:

SetProperty("BD_D12",_visible,"false")

I have tried putting this SetProperty action in several different frames, and cannot seem to get the _visible to turn off. Suggestions?


Programmatically Create FRadioButton Component
All - I am trying to programmatically create an FRadioButton component on the fly with ActionScript code as opposed to drag/drop.

Is this possible
(... something like 'var myButton = new FRadio();') ?

If so, does anybody have a sample code snippet of this?

Thanks

How To Programmatically Create Mx.screens.Slide?
hello,

is there a way to create a Slide object programmatically and attach it to my presentation's root slide?

I am buidling a data driven site using the MX 2004 pro screens classes and the number of slides in my presentation depends on the arbitrary external data that I read from a file.

Programmatically Set Datagrid Column Widths
I have a datagrid in my movie called summary_dg.
How would i set the column widths with actionscript?

How To Programmatically Create A Rectangular Mask
Could someone post a simple example of how to programmatically create a
rectangular mask of size x by y? I need this to be 100% ActionScript. Thank
you!!

Is There A Way To Programmatically Creage Video Objects?
I've been looking into creating a flv player, and am wondering why all the examples in the reference say "my_video is a Video object on the Stage". And video class doesn't even have a constructor. And if the parent movieclip has not method to create a new video object, then how do I create a video object?

Surely there's a better way than creating one on stage by hand.

By the way, this is further down the road, but is there a way to grab a frame from the video into a bitmapData object? Or is that one of those things everyone's willing to sacrifice their lives to get implemented.

How To Set Dynamic Label To Bold Programmatically
Guys
I have one dynamic label control in my flash application. I have set the font weight to bold during design time. But due to some reason it does not show my bold when I assign text to the dynamic label.

I belive it might show bold if I assign font weight to bold when I assign text to it during run-time.

Does anyone has idea of how to make dynamic label control to bold during run-time.

Programmatically Drawing And Tweening Conflict
I'm working on a game that involves the player drawing lines with the mouse, this and this worked happily until i wanted to a tweens. The tweens are to a completely different object altogether and adding them seems to 'turn off' the drawing. Commenting out all of the tween calls brings the drawing back. Is this something i'm gonna have to live with or is it something that i can fix?

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