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




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



Actionscript 3.0
Posted on: Tue May 06, 2008 4:51 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

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

What I have so far:


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

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

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

[AS3.0] Apply Filter To TextField Programmatically
Hi there!

I tried this using

Code:
textField.filters = [new GlowFilter()]
or just like in Flash8 passing the .filters array ref to another array and pushing filter to that array [was it?], but none of these steps worked.

Applying filter to Sprite, within which the TextField (_title) is contained:
Code:
var tit:Sprite = new Sprite();
tit.addChild(_title);
tit.filters = [new GlowFilter(0xFFFFFF,1,5,5,2,2)]
addChild(tit);
worked, however this method (using extra sprite for a textfield) is just too dirty, let alone we want to apply filters to multiple textfields..

Anyone knows how to apply filter directly to TextField instance in AS3.0?

Thanks!

Apply 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 A Bitmap To Lines
hi, i want to apply a bitmap at runtime to a series of lines, similar to the beginBitmapFill function (which seems to only work on shapes, not on lines). Any ideas how to do this?
The lines are the only objects in my movieclip, if that helps to find a solution. So far, i think that i might achieve this with setMask() or blendMode(), but i have yet to try that.

Apply Bitmap To Sprite
I am completely new to AS (but not programming). Forgive me in advace for I am not sure what to search for. If this has been covered I apologize.

My question:

I would like to set an image as the background to my flash app.


Here is what I am trying to do:


ActionScript Code:
[Embed(source="images/backgroundimage.gif")]
private var backgroundimage1:Class;
private var backgroundImages:Array = [backgroundimage1];
//Eventually, I will be adding additional images to this array

var backgroundimagebitmap:Bitmap = Bitmap(new backgroundImages[Math.floor(Math.random() * backgroundImages.length)]);
//here I am just simply getting a random image (using this for simplicity at this point)

var backgroundbitmapMaterial:BitmapMaterial = new BitmapMaterial(backgroundimagebitmap.bitmapData);
           
stage.scaleMode = StageScaleMode.NO_SCALE;
var backgroundSprite:Sprite = new Sprite();

           
backgroundSprite.graphics.beginBitmapFill(backgroundbitmapMaterial);
//Here is my error.  I cannot use backgroundimagebitmap or backgroundimageMaterial
//I am leaving this in to demonstrate what I *want* to do
           
backgroundSprite.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
backgroundSprite.graphics.endFill();
           
           
           
addChildAt(backgroundSprite, getChildIndex(viewport));

Thank you in advance for your help.

Jason

'flatten' Blur Filter? (to Bitmap)
Hello, is there a way to render a movie clip to a bitmap once a filter is applied, to the Same movie clip?

i have a clip on stage, a blurfilter is applied:

treeHolder.tree.filters = [bf];

i want to simply apply the blurfilter, then as soon as it is applied, just flatten the image, or convert that MC to a bitmap.

i have been playing around w/ a senecular code that copies a bitmap representation from one movie clip to another, but i want the blurred bitmap to just replace the current vector mc.

thanks for any help.
q

How To Get The Width Value After Applying A Glow Filter To Some Bitmap?
here's a code section:


Code:
trace(bm2.width); // 50
var glowFilter:GlowFilter = new GlowFilter();
bm2.filters = [glowFilter];
trace(bm2.width); // 50
Why the second output is still 50? It shouldn't have calculated the glow's width within?

Thanks for any tips!

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?

Apply Css Style To A Xml Data In Flash 2004
Hello,

I`d like to know if it is posible to apply css style to a XML data in Flash 2004.


My code:

System.useCodepage = true;
var meuXML:XML = new XML();
meuXML.load("iniciando1_xml_css.xml");
meuXML.ignoreWhite = true;
meuXML.onLoad = function(){
var format = new TextField.StyleSheet();
var path = "estilo1.css"
var one = this.childNodes[0].childNodes[0].attributes.id;
format.load(path);
format.onLoad = function(loaded) {
if (loaded) {
texto1.styleSheet = format;
texto1.text = one;
} else {
output.text = "Error loading CSS file!";
}
}
}

Now I want to do something like this to apply the CSS:
var one = "<p class='negroB20'>this.childNodes[0].childNodes[0].attributes.id</p>";
But it will not display the content of the node. It will display this.childNodes[0].childNodes[0].attributes.id like an expresion.
What should i do?

Thanks :-P

Gianna

Apply Css Style To A Xml Data In Flash 2004
Hello,

I`d like to know if it is posible to apply css style to a XML data in Flash 2004.


My code:

System.useCodepage = true;
var meuXML:XML = new XML();
meuXML.load("iniciando1_xml_css.xml");
meuXML.ignoreWhite = true;
meuXML.onLoad = function(){
var format = new TextField.StyleSheet();
var path = "estilo1.css"
var one = this.childNodes[0].childNodes[0].attributes.id;
format.load(path);
format.onLoad = function(loaded) {
if (loaded) {
texto1.styleSheet = format;
texto1.text = one;
} else {
output.text = "Error loading CSS file!";
}
}
}

Now I want to do something like this to apply the CSS:
var one = "<p class='negroB20'>this.childNodes[0].childNodes[0].attributes.id</p>";
But it will not display the content of the node. It will display this.childNodes[0].childNodes[0].attributes.id like an expresion.
What should i do?

Thanks :-P

Gianna

Filter XML Data For Text Fields.
Hi,

I'm trying to display a single record out of an XML database into dynamic fields in my MovieClip. I need to be able return a single record based on the current time. Attached is a sample of my XML data.

I was wondering if this could be acheived with a DataSet filterFunction? If it is possible, what code would I need to include?

Finally, do I need to pass my full DataSet to an array or do I need to filter first & then pass to an array?

Thankyou.

Elton Bernardson.










Attach Code

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gigs>
<gig>
<date>23/06/2007</date>
<title>IBM Dealers Conference</title>
<displayStart>09:00</displayStart>
<displayFinish>13:00</displayFinish>
<displayTimes>10:00 am - 12:30 pm</displayTimes>
<logoPath>D:
oot_pathlogosibm_01.jpg</logoPath>
</gig>
</gigs>

Filter XML Data For Text Fields.
Hi,

I'm trying to display a single record out of an XML database into dynamic fields in my MovieClip. I need to be able return a single record based on the current time. Attached is a sample of my XML data.

I was wondering if this could be acheived with a DataSet filterFunction? If it is possible, what code would I need to include?

Finally, do I need to pass my full DataSet to an array or do I need to filter first & then pass to an array?

Thankyou.

Elton Bernardson.









Attach Code

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gigs>
<gig>
<date>23/06/2007</date>
<title>IBM Dealers Conference</title>
<displayStart>09:00</displayStart>
<displayFinish>13:00</displayFinish>
<displayTimes>10:00 am - 12:30 pm</displayTimes>
<logoPath>D:
oot_pathlogosibm_01.jpg</logoPath>
</gig>
</gigs>

Looking To Filter XML Data Displayed In A Datagrid Or Out From XML Connector
I am not using a dataset and would like to just sort based on the results. For example, I have an array named "RCAF" and one named "WKB". I only want the grid to show the results with array name "RCAF". Any ideas or tips on this would be a HUGE help.

Thanks again,

Dave

Creating A Product Selection/filter/data Visualisation
Hi all,

Could someone please point me to any tutorials or files on how to create a filter/scrollbar/product selector that helps the user select things on screen by eliminating options based on whether or not they fit a certain criteria.

An example of what I mean is at

http://www.iokio.com/demos/camerafinder/


I just need a few criteria, see how you can move the bars to eliminate cameras that are not in the criteria.


Any help would be appreciated.

Flex How To Use Multiple Checkbox Selections To Filter Xml Data & Populate The Datagrid?
hi,
i am using adobe flex builder 3 to build a simple tool that lets user to extract data according to his needs .i have an xml file that contains information about plants. i have reached a stage where the user interface is ready. i have 4 vertical boxes each with its own set of checkboxes.when i check on one or more of the checkboxes(verticalbox-1), it gives me the result. but it doesnot take into account the other checkboxes selected in the other vertical boxes.I dont know how to proceed further...that is when i select the checkboxes in the other 3 sets of vertical boxes, how to get the data in the datagrid corresponding to the selection made.... a vry important point to be noted is that the user can make any no of selections in the checkboxes in any vertical box, the data satisfying the selection should be displayed in the datagrid. I am attaching the xml file and the mxml file..pls help me solve the issue

Possible With Bitmap Data?
Hi,

Is it possible to load an image into a BitmapData object and then use mcs as "cookie cutters" to copy the image below them (So if the mc is a circle, you would sample a circular section of the image) and use this copy to generate a movieclip of the copy?

Don't need to know the details, just if possible and a hint as to how.

Many thanks.

Bitmap Data
Hi,

If I duplicate an Mc containing a bitmapData instance, should I be able to see the instance in the duplicate?

Thanks

Bitmap Data
hello;

I have realized that I have never seen bitmap data before; I suspect that bitmap data is a list of name/value pairs such as:

pixel(xx,yy) => rgb(rrr,ggg,bbb);

I would think that it should be possible to view the bitmap data in a text editor;

any thoughts?

dsdsdsdsd
Asheville NC USA

Bitmap Data Help (AS2)
Hey guys, looking for some help in using the bitmap data class to take a "screenshot" of an area on the stage. Any help guys?

Bitmap Data
I'm using Flash 8, with this code in the first frame:

import flash.display.BitmapData;

rissa._x=Stage.width/2;
rissa._y=Stage.height/2;


var plaid:BitmapData.loadBitmap("plaid");

function fillBG(){
this.beginBitmapFill("plaid");
this.moveTo(0,0);
this.lineTo(Stage.width,0);
this.lineTo(Stage.width,Stage.height);
this.lineTo(0,Stage.height);
this.lineTo(0,0);
this.endFill(0,0);
}

var StageL:Object=new Object();
StageL.onResize= function(){
fillBG();

rissa._x=Stage.width/2;
rissa._y=Stage.height/2;
}
Stage.addListener(StageL);

When I publish the file, I'm getting the following error message in the Output panel:

**Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 7: The class or interface 'BitmapData.loadBitmap' could not be loaded.
var plaid:BitmapData.loadBitmap("plaid");

Total ActionScript Errors: 1 Reported Errors: 1



Any answers to why this error message is appearing? Any assistance is immensely appreciated....

[F8] Compressing Bitmap Data
Hi,

Has anyone ever had experience with 'compressing' bitmapData using Matrices (or any other methods)? I've read that its possible by using 'Base 32', but I have no idea how to actually carry it out and can't find any information on it.

Basically I have an image that I convert to bitmapData and then send to a php script for processing...but its quite slow due to all of the data being send to the file (it sends one 'row' worth of bitmapData from the image to php at a time)...and want some way of compressing all of that data to send it to php quicker (and reduce bandwidth).

Any ideas? or know of any resources that could help me out?

Thanks!
-b.

Alpha Bitmap Data
Ok I have a movieclip that I am importing to my class...then inside the class I get a bitmapData object to .draw() the movieclip. Now I am splitting this movie clip into chunks into an array. How do I keep the alpha data associated to the movie clip?

BitMap Data Not Showing
Hi,
this seems to be a bug in Flash, when attaching bitmap data to a movie clip, it displays locally, but once I put the swf on a server, the bitmap doesn't diplsay at all... any ideas? Here is my code:


Code:
var myBitmap = new BitmapData(50, 50, true, 0x00FFFFFF);
//mc is a movie clip containing an image
myBitmap.draw(mc);
var clone = _root.createEmptyMovieClip("clone",1);
clone.attachBitmap(myBitmap,1, "auto", true);
Thanks,

Joseph

Bitmap Data... Weird
Hi there.
I hope someone will be able to answer me.
Could you check this swf or fla (those are sample to show you what's weird)

What happen so.

I'm drawing on a MC (line) a black line, 5px thick, using lineTo(0, 100);
I'm copying this image on the BitmapData object (myBMP.draw(line));
I'm clearing the MC (line).

I'm redrawing on the MC (line) a white line, 5px thick, using lineTo(0, 100);
I'm copying this image on the BitmapData object (myBMP.draw(line));
I'm clearing the MC (line).

the result?
I can still see the black line underneath. I mean just the border of it... How come ?

If you're zooming and clicking several time on the draw second line you will see something more weird... Anyway for me...
Any help appreciated

C ya mates

Trouble With Bitmap Data
Hello,

I am loading external images and then would like to make bitmap data objects from then. Below is the code I am using.

It works fine is I make a bitmap data of something already on the stage, but not the images that I am loading in.

Any ideas?

Code:
for (i=0; i<1; i++){
//attach new item
content_mc.attachMovie("introduction", "page"+i, itemDepth);
content_mc["page"+i].title_txt.htmlText = page.childNodes[3].childNodes[1].firstChild.nodeValue;
// builds page
howManyRolls = introAssets.childNodes.length;
for(j=0; j<=howManyRolls; j++){
tmc = content_mc["page"+i]["image"+j+"_mc"].imageHolder_mc;
//trace(tmc);
oListener.onLoadStart = function(mc:MovieClip){
this["bitmap"+j] = new BitmapData(300, 500, true);
this["bitmap"+j].draw(content_mc["page"+i]["image"+j+"_mc"].imageHolder_mc);
_root.attachBitmap(this["bitmap"+j], _root.getNextHighestDepth(), "auto", true);
}
oListener.onLoadProgress = function(imageLoader, nLoaded, nTotal){
//trace(imageLoader+" loaded "+nLoaded+" of "+nTotal+" bytes");
}
oListener.onLoadComplete = function(){

}

imageLoader.addListener(oListener);
imageLoader.loadClip(introAssets.childNodes[j-1].childNodes[0].firstChild.nodeValue, content_mc["page"+i]["image"+j+"_mc"].imageHolder_mc.imageInside_mc);
}
}

Bitmap Data Limit
Quote:




The maximum width and maximum height of a BitmapData object is 2880 pixels.

LiveDocs




What if you need more than this?

Bitmap Data Question
I want to take screen capture of the stage. And convert it to a bitmap image.

I can do it with a movie clip as follows
var jpgSource:BitmapData = new BitmapData (p.width, p.height);
jpgSource.draw(p);


var jimo = new MovieClip();
var bmp:Bitmap = new Bitmap(jpgSource);
jimo.addChild(bmp);
addChild(jimo);

but I want all the display objects on the stage????

Any advice

Jim

Bitmap Data + Drawing API?
I'm trying to do a Flash paint app that uses some fairly complex glows and blurs. Naturally as you continue to draw, the framerate starts to drop because redraw region increases.

So what I want to do is have the user draw, and when they release the mouse button, it uses bitmap data to capture what they've drawn with the glows and everything already applied. It then clears out the movie clip with all the vector lines they've drawn, but they can continue to paint. Releasing the mouse button again just recaptures the canvas as bitmap data with the new shapes.

The problem I'm having is that instead of adding the new stuff they've drawn to the old bitmap, it just replaces the bitmap entirely. It just seems to be overwriting the old bitmap. I was under the impression that you could, in a sense, take a snapshot of the new shapes on top of the old bitmap and create a new bitmap with everything. I can't get this to occur.

Does anyone have any suggestions on how I should approach this? And did what I write even make any sense?

Problem With Bitmap Data
Ok so I'm having problems with the bitmap data class. I am creating a marquee of images and duplicating them using the draw method. This works fine locally, but when uploaded it does nothing. I figure it has something to do with the fact the I have all my media on a separate server, but I thought I had all the security settings right to have it work. I have the domain allowed in the security settings. I have the cross domain policy file in place on the media server and loaded. Any ideas? Right now I have it jury rigged using the load clip method, but if someone leaves their browser on the page the flash with just eat bandwidth.

Compressing Bitmap Data?
hi does anyone know if it is possible to compress bitmap data before sending to server? its going to cause massive issues:| thanks in advance

Problem With Bitmap Data
Arrggggg can anyone help with this one.

I am loading in images which all works finein authormode in flash. However when i place it on our lan it doesnt seem to render the images at all. replacing them jsut with white. I am using bitmapdata which seems to be where the problem is, as if i just laod the images direct it works fine. Has anyone experienced something similar?

regards

ade

Bitmap Data Blues
Hello,

I'm hoping someone can help me with the following dilema I'm having...

I'm trying to work with:
"import flash.display.BitmapData;
import flash.geom.Rectangle;
import flash.geom.Point;"

I want to have an image where the pixels, (maybe 10px x 10 px) fly in or maybe fall in to recreate the original bimap image, captured by the BitmapData function. I know the image can be taken apart by pixes, but am having trouble "controlling" them to do what I'm trying to achieve. Has anyone had success with this??

Here's an example of what I mean by the pixels being broken apart and coming together again. Sorry in advace that it is a poor example.

www.redfield.us/bitmapdata_effect.swf

Thanks!

Suz

For Those Experienced With Bitmap Data
How do you change the coordinates of a bitmap data object? IE, not the holder that is displaying the BMD, but the BMD itself.

I have an example here, 3 bitmap data objects, with their holders lined up next to each other on the stage, now I want to be able to draw on each one individually, with the same drawing MC. However, the drawing MC simply draws on all 3 simultaneously.

What can I do on this test to get all 3 bitmap datas to draw when the mouse is over them, BUT, with the same drawing MC, not 3 seperate ones.

Cheers,
Joe

Working With Bitmap Data In As2
i created a gallery using bitmap Data. on my computer every thing works fine
when i upload it on the server it doesnt work properly on IE7 and 6 and on FF it works ok after i reload it a few times.....
what i have is a dynamic thumbnail strip which i load with an XML file. into a movieclip named thumbs in order to put a mask on it .
when i press one of the buttons the flash goes to that frame where i activate the next function:

Code:
var yLoc = 0;
var currentCatMain = 0;
loderFun = function (currentCat) {
currentCatMain = currentCat;
for (i=0; i<this["path_thNmame"+currentCat].length; i++) {
this.createEmptyMovieClip("holder_mc"+i, this.getNextHighestDepth());
this["loader"+i] = new MovieClipLoader();
this["loader"+i].addListener(this);
this["loader"+i].loadClip(this["path_thNmame"+currentCat][i], this["holder_mc"+i]);
}
};
//this function is called by the 'loader' object when the file is loaded and ready to use
function onLoadInit(i) {
m = i._name;
m = m.slice(9, 10);
this["myBitmap"+m] = new BitmapData(this["holder_mc"+m]._width, this["holder_mc"+m]._height, true, 0x00FFFFFF);
this["myBitmap"+m].draw(this["holder_mc"+m]);
this["holder_mc"+m].removeMovieClip();
this.thumbs.createEmptyMovieClip("targetClip"+m, this.getNextHighestDepth());
this.thumbs["targetClip"+m].attachBitmap(this["myBitmap"+m], 1);
this.thumbs["targetClip"+m]._xscale = 100;
this.thumbs["targetClip"+m]._yscale = 100;
this.thumbs["targetClip"+m]._x = 0;
this.thumbs["targetClip"+m]._y = yLoc;
spaceAndWidth = this.thumbs["targetClip"+m]._height+4;
yLoc += spaceAndWidth;
}
//this function is called by the 'loader' object if the file couldn't be loadd
function onLoadError() {
/*

The external file failed to load so we don't need
the holding movieclip anymore

*/
holder_mc.removeMovieClip();
}
what happens with the server is that i see each picture for a second and then it dissapears....

i have no idea why? here is the link

Placing Bitmap Data
My question is this:

Since you cannot use the smooth command on dynamically loaded JPG or any pictures. I have use the bitmapData class to redraw this jpg and use the smoothing option in that class.

Everything to this point works fine.

I am resizing the background to fit the fullscreen stage width and height with some kind of tween.

Again everything works to this point.

This is what im trying to accomplish:

I want the picture that is making the background to resize form the center of the stage and not the default (0,0) coordinates.

I have to reposition the bitmap.draw movieClip to the center of the holder and than resize that holder or so I thought...so far no luck.

I have try using the geom.rectangle class to adjust it again no luck...

any of you have any ideas?

I cannot pos any codes snippet due to company policies but maybe some of you have run into a similar problem

Thanks.

Bitmap Data Class
G'day People

I seem to be here every 10 minutes.
I am getting this error:-

The class or interface 'flash.display.BitmapData' could not be loaded.
var myBitmapData:BitmapData = new BitmapData(540, 400, false);

I am calling - import flash.display.BitmapData

Can someone explain what is happening.

thanks easy

[F8] Bitmap Data - Darker Than Png File ?
Hi Flashkit section Actionscript.

I have a strange issue with BitmapDatas.
I load external sheets which are stored in .png files and I want to remove their background color using Bitmap.treshold. The background color is 0x(FF)666666

The problem is that my threshold myFaceBMP.threshold(myFaceBMP, new Rectangle(0, 0, 32, 32), new Point(0, 0), "==", 0xFF666666, 0x00000000, 0xFFFFFFFF, true); wont work.
However, I found out the reason why by taking a screenshot of my running swf. For some reason, the 0x666666 is not displayed as 0x666666 but 0x656565 and that's why it wont disappear. If I set the parameter in threshold to 0x656565, it disappears (but the file contains 0x666666 !).


Has anyone encountered such a situation before ? Is there anyway to render the colors as they should be ?

Thanks for reading ^^

Bitmap Data Particle Effects
Hi, I was looking at Keith Peters' blog and found a really neat little thing...

http://www.bit-101.com/blog/?p=1152 (there is a link below the picture to see the swf)

Anyways, I set out to try and make a similar effect on my own. It was all working very nicely until I brought my test value of 30 particles up to 500.
His has 1000 and is not at all lagging behind whichever framerate he used. Mine was severly bogged down with 500.

Upon closer inspection of the particles, I found that they were still being drawn as vectors, rather than single pixels. I have set cacheAsBitmap = true for each, and still it doesnt work.

Can anyone point me in the right direction?

Any help would be greatly appreciated,
Mavrisa

BitMap Data From A Loaded Image
Just playing around with BitMap Data.

I was wondering, since I couldn't find it, how do you get the pixel information from an externally loaded Image?

Thanks.

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