Flex :: Creating Dynamic Class For Bitmap Containing BitmapData From SWC?
Jun 1, 2011
I have the following code
///Get BitmapData from library in SWC
var ClassReference:Class = getDefinitionByName(products[i].producticon+"Data") as Class;
// Create new BitmapData Instance From it
[Code]....
I get null in the trace. How do I make a dynamic class that I can refer to for this bitmap similar to how your reference a class from and embedded media?
View 1 Replies
Similar Posts:
Mar 29, 2010
I am using bitmapData and bitmap classes to render a mouse cursor on the display screen. The bitmapData consists of an area whose colors should be inverted according to the background color. This is a very basic thing which could be observed with text cursor(the vertical line with two small horizontals on top and bottom), when moved over the text area. want to be able to do the same with the pixels in my bitmapData, is there a way to find out the background color effectively and invert the color values? In this process i will be redrawing the whole pixels, is there any other efficient way to do that ?
View 1 Replies
Sep 29, 2010
In Flex, how does one hook into a bitmap or bitmapdata variable so that a function is notified whenever the bitmap's data has changed (pixel has changed, or filter's been added)?
There must be a way to do it, because I can bind an mx:Image to a bitmap via the 'source' attribute, and the displayed image updates all the time when a I modify the bitmap. How does flex do it? Does it blindly redraw the bitmap at every frame, or is it smart and only redraws when the bitmap changes? If so, how does it know when the bitmap changes?
View 1 Replies
Nov 5, 2009
I'm trying to make an scratch lottery ticket in as3 by using the bitmapData class. The scratch function is working fine, but I want to add an function that is challenging. When 75% of the lottery ticket surface is scratched of I want to trigger an event.
My ActionScript Code:
var toolsize = skraper_mc.width;
var tooloffset = toolsize/2;
var basepoint = new flash.geom.Point(0,0);
var bitmap:Bitmap=new Bitmap();
[Code] .....
View 4 Replies
Feb 3, 2009
I'm cutting my teeth in actionscript 3 on a game that has a character running through a world. So, I have set up my Hit Testing by using the bitmap data hit test method, since I figured my world is going to be destructible - it'd be nice to update the level and then redraw it and have the character interact with the new change. (That works beautifully) I am however; a bit confused as to how I have my hit Testing set up. I've been messing around with it, and it works for now - but I'm not sure why.. currently, I have a character set up by using a class I built and using a series of animations I created. So, this character has a walking and falling animation, etc. This is a movie clip.
Then there's a bitmap 'emptyBitmap' with bitmap data created - however; I never really added this as a child to the character. This is sized to the dimensions of my character. My level is created as a movielip, then it's drawn to a bitmap - when the level movieclip is changed, the bitmap redraws, and that's how this updates.
[Code]....
View 1 Replies
Aug 20, 2009
I know the topic of "duplicating" movieclips is a hot issue with the new virtual machine. Luckily, I understand the implications. I only am [currently] interested in duplicating a Bitmap. See, I load an image from an URL using 'flash.display.Loader.load', which is a non-blocking operation in Flash Player.However,I may use multiple copies of the loaded image (which is reported to be a Bitmap, naturally) in the display list at the same time.Hence, I naturally do not want to load the image from an URL every time, because I don't want to wait for a non-blocking call to complete. Nor do I need to - I mean one copy is already loaded, so it should be possible to just "duplicate" it, right?
My idea is to do use the bitmapData property of a Bitmap and pass it to the constructor of a new Bitmap object. I have not tried the following in action, but I want to hear whether any of you did and if the following would not work, what would:
Code:
var original_bitmap: Bitmap;
var copy_of_original_bitmap: Bitmap = new Bitmap(original_bitmap.bitmapData);
LiveDocs mention that the BitmapData being passed to a Bitmap constructor is "being referenced", which to me might suggest it cannot be used twice? There is also the BitmapData::clone() method, which I am not sure is applicable here or not.I know this is a lot of talk instead of just trying this out, but I test so much Flash Player code daily just to see "what works" (which should be documented instead by Adobe),
View 4 Replies
Jan 31, 2007
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;[code].....
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
View 8 Replies
Aug 13, 2009
I'm working on a particle emitter, and I want to be able to pass in custom sprites (one for smoke, one for fire, et cetera). They are instanced on in the library as separate classes, but I want to be able to call a function like, "ParticleEmitter.SetSprite(Smoke)", then have it start creating instances of the smoke class.
The problem is, I don't know how to pass in a class name as an argument or how to use it to create copies. Is there any way to do this, or would it be best if I just put all my different particles inside a MovieClip and set the frame for each one it created?
View 6 Replies
Sep 14, 2010
I need how to cut bitmap from bitmapdata.
View 2 Replies
Sep 11, 2011
How to remove the bitmap from the holder and the bitmapData from the Flash Player memory?[code]
View 2 Replies
Aug 27, 2010
i'm writing simple image editor. I want to allow user to change contrast, brightness ect and save file as jpg. I got 2 problems.
1. I apply filters to bitmap and when I save it, it saves only original image without filters.
ActionScript Code:
var bitmapData:BitmapData = Bitmap(source_image.content).bitmapData;
var bmp:Bitmap = new Bitmap(bitmapData);
bmp.filters = combineFilters();
combineFilters function gives a set of ColorMatrixFilters to change contrast and other stuff.
2. When I encode a JPG with a as3corelibrary it makes it very slow (over 20 sec for img) and freezes app. Is there any way to aviod this?
View 0 Replies
May 8, 2009
what i need to do is basically a motion trail on a bitmap.
I want to continuously draw a bitmap onto itself while previous versions are faded into the background, similar to a smoke type effect.
View 1 Replies
May 14, 2011
I am writing a screen scroller for a game I'm making. There's a BitmapData object which holds the background graphic, yet I do not want to show/render it on screen all at once.
For example, I want to show only a 500x500 section of the data but the entire BitmapData is 1000x1000. I wanted to use the scroll() method to scroll the data but my problem is that I cannot restrict how much of the BitmapData is drawn on the Bitmap. I tried setting the height/width properties of the BitmapData to 500x500 (and draw all the 1000x1000), but any data drawn beyond the boundaries I defined is not really drawn.
Another option I considered is to store a different BitmapData object which holds the entire data, and then use copyPixels() from it to the one used on the Bitmap itself, although then I cannot use scroll() and have to use different methods to achieve scrolling.
View 4 Replies
Oct 29, 2008
I want to be able to crop an image based on what is viewable through the mask and then saved that cropped image out to a new file. I'm not exactly sure how to do this though
View 3 Replies
Jun 28, 2007
I've been looking for a solution for hours now. I have a movieclip which contains an image. Created by doing: put image on stage, convert to symbol, movieclip type, ok.I'd like to extract this bitmap because I want to use (somewhere else): graphics.begintBitmapFill(); but this method needs a BitmapData object and not a movieclip to create a repeating background (in my case).
So: how do I extract the Bitmap or the Bitmap data from a MovieClip?mind that attaching BitmapData as a base class to this symbol is NOT AN OPTION
View 11 Replies
Jul 16, 2010
What i want to do is get a png from my library load it into bitmapData then into bitmap then onto the stage.I don't even have enough success here yet to have code to post. Please for the LOVE of Mike!
View 5 Replies
Mar 31, 2009
In Flash, the BitmapData object can be used to store bitmaps in RAM, you can later draw them to a MovieClip using the beginBitmapFill() method.
How do you load an external bitmap file (.jpg) into a BitmapData object?
View 5 Replies
Dec 22, 2009
I have a class that loads an image and offers you the ability to have it in a bitmap or bitmap data object available after the image has loaded. But when I try this:
[Code]....
View 2 Replies
Feb 17, 2010
I have a small bitmap, and it's one that's going to be scaled to be much larger then added to another bitmap. So I have the bitmap and I changed to width to make it larger, then when I use copyPixels to place this bitmap onto the main bitmap the image added is the original bitmap, not with the width changed. How can I make it reflect the changes?
View 3 Replies
Mar 1, 2010
1: I upload an image
2: Without altering it,I make a copy of it and use it display to users in resized format
note: I won't display the original image.
3:Now when user deletes the resized image,i need to delete the image loaded as bitmap i.e. the original image which i won't be displaying
For that I used bitmap.bitmapData.dispose() method.But,it doesn't free up the memory taken by the bitmap.For instance at initial state the memory usage is 58 Mb and upon loading 3 images the size increases to 87 Mb.And when I delete all the images the size decreases to 81 MB only.
View 6 Replies
May 2, 2009
I am trying to use the bitmapData.setPixels method to set certain pixels in the bitmap transparent.But no matter what I do, it always seems to set the pixel(s) black (non-transparent).Here is my code:
[AS]
bmpd = new ImageFromLibrary(0, 0);
bmpd.setPixel(0, 0, 0x00000000);
[/AS]
why its not setting the pixel(s) transparent?
View 4 Replies
Jun 6, 2010
This is my scenario
1: I upload an image
2: Without altering it,I make a copy of it and use it display to users in resized format
note: I won't display the original image.
3:Now when user deletes the resized image,i need to delete the image loaded as bitmap i.e. the original image which i won't be displaying
For that I used bitmap.bitmapData.dispose() method.But,it doesn't free up the memory taken by the bitmap.For instance at initial state the memory usage is 58 Mb and upon loading 3 images the size increases to 87 Mb.And when I delete all the images the size decreases to 81 MB only.I feel the loaded bitmap is not completely removed.
View 9 Replies
Jun 16, 2010
Using Actionscript 3 is there a way to search one bitmap for the coordinates matching pixels of another bitmap?
[URL]
Somehow you would have to loop through the bigger bitmap to find and the the pixel range that matches and return those coordinates. For example the Bitmap with the "E" is 250 pixels over and 14 pixels down in the bigger bitmap.
View 2 Replies
Jan 29, 2007
I've started getting to grips with using the BitmapData class and a Transformation Matrix in the hope that I can start making some interesting image effects. However, at the moment Im having trouble figuring out how to shift the newly created bitmap so that any scale transformations are applied from the center rather than the top left corner. See here for example: [URL] The flower on the left is the original, the flower on the right is the new image created using "bitmapData.draw()". It has been scaled up to twice the size, but I want this to happen from the center of the image.
[Code]...
View 5 Replies
Jul 15, 2009
I'm currently working on a flash game and I need to know how to addChild a BitmapData or draw a BitmapData to screen. If I can't than how can I give a DisplayObject my BitmapData?
View 2 Replies
Dec 26, 2011
So if i have a bitmap in a mc that doesnt animate (because i write directly into the bitmapdata) can i use CACHEASBITMAP?
View 3 Replies
Sep 27, 2011
I am using the floodfill method to colour-in sections of a bitmap image. That part is easy enough but the issue comes in with the way I am adding an effect to the colour fill routine.
To add the effect, first a copy of the bitmap data is created and floodfill is used on that instead of the original bitmap. Then the bitmapdata.compare method is used to set the alpha value of everything apart from the filled-in section to 0 and the result is saved in another bitmapdata. After that, a 1 px radius circle sprite is added to the stage and is being tweened to the image dimensions and its mask is set to the sprite which contains the result of the compare operation.
This works perfectly except for the fact that the fill sprite has to be tweened to the complete image dimensions irrespective of how small the area is being coloured-in since I am not able to find a way to get the dimensions of the fill area. I am doing an bitmap image update at the end of the tween and I have to disable user interaction till the tween is complete to avoid the errors which come in if another fill-in operation is started before the base image has been updated. If I could somehow get the dimensions of the fill area then the time during which I have to disable the user interaction will go down considerably.
View 3 Replies
Oct 11, 2011
This is my array collection
[Bindable]private var Projects:ArrayCollection = new ArrayCollection( [
{ Department: "Software", TotalProjects: 73,Completed:30,Inprogress:30,Approved:13},
{ Department: "XML",TotalProjects: 50,Completed:20,Inprogress:20,Approved:10},
{ Department: "Publishing",TotalProjects: 25,Completed:5,Inprogress:10,Approved:10},
{ Department: "Indesign", TotalProjects: 70,Completed:30,Inprogress:30,Approved:10},
{ Department: "Imaging", TotalProjects: 42,Completed:30,Inprogress:10,Approved:2}]);
[Code]...
how can i create mx:LineSeries dynamically depending upon array collection values. Now only 4 line series is there but some times i have to show more as per the array collection values change ex: if one more status HoldProject added to array collection?
View 1 Replies
Jan 19, 2011
I'm having problems creating dynamic tabs here's my code:
[Code]...
View 1 Replies
Oct 17, 2009
I'm trying to modify the alpha layer of a bitmapData by taking a source iamge and masking out areas that don't have the correct channel. ATM I'm using copyChannel to achieve the effect, but I'd liek more than 3 channels (use alpha kills the other channels it seems). 255, 0, 255 should be able to act as another mask.
This is what I'm doing now...
Code:
bitmap.bitmapData.copyChannel(tempMask, new Rectangle(0, 0, tempMask.width, tempMask.height), new Point(0, 0), BitmapDataChannel.RED, BitmapDataChannel.ALPHA);
So the red parts of the image mask out the source image. All I want is to be able to mask out things basic on multiple channels (the lesser of the 2).
1) How does copyChannel work? Can I just test each pixel manually and achieve relatively similar speeds? and 2) if the Flash inline functions are infact faster, is there a function that can do what I want, or would it be better to use a shader?
Code:
var tempBitmapData:BitmapData = new BitmapData(tempMask.width, tempMask.height);
var matrix:Array = [];
matrix = matrix.concat([0, 0, 0, 0, 0]); // red
matrix = matrix.concat([0, 0, 0, 0, 0]); // green
[Code].....
View 1 Replies