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


Similar Posts:


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 Vs. Sprite For Large Bitmap Motion?

Feb 21, 2009

is copyPixels not as speedy as it should be when Tweening large bitmaps ?

copyPixels does a wonderful job on images 500x500 or less, but on larger images, my motion is not as smooth.

all i'm trying to do is slide an image from stage.stageWidth to 0 (right to left).

View 1 Replies

ActionScript 3.0 :: Flip A Bitmap That Is Scaled?

Mar 2, 2012

How do I flip or reverse horizontally a bitmap? I found online that people recommend that you do scaleX = -1 but my bitmap is scaled to 0.7 and therefore when I do *= -1 it doesn't always reverse the image, instead I get a moonwalk effect.

View 6 Replies

ActionScript 3.0 :: Flash MovieClip / Bitmap X,y, Width,height After Scaling For CopyPixels Function?

May 18, 2010

I have a 50x50 fixed rectangle in the center of the stage. I am using this rectangle as a "hit area" to copy pixels of a bitmap that is draged by the user to line up an area of the image he/she would like to crop.I have preview of the hit area displayed while the bm is being dragged which works well. However, once the bitmap is scaled using the slider component the preview area no longer reflects what is in the hit area.

Code below:

function mouseDownHandler(e:MouseEvent):void
{
// Contraint #8 - Define drag bounds[code].....

View 1 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

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

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

ActionScript 3.0 :: Molehill : VertexBuffer3D's Vector From CopyPixels?

Mar 18, 2011

I am working on my own Molehill 2D painting classes. I took a look at Ely Greenfield's M2D stuff but I found it a tad overkill for what I am looking for. So I want to do my own. I have been working off of Polygonal's example. You can check out my code here - http:[url]..........Assume I want to paint one entity that is a rectangular bitmap image using two triangles (essentially a quad). Basically I am having a hard time understanding how to translate this:

Code:
bitmapData.copyPixels( sourceBitmapData, sourceRectangle, destinationPt.. );
to this (assuming I am using a x, y, u, v vector pairing):[code]...

Specifically if the source rectangle doesn't contain the same values of the sourceBitmapData.rect. What if I want to paint only a portion of a bitmap onto a quad? Or stretch a portion of the image across a quad.

View 1 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 :: Rendering Flash Menu Over The Top Of Game Drawn With CopyPixels

Feb 20, 2011

I'm new to flash but have plenty of experience developing games, so when I started in flash I ignored pretty much everything that flash could do and just created a buffer the same size as my flash movie and drew my game direct to that with copyPixels. Now what I want to do is to add a menu to the game and it seems sensible to do make use of flash a little more. I can build a menu no problems in a .fla but can anyone tell me how I can render it over the top of my game?

View 2 Replies

ActionScript 3.0 :: SetPixels And CopyPixels, Bound To Original Rectangles And Points?

Nov 18, 2010

setPixels and copyPixels, bound to original rectangles and points?

View 0 Replies

ActionScript 3.0 :: Bitmapdata.hitTest - Bitmap 'emptyBitmap' With Bitmap Data Created

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

ActionScript 3.0 :: Use The BitmapData Property Of A Bitmap And Pass It To The Constructor Of A New Bitmap Object?

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

Flex - Function To Redraw Bitmap On Sprite Without Passing In Said Bitmap?

Feb 22, 2011

If I have a BitmapData that's already been drawn onto a Sprite. Is there a way to redraw the BitmapData onto a Sprites Graphics object without having to invoke beginBitmapFill and passing in the same BitmapData?

View 1 Replies

ActionScript 3.0 :: Drawing From Bitmap To Bitmap Overrides Earlier Graphics?

Dec 29, 2010

I'm working on a game, and to keep performance good, instead of addChild'ing 50 new sprites to the stage every second, I decided to have each player draw to their own bitmap, and then to the 'master' bitmap. This introduces an issue though: the second player would override all data the first player has put into to bitmap...My basic debugging proof of concept:

Code:
// bitmap test

import flash.display.Bitmap;
import flash.display.Bitmap;[code]......

View 1 Replies

Flex :: Know If An Image Needs To Be Scaled Down Or Not?

Jul 15, 2010

I'm trying to create in Flex a Tile view that shows some images that a user has. The images don't have the same size, some are small and some are big.

What I'm trying to do is to use a List and create an ItemRenderer that has an Image property which displays the user images (the images are passed to the source property of the Image Object), I want the big images to scale down to the size of the tile so I set the 'scaleContnet' property of the Image Object to true, but this causes the small images to scale up to the size of the tile, this is not the behavior I want.

all the images are Embeded into Class objects and are passed as arguments to the ItemRenderer, how can I know in the ItemRenderer if I need to set the 'scaleContnet' property of the Image Object to true (for big images) or false (for small images)?

View 2 Replies

ActionScript 3.0 :: Loading FLV Gets Scaled Down?

Aug 31, 2009

Loading in an FLV. Partly works but the video shows up around half the size of the original. I've poked around endlessly with the Adobe Media Encoder and I've checked and double-checked the size of the orginal video before I encode. why its being scaled down like this?

[Code]....

View 2 Replies







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