ActionScript 3.0 :: Blitting CopyPixels With Pooling BitmapData?

Nov 7, 2010

What do you think about mixing this two up? Would it lead to better performance for the scenario described below?However, method done below still contains jerking/stuttering in animationWhat my app does is to create a random mix of smiley and draw it into the canvas, and update the movement of the smiley (x,y)I have a source bitmapdata containing different smileys each of the same size.Example:The app creates a random mixture of smileys inrandom length;Example:tc...I have 2 vector that acts as pool. 1 vector is to store bitmapdata1 vector to store SmileyObject (SmileyObject has 3 properties, positionX, positionY,bitmapData)If the pools is empty, I create a new bitmapdata and SmileyObjectThe bitmapdata copypixels random smileys from the source bitmapdata.This is then placed into SmileyObject.I have a loop that goes through each smiley objectand copypixel each bitmapdata into the canvas along with the x,y position.However, even with copypixel and pooling bitmapdata + smiley object,I can still view the stutter / jerk / stuttering / jerking in the smiley animation.

View 6 Replies


Similar Posts:


AS3 :: CopyPixels From A Huge BitmapData?

Sep 5, 2010

I 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 Replies

ActionScript 3.0 :: Flash BitmapData.copyPixels And BlendMode?

Oct 4, 2010

I'm loading a batch of 50 jpgs and once loaded, on enter frame, I'd like to change their alpha individually and apply BlendMode.ADD to all of them (also individually).

I can do this easy using normal Sprite objects, but this is not efficient enough (processor wise). I've played a bit with BitmapData.draw(source, null, null, BlendMode.Add) and that's still not efficient enough.

So I was wondering if I could achieve similar effect using copyPixels (which I know should be more efficient). Still, I'm a bit clueless on how could I apply BlendMode and alpha on a bitmapData object (I mean, I know I can't, but I was wondering if I could make this work using Matrix and filter manipulations).

View 8 Replies

ActionScript 3.0 :: BitmapData.CopyPixels Method With Many Objects Be Faster?

Feb 7, 2010

I'm trying to know if you can copy the pixels of many objects in one BitmapData without a huge slowdown. The slow down is made by calling the method multiple times, thus making a lot of variable declaration and disposal for the garbage collector. If someone know how to either immitate the copyPixel method or have any other way of solving this problem,

View 4 Replies

ActionScript 3.0 :: Object Pooling And Passing Arguments

Feb 22, 2011

I just started using object pooling and I have some problems with passing arguments. I made class "Circle" which needs 3 arguments when instanced and I try to push it into the pool.

[Code]....

View 4 Replies

ActionScript 3 :: Improve Performance Using Blitting For Graphics?

Sep 9, 2010

I am a bit new to using blitting for graphics. But I have worked up a few demos myself, and I have been reading a lot of information on the methods used. One common theme I have been seeing though is that all of them brute force rendering; drawing the farthest back object first and stepping through all other objects. even drawing objects that are going to be completely overlapped. The reason all of them say this is that any kind of testing to see what should be drawn actually takes more time than just drawing everything with no checks. Is there any kind of way to detect what should be drawn, that will run faster than just drawing everything?

View 1 Replies

ActionScript 3.0 :: Blitting + Pixel Perfect Collision?

Oct 23, 2011

I'm using a blitting engine that uses bitmapData. No display objects.Is there a fast pixel perfect collision detection available for such a game system?I already tried CDK but that didn't work because it assumes you have display objects which my objects don't use. Sometimes my objects are pretty big and hitTest sucks in this case. I already tried circle-to-circle collisions but that didn't do the trick either.

View 1 Replies

ActionScript 3.0 :: Unable To Use Tile Sheet For Blitting?

Feb 20, 2012

I am trying to get bitmapdata from a loader to be able to use my tile sheet for blitting. I seem to be unable to get it to work. After some testing I noticed that none of the code after this piece is executed in the SWF, so apparently it always freezes at this point:

ActionScript Code:
tileSheet = (evt.target.content as Bitmap).bitmapData;
bmp = new Bitmap(tileSheet);
addChild(bmp);
Obviously I am doing something wrong.

View 9 Replies

Actionscript :: How Much Faster Is Blitting Than Using Vector Sprite Objects In Flash

Feb 18, 2011

I know there are different situations where one would be better than the other, but I'm comortable with a generalized statistic of... How much faster is blitting than using vector Sprite objects in Flash?

View 2 Replies

Actionscript 3.0 :: Blitting Lines - Draw Approximately 50000 Lines And Performance Is Poor?

Aug 17, 2011

I have been working on a map viewer based blitting technique. As part of the map I need to draw approximately 50000 lines and performance is currently really poor.

Code: Select allvar movie:Shape = new Shape();
for( ... )
{
movie.graphics.clear();[code].....

View 2 Replies

ActionScript 2.0 :: Flash 8 BitmapData - Getting Error : The Class Or Interface 'BitmapData.loadBitmap' Could Not Be Loaded?

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

ActionScript 3.0 :: Error #2015: Invalid BitmapData At Flash.display::BitmapData()

Oct 14, 2009

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

View 10 Replies

Actionscript 3 :: Quickly Rotate The Pixels That Make Up BitmapData Without Using BitmapData.draw()?

Dec 29, 2011

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 Replies

IDE :: Can't Get CopyPixels() To Work?

Sep 26, 2009

I did a function for blit scrolling successfully using Draw(), but then I heard that copyPixels is faster. Unfortunately, I'm not having the same success with that as I had with draw();

Specifically, no matter what I try to use for the source image, it keeps saying that it can't be coerced into a bitmapData object:

Code:

TypeError: Error #1034: Type Coercion failed: cannot convert SourceBitmap_bm$ to flash.display.BitmapData.

I tried referencing the bitmap in my Library (That's how I'd prefer to do it, copy from an item already sitting in my library) that has base class "flash.display.BitmapData", yet I get the error. I tried putting the bitmap into a movieclip and copying from that, same error. I tried copying from an offscreen instance of the mc (which worked fine with draw()), same error.

It's a mess by now because i've tried so many things, but this is my code:

[Code]...

I see are for copying pixels after loading in an external file. Does anyone know of an example that works with items already in library?

View 2 Replies

ActionScript 3.0 :: BitmapData.hitTest - What Angle Or Coordinate Of The BitmapData The Collision Happens?

Sep 1, 2011

how 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 Replies

ActionScript 2.0 :: Using CopyPixels On A Isometric Map?

Aug 4, 2009

How would I go about using CopyPixels to build an isometric map? CopyPixels takes a specific rectangle and copies that onto a bitmap.. But how would one use that to build a seamless isometric map?Building a square top-down tiled map would be very simple as copypixels pastes each tile next to one another.. But for Isometric Maps, this would be different as some parts of the CopyPixels rectangle is over lapped into other tiles.. and this would 'erase' the bitmap of the other tiles currently on the bitmap..[URL]Fig2, is what happens when you try to do a copyPixel over an existing bitmap, assuming the white is transparent space.

View 0 Replies

Flex :: AddChild A BitmapData Or Draw A BitmapData To Screen?

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

ActionScript 3.0 :: CopyPixels Flip Or Rotate 90?

Nov 12, 2010

Traditionally, when blitting in old 2d games, flips and 90 degree rotations could be achieved with almost no performance hit. The reason for this is that the effect an be achieved by simply changing the order that pixels are copied.

I'm using copyPixels in Flash to get maximum performance. Is there any way to do a flip or 90 degree rotation using copyPixels? (Without pre-calculating and storing the flip/rotate). I couldn't find a way to do it, but it seems like it should be possible, because it is a very common technique in 2d games (well, not so much now that modern 2d games use 3d hardware acceleration... but Flash doesn't let us do that, so we need to use the traditional 2d techniques)

View 2 Replies

ActionScript 3.0 :: Memory Leak During CopyPixels?

Mar 1, 2012

I am making a custom renderer using the copyPixels function for my Haxe/Flash game. So I have this kind of code :

buffer.bitmapData.copyPixels(m_CurrentSkin, RECT3, POINT, null, null,true);

where :

-buffer is the bitmap where all my scene's objects are drawn

-m_CurrentSkinis the BitmapData that contains the current frame of the object to be drawn

Every time m_CurrentSkin contains a BitmapData that have never been drawn (the first time that an animation frame is drawn for example),I have a memory leak that is not garbage. However if m_CurrentSkin contains a BitmapData that have already been drawn (when the animation is played a second time for example), there isn't any memory leak.If I comment this line there is no leak so the problem comes from there.It seems that a copy of the BitmapData is cached in memory but I have checked in my code and there is no cacheAsBitmap explicitely set to true.

View 3 Replies

ActionScript 2.0 :: CopyPixels With Irregular Shape

Jan 19, 2009

Can anyone tell me if I can copyPixels with an irregular shape instead of just a rectangle?

View 0 Replies

ActionScript 2.0 :: Bitmap CopyPixels Not Copying?

Oct 1, 2009

I am playing around with an old Zelda: Link's Awakening tile set, and was trying to make an application that will display the current selected tile.

I am well versed in as2 but have never had need for the bitmap classes until now. I have found examples of the copyPixel() function that work but could not get it to work in my code.

I have attached the .fla file I saved it as a CS2 (Flash 8) file. (I use CS3 and/or CS4 depending on which computer that I am currently using. This one is in CS3)

ActionScript Code:
// -----
// ----- Author: Nathan Sepulveda
// ----- Date:   Oct 1, 2009

[Code]....

View 6 Replies

ActionScript 3.0 :: Rotating Bitmap Then Doing Copypixels?

May 8, 2011

I have a bitmap which has several frames (packed along the horizontal axis). In order to render them I copy it to the backbuffer as follows:

ActionScript Code:
public override function copyToBackBuffer(db:BitmapData):void
{

[code]........

View 0 Replies

ActionScript 3.0 :: CopyPixels On MovieClip With Children?

Jun 14, 2009

I'm working on my second flash game and have been stopped in my tracks trying to cache MovieClip Animations into arrays of BitmapData frames. To capture the frames I have set up a loop which runs through the frames in the MovieClip and use copyPixels to get a snapshot of the graphic.This works fine if the MovieClip to cache does not contain any child MovieClips, but if it does, these MovieClips are frozen on their first frames. I've been looking at MovieClip.getChildAt(index) in attempt to navigate their time lines but because that returns a DisplayObject it seems impossible.

So, my question is: Is it possible it to use copyPixes on a MovieClip and also step through child time lines, or should I be using sprite sheets?

View 2 Replies

ActionScript 3.0 :: Flash CopyPixels For MovieClip?

Aug 4, 2011

I'm not much of a scripter. I get by editing scripts similar to my needs. I learned a few things about blitting and I'm trying to get a rectangle area of a MovieClip to blit to a location on the stage. But I run into the error "Invalid BitmapData" which makes sense because I'm referencing a MovieClip and not an image. Is there a different AS3 command other then copyPixels that would work for a MC?

I know VCam would seem an obvious solution, however VCam scales to fill the entire stage. I only want to fill a small rectangle on the stage. I've already attempted to edit VCam with no success. Its probably not the same principle, but would it be possible to blit the matrix VCam uses?

View 2 Replies

ActionScript 3.0 :: BitmapData = New BitmapData(); Eating Up Memory?

Dec 22, 2011

I'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].....

View 1 Replies

ActionScript 3.0 :: Use CopyPixels To Copy Part Of Stage?

Dec 3, 2009

Is it possible to use copyPixels to capture part of the stage directly into a bitmapData object?

Just wondering because in my situation using captureBitmapData.draw(stage, matrix); is causing performance problems, even without the matrix. I read that copyPixels is fast so I was wondering if there's a trick to use that directly on the stage without the draw part.

What I'm essentially doing is screen capturing a part of the stage and putting it in a a window, using a loop to update it over time since it contains animation. Works great in one of my FLAs, but chugs in the other so looking to optimize the code to a bare minimum.

View 1 Replies

Flash :: Set CopyPixels To Ignore Transparent Pixels?

Mar 17, 2011

I have a BitmapData object with transparency (the sourceBitmapData parameter). Every time I use copyPixels() to copy it onto another BitmapData object the transparent pixels replace whatever is beneath them. I would like the copyPixels() function to simply ignore these fully transparent pixels (0x00) and NOT copy themBTW, I've tried setting the alphaMerge to true but that doesn't solve the issue - the whole source object just goes black and ignores ALL transparency.EDIT:

Here are the code snippets;
var b:UIComponent = new UIComponent();
b.graphics.beginFill(color, opacity);

[code].....

View 3 Replies

ActionScript 3.0 :: CopyPixels And Alpha Channel Of An Image

Jan 21, 2010

I am having problems dealing with the alpha channel of an image. Basically I do this:

1. I load an image (.png) and keep it in a bitmap:...

[Code]...

View 4 Replies

ActionScript 3.0 :: Dynamic Coordinates For CopyPixels Rectangle

May 6, 2010

I believe this is esentially a math problem that may be easy for most of the programmers out there, but I am stuck. I have a fixed rectangle width = 50 height = 50 centered in the middle of the stage. I am using this rectangle to copyPixels of a bitmap that is also centered on the stage. The bitmap is draggable. I can define the initial x,y of the rectangle used for copyPixels with

[Code]...

View 1 Replies

ActionScript 3.0 :: CopyPixels Of User Scaled Bitmap?

May 19, 2010

I am trying to copy pixels from a user scaled bitmap into a 50x50 target area. I am not seeing the new bitmap does not reflect the scaling of the initial bitmap.

function onSliderChange(e:SliderEvent):void
{
scaleClip(slider.value, dynamicX, dynamicY);
dynamicX = holder_mc.x;

[code]....

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved