Actionscript 3 :: Simpliest Way To Get Jpg From BitmapData?
Apr 19, 2011I need to convert bitmapData grabbed from movie clip to jpeg or png. Is there some lib for that?
View 4 RepliesI need to convert bitmapData grabbed from movie clip to jpeg or png. Is there some lib for that?
View 4 RepliesI'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
I am trying to use the reflect class from "http://pixelfumes.blogspot.com/2007/03/reflection-class-v3-with-source .html" but I keep getting this error:
ArgumentError: Error #2015: Invalid BitmapData.
at flash.display::BitmapData()
at Reflect()
at Site_fla::GalleryPage_29/loadThumbs()
at Site_fla::GalleryPage_29/sortXML()
[Code]...
btw, first I used assigned thumbContainer as the mc argument (outside the loadThumbs() function) and it worked but not exactly what I wanted... because I thought it is supposed to update when the movieclip is animated but it actually didn't... when I use a scroller, only the thumbs that are first loaded to the stage get the reflection..
I've been using BitmapData.copyPixels() to draw graphics onto a canvas (Bitmap).I need to rotate the resulting graphics without the use of draw() because it's vastly slower.How can I rotate the target graphic? I'm assuming that there might be a formula or library that I can use which will first reorganize the pixels that make up a graphic based on an origin (point) and radians.I'm pretty certain that I'm not capable of creating such logic, so if there are any known libraries that do this, that would be awesome.I'd like to achieve something similar to XNA's SpriteBatch.Draw() method, which accepts rotation as its 5th argument.
View 3 Replieshow to use the bitmapData collision method. Now I'm trying to figure out if there is a way to see at what angle or coordinate of the bitmapData the collision happens? I need it in order to figure the accurate bounce angle after the collision occurs.
View 2 RepliesI'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 RepliesI've made a mobile version of my software, with low-res images and such, and I can now fully buffer all my content (including a 360 frame animation which is buffered to memory). Problem is, that everytime I update the view, more memory is used.When I write image = new BitmapData();, does it store the previously created BitmapData's in memory? Do I have to flush the memory somehow before I draw my second picture in BitmapData?Example:
ActionScript Code:
// In this example I draw using the same bitmapData several times, also
//overwriting the first image. Do I have to somehow delete the data first, to
[code].....
I am having an issue with using BitmapData.draw(stage). I am getting the following error:
SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: file:///C|/Documents%20and%20Settings/bla...bla...bla.swf cannot access null. No policy files granted access. Here is a portion of my code:
var bd:BitmapData = new BitmapData(2800, 2100); bd.draw(stage);//this is where the error happens All of the files referenced (.xml/.jpg/.swf) are located in the same local folder as the main .swf. How do I get around this error? The main objective is to print the stage using PrintJob(). I am using Flash Professional CS5.5 and publishing to Flash 10.0/10.1. Let me know if I need to supply any more info.
The title might be a little misleading. Look at my code and I will explain
public static function loadTile(tileDir:String = "empty"):void
{
if(tileDir != "empty")
{
tPoint = new Point(0,0);
tRect = new Rectangle(0,0,30,30);
[Code]...
I am trying to do tiling with sprites. I want my tiles to be interactive, so that is why I am using the sprite object instead of using regular bitMaps to represent my tiles. You might be wondering why I wouldnt just use graphics.beginBitmapFill(tImage); and graphics.drawRect(0, 0,tWidth ,tHeight ); to pick out the tiles I want to use. Well reason being is because it turns out that drawRect() first and second parameters actually alter the location of where the actual sprite sits at.
So if I set the x and y properties of the sprite to x = 20, and y = 20. then I set my drawRect(20,20). it actually adds an extra 20 pixels to my x and y coords of my sprite. And I know the reason why, I just need to know a better way.
So due to my lack of time to research this and my strong curiosity for the matter:Does anyone know of any publicly available classes or ways to convert an array of BitmapData to a video format ByteArray (going to save it since I'm using it in an AIR project)?
I was considering writing my own class for it but started in the research and decided it's a very highly developed field and is hard to quickly find the basics of how to handle it. Thus it's usefulness outweighed it's opportunity cost for the time I have unless there is an already made class for handling this.
Mainly was considering this for short clips that one would create for logos etc so that one can display the logo in other environments with ease.
I have a bitmap with a different bitmapData on it (done through copyPixel) and I was wondering whether there is built in function that can determine what BitmapData the user is clicking on? how to best figure out which BitmapData is clicked, or do I have to do x,y pos comparisons manually?
View 8 RepliesAre BitmapData objects automatically GPU accelerated for rendering, rotating, and scaling,or does the bitmap they connect to need to have cacheAsBitmap set to true?
View 1 RepliesI'm trying to load several jpeg images dynamically XML into bitmapdata object in fla. I can see them on the stage of this .swf file.However, I load it into another .swf which is my main to call while clicking on one of menu option.I got this error:Error #1034: Type Coercion failed: cannot convert com::Fashion@1daf4ca1 to flash.display.MovieClip.Does anyone know how to convert that??
private function initBitmapFile(file:String):void
{
loadBMP = new Loader();
[code].......
I'm trying to replicate this function from the Allegro graphics library:
void stretch_blit(BITMAP *source, BITMAP *dest, int source_x,
int source_y, int source_width, int source_height,
int dest_x, dest_y, dest_width, dest_height);
http:[url]....
This is somewhat difficult in Flash, because of the overlapping functionality between the Rectangle and Matrix arguments of AS3's BitmapData.draw() method. This is what I have so far. It only works most of the time, and is incredibly inefficient (due to having to sample pixels twice).
function stretch_blit(src:BitmapData, dest:BitmapData, source_x:int, source_y:int,
source_width:int, source_height:int, dest_x:int, dest_y:int,
dest_width:int, dest_height:int):void {[code].....
I am trying to serialize a Bitmap to store in an XML file. My plan is to turn the BitmapData into a byteArray, but I haven't been able to fine an example of this.
View 1 RepliesI need to load a very big image on AS3 (currently sized at 8192x8192). I am aware that it does not fit any of the limits imposed by Flash regarding drawing to screen or creating a BitmapData of that size. I just want to load the image so I can copyPixels() some parts of it here and there.The thing is, I'm loading the .jpg file of that size with no problems. The size is recognized correctly from my Loader object. I load it like this:[code]But I am greeted with the #2015 "Invalid BitmapData" error usually reserved for BitmapDatas that are too big. The error also happens if I try to do a copyPixels(), which is what I need to do.Is there any workaround I can use so I can get data from an image this big on AS3?
View 1 RepliesI have a BitmapData object created dynamically that contains user-drawn shapes. I then attach that BitmapData object to a MovieClip via a Bitmap object and set that MovieClip as a mask to another MovieClip. The mask works but the whole bounding rectangle of the BitmapData is acting as the mask. But I want to exclude the transparent portion from the mask so only user-drawn shape can be set as mask. Can anyone tell how to achieve that?
View 3 RepliesI'm trying to convert all letters in a textfield to bitmap data. I then want to animate each of them. I'm able to return an array of rectangles using getCharBoundaries. But then how do I convert each letter to BitMapData?
package
{
import flash.display.Sprite;
import flash.geom.Rectangle;
import flash.text.TextField;
[Code].....
I have a filled Shape, and a BitmapData that is the same width and height as the Shape's bounding box. I need to cut the Shape from the BitmapData (basically draw the BitmapData onto the shape...) [URL]I use the rather hackish method of:
public static function cutPoly(img:BitmapData, s:Shape, bounds:Bounds):BitmapData {
var temp:BitmapData = new BitmapData(bounds.width, bounds.height, true);
Main.inst.stageQuality("low"); //hack to kill anti-aliasing
[code]....
I'm trying to add a sprite to a stage made from bitmapData I link to from the library with the identifier pointerGraphic, here's my code:
Pointer.as
package com.George.BMIapp
{
import pointerGraphic;
import flash.display.BitmapData;
[Code]....
Yet nothing appears on the stage, yet there are no errors (I'm in strict mode with debugging enabled).
Im making a simple game with destructable terrain. Therefore i use a bitmap for the ground and a movieClip for the player. When the ground is a bitmap i cant use regular hitTestPoint because of the bitmaps transparent pixels. So i looking i the livedocs for the bitmapData.hitTest but i rly dont understand all the parameters.So my question is. How can i reproduce this with bitmapData.hitTest?
ActionScript Code:
if(ground.hitTestPoint(player.x, player.y, true)) {
//actions
[code]....
I need how to cut bitmap from bitmapdata.
View 2 RepliesIve just recently begun using bitmapData for various things, and I decided to create game around it. So Ive been working on this project for weeks now and for some reason i cannot fix this. Ok, so when I use the applyFilter(); Method it cuts my FPS IN HALF!
Code:
ActionScript Code:
package
{[code].........
I'm working on a project that requires more than a simple hitTest. Bitmap collision seems the best way to go. My end goal is to be able to determine which side a rectangle was hit: top, right, down or left. If there is a way to do this with a simple hitTest I'd love to hear about it. The problem I'm running into while following the Flash Example with bitmap.hitTest is that as soon as I apply BitmapData to an mc that already exists on stage the collision detection stops working. I am wondering if this is an inherent issue and I have to rely on creating the movieclips via script then attaching BitmapData.
The Flash example is as follows, this code works correctly:
ActionScript Code:
import flash.display.BitmapData;
import flash.geom.Point;
var myBitmapData:BitmapData = new BitmapData(100, 80, false, 0x00CCCCCC);
var mc_1:MovieClip = this.createEmptyMovieClip("mc", this.getNextHighestDepth());
mc_1.attachBitmap(myBitmapData, this.getNextHighestDepth());
[Code] .....
In my flash IDE library there's an imported jpg Image. Its class base is automatically BitmapData. How to get its data ? The following doesn't work:[code]But how to do without using away3d just for it!?
View 5 RepliesWhat I've got is a NetStream object that plays video, and I want to be able to get a snapshot of the current data. Unfortunately, I have no idea how to obtain a BitmapData from a NetStream - it seems designed to be attached to a Video object, which through internal actions of the two classes ends up drawing the contents of the stream to the object. Using that - I initially did what seems dodgy to get an image - create a BitmapData object, and draw the contents of the Video object. This works, but it has a significant limitation: The data you get is tied to the Video object, and not the underlying source. So if your Video window is 320 * 240 for example, that will be the size of your bitmap data.
After some research, I thought of approaching it by making the Video object the same size as the underlying NetStream source - using the Video.videoHeight and videoWidth properties. If you know the size of the underlying data before you create the Video object, things are fine. You can just construct the new object with new Video(width, height). The frustrating thing is that the docs say you can change the width and height of a Video object after construction using the Video.width and Video.height properties, but it's not the same thing, since you also end up changing the scale.
how to either adjust the width or height of a display object without adjusting the scale(there was mention of a registration point in some of the docs I read), or failing that, a less roundabout way of taking a snapshot of data in a playing / paused Netstream?
I have a PNG file with transparency imported into the library and converted to MovieClip.Now I want to use this PNG file for masking another sprite drawn dynamically using the drawing API. I know that you cant mask a runtime generated sprite with a author time movieclip. So i created another runtime sprite and copied the BitmapData of the PNG in the library to it. The masking happens, but not the way i want. The BitmapData is always a solid box and the masking apears across this box. I would like to have the transparent region of the PNG omitted from the mask data
View 7 Replieshow i can pass a bitmap data through a local connection in as3.0 and get it on the other end intact ?
View 3 RepliesWhen I use it, the only thing that is filled is a white rectangle, doesn't matter the parameter.This is what I do:var map:Bitmap = new Bitmap (new BitmapData(200,200))map.bitmapData.fillRect(new Rectangle(0,0,100,100),0xFF0000)A 100x100 rectangle is added to the bitmap, but it is always a white shape. I want it to be red, as set in the parameter (0xFF0000).
View 1 RepliesI want to print the screen using bitMapData.
var bmd:BitmapData=new BitmapData(700,500,true,0xFFFFFFFF);
//draw the bitmapData from the captureContainer to the bitmapData object;
bmd.draw(stage, new Matrix(), null, null, null, false );
I have it working but the image being drawn starts from the Top Left of the stage I need it to start x 15 and y 80 is there a way to do this? Ive tried bmd.scroll(15,80) but it just make the image look funny.