ActionScript 2.0 :: BitmapData And Transformation Matrices - Shift The Newly Created Bitmap?

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


Similar Posts:


ActionScript 3.0 :: Access The Newly Created Bitmap Data To Access The Method CacheAsBitmap.bitmapdata.dispose() ?

Oct 22, 2010

So, you have a sprite, you draw some graphics, you set cacheasbitmap=true... I can't seem to access the newly created bitmap data, to access the dispose() method.

[Code]...

View 6 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 :: Manipulating A Circle, Using Two Transformation Matrices?

Aug 31, 2011

I am having trouble with some code, I am trying to get a circle to rotate around a center point, as well as rotate in a circle. at the same speed as its parent circle. however I am having some trouble, and I know it is from how I am transforming the position of its matrix, however I honestly can not find the mistake. below is the code:

ActionScript Code:
import flash.display.Sprite;
import flash.geom.Matrix;
var outcirc: Sprite= new Sprite();

[Code].....

View 1 Replies

C# :: Collection Of Various Color Matrices For Bitmap Manipulation?

Feb 6, 2011

I've been messing around a bit with some low-level bitmap manipulation and having been creating some various color matrices to apply to bitmap data to add "filters" (for lack of a better term).I have seen a number of tutorials online in C# and AS3 about applying various color matrices to bitmaps, but was curious if anyone simply had a collection of these color matrices that map to specific filter styles (black and white, sepia, etc.).

View 1 Replies

ActionScript 2.0 :: Accessing Newly Created MC?

Dec 30, 2003

I created a MC with a simple createMovieClip, in which I load a movie. This works.

[AS]
_root.createEmptyMovieClip("pmpPlay", 2);
loadmovie("play.jpg", pmpPlay);

[code].....

View 9 Replies

ActionScript 3.0 :: Accessing Newly Created Childs T

Jul 20, 2009

I have a script that randomly pops out circles all over the stage. However, I want them to disappear once I roll my mouse over them (and only the ones I roll over, not all the instances).So if I have code like this in a function:[code]And then I have a mouse_over function in the same class, how do I tell it to removeChild? Since the stars are instances of the object, they are giving instance names like instance67, which makes them hard to remove.

View 2 Replies

ActionScript 3.0 :: Referencing A Newly Created Class Instance

Jun 16, 2011

I am completely new to actionscript although I do come from a OOP background. I have been asked to trial Flash and Actionscript 3 in particular - so I do come with a few preconceptions on how I expect actionscript to behave. I have a problem I donot understand. I have created a new class and to test it I use a simple test harness in the form of a .fla file.

The issue I have is when I create a new instance of the class and assign it to a variable, subsequent background changes to that instance of the class are not 'picked-up' when referenced through the variable. I would expect that given instance of class could be assigned to many different variables and any updates using one variable would accessible using any of the other variables.

[code]...

View 1 Replies

Flex :: Get The Reference To A Newly Created Button With Actionscript?

Mar 11, 2010

I have a MXML button:

<mx:Button id="myButton1"/>

How do I create N number of Buttons with Actionscript: myButton2, myButton3, myButton4... myButtonN ?

And how to get the reference to the newly created buttons right after they are created? Like I should be able to do myButtonN.x = 100 right after it's created.

View 1 Replies

ActionScript 3 :: Transformation Of BitmapData To Triangle Points

Nov 11, 2010

I have a big code, but essentially, this part comes to transformation of a BitmapData to triangle points, using affine transformation. Also - I know that BitmapData is rectangular - the last, fourth point of the transformation is just the first one reflected over the axis defined by the other two points.

A small thing so you can see which point is which one:
1........2
. / / / /|
./ / / /
. / / / |
./ / /
. / / |
./ /
. / |
./
3 - - - -4 - 4th point reflected

This whole process would come to scaling, rotating and skewing the BitmapData based on the angles between the points... But somehow my code still does not work. Looking at a similar thing in PaperVision 3D - still didn't work?

View 1 Replies

ActionScript 2.0 :: Creating Variables To Handle Newly Created MovieClip?

Jul 14, 2003

How flash setup a variable to handle the newly created movieclip?
Example:
this.createEmptyMovieClip("mymovie",2);
this.clientscroller.setScrollContent(mymovie);

Where did I set it up as a variable? I tried this and didn't work either:
this.createEmptyMovieClip("mymovie",0);
mymovie.createTextField("mytext",1,100,100,300,100 );

View 5 Replies

ActionScript 2.0 :: With() Block - Isn't Registering As Part Of The Newly Created Object

Aug 24, 2004

In the code I'm writing, I use a with block to reference a newly created object thus:

[Code]...

I tried doing this.xot, xot, and other stuff, but it just keeps sliding under _root.xot instead of ArrowL##.xot.

View 2 Replies

ActionScript 3.0 :: Bitmap Hue Shift With Custom Palette?

Feb 28, 2009

How do you shift the colors of a bitmap image, with a red/yellow cloud, so that red becomes orange, then yellow, then orange, then red again? The yellow should go trough the same process, but start and end with yellow. Same with all the other colors in between.Kind of like when you play with the hue-setting in photoshop, but instead of looping trough the whole spectrum, it only loops trough red>orange>yellow>orange>red.

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

Actionscript 3 :: Get An Accurate Reading Of The Pixel Data From A Bitmap With A Matrix Transformation?

Mar 24, 2011

i've filled a circle shape with the bitmap data of a bitmap asset.i need to rotate the circle from the center, so i added the bitmap to the center of the circle and used a matrix transformation to shift the bitmapdata upward and leftward so it appears centered.
now i'm trying to read the bitmap data with getPixel() but the return value is off since it is returning the untransformed position of the bitmap data instead of the visible transformed bitmapdata.

Bitmap(Sprite(evt.currentTarget).getChildAt(0)).bitmapData.getPixel(evt.localX, evt.localY)

how can i get an accurate reading of the pixel data from a bitmap with a matrix transformation? updated with code. assume the redCircleData in my example is more colorful and something worth retrieving pixel data.

var redCircleData:Sprite = new Sprite();
redCircleData.graphics.beginFill(0xFF0000, 1.0);
redCircleData.graphics.drawCircle(0, 0, 100);[code]............

View 2 Replies

Actionscript 3 :: Flash: Bitmap Inaccuracy - Image Appears To Shift One Pixel?

Oct 12, 2011

I load a bitmap to the stage, it's a GIF and set to lossless compression. I have ensured its coordinates are integers and have not allowed smoothing (smoothing somewhat fixes the issue but reduces quality of the image).The problem is the image appears to shift one pixel to the left and add that pixel on to the right side meaning one side has no border and the other a double border.The original bitmap does not have this issue, and there is no transparency .etc in the image.

View 1 Replies

AS3 :: Image - Add A Child Inside A Newly Created Instance, Inside Of A Loop?

Feb 2, 2005

I am trying to create a gallery where each thumb is housed inside of it's own movie clip that will have more data, but it keeps failing because it won't let me refer to the newly created instance of the movie clip. Below is what I am trying to do.

var xml:XML;
var xmlReq:URLRequest = new URLRequest("xml.xml");
var xmlLoader:URLLoader = new URLLoader();

[code]....

View 2 Replies

AS3 :: Add A Child Inside A Newly Created Instance, Inside Of A Loop?

Jun 6, 2010

I am trying to create a gallery where each thumb is housed inside of it's own movie clip that will have more data, but it keeps failing because it won't let me refer to the newly created instance of the movie clip. Below is what I am trying to do.

var xml:XML;
var xmlReq:URLRequest = new URLRequest("xml.xml");
var xmlLoader:URLLoader = new URLLoader();

[Code]....

It dies every time on that last line. How do I refer to that vidThumbn instance so I can add the imageLoader? I don't know what I'm missing. It feels like it should work.

View 2 Replies

ActionScript 3.0 :: Cut Bitmap In Bitmapdata?

Sep 14, 2010

I need how to cut bitmap from bitmapdata.

View 2 Replies

Actionscript 3 :: Remove Bitmap And BitmapData

Sep 11, 2011

How to remove the bitmap from the holder and the bitmapData from the Flash Player memory?[code]

View 2 Replies

ActionScript 3.0 :: Encoding Bitmap (bitmapdata) To JPG

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

ActionScript 3.0 :: Drawing BitmapData To Bitmap?

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

Flex :: Get Notified Of Change In Bitmap / BitmapData?

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

Flash :: Show A Bitmap Which Is Only A Portion Of Its BitmapData In AS3?

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

ActionScript 3.0 :: Crop Bitmapdata To Create New Bitmap

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

ActionScript 3.0 :: Extract Bitmap Or BitmapData From MovieClip?

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

ActionScript 3.0 :: Load It Into BitmapData Then Into Bitmap Then Onto The Stage?

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

Flex :: BitmapData Allocates A Lot Of Memory When Created

Feb 2, 2012

I have an application which manipulates high resolution images (something around 100+ megapixels), and I'm having some memory issues. When the BitmapData object is created, it allocates memory to store this image. The problem, is that I already have a ByteArray with this image's pixels (which have something around 400+ MB), so when the BitmapData is created, it allocates memory to store the same data that I have on the ByteArray. After its creation, I can set the pixels from the ByteArray to the BitmapData and free the ByteArray. But this memory peak is, sometimes, causing the runtime to raise an exception, telling that the system is out of memory. Is there any way to tell the BitmapData to use my own ByteArray? Or any other solution that I don't have to use double the memory that I need?

View 1 Replies

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

Flash :: Load A Bitmap File Into A BitmapData Object?

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







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