Flash - Draw A Bitmap In Graphics-Object At Any Position?

Mar 30, 2011

Is it possible to draw a Bitmap to a Graphics-Object like

this.graphics.beginBitmapFill(bitmapData, matrix, false);
this.graphics.drawRect(0, 0, w, h);
this.graphics.endFill();

with an offset?

A simple moveTo(x, y) call before beginBitmapFill does not work :/ Neither does changing the x and y value of drawRect... (That just seems to have the same effect as an translation with the matrix...) Additionally I don't want do draw that thing in a separate Graphics-Object and add that one into the other...

View 2 Replies


Similar Posts:


Actionscript 3 :: Draw Shadow Without Filter On Graphics Object?

Sep 27, 2010

I have a complex graphics data on a sprite or a shape (no matter which is exactly). But I want to draw shadow (inner too) for one Rect ( [10, 10, 240, 25] for example) or another path.

[Code]...

View 1 Replies

Flex :: Draw A Circle Inside Border Container Using Graphics Object?

Apr 5, 2011

My basic requirement is to draw a circle inside a BorderContainer with the layout set to BasicLayout.I run this method in the CREATION_COMPLETE event of the BorderContainer object.[code]I know I must be missing something VERY basic here. Can I just draw like this OR should I draw in some other event? I know that I can create a Ellipse object and easily add it to the border container but I would like to know how I can do this using the graphics object.

View 3 Replies

ActionScript 3.0 :: Determine Current Pen Position In Graphics Object?

Jan 3, 2010

Is there a way to determine the current position of the pen in a graphics display object. Something similar to what is discussed in this thread but for AS3?

View 4 Replies

ActionScript 3.0 :: Trace The Path Of An Object By Using SetPixel On The Object's Position Every Frame In A BitmapData/Bitmap Pairing?

Feb 16, 2011

I'm trying to trace the path of an object by using setPixel on the object's position every frame in a BitmapData/Bitmap pairing. These pixels aren't showing up normally and I suspect I have a fundamental misunderstanding of the BitmapData class. Here's what I'm doing:

public var contrailBase:BitmapData;
public var contrail:Bitmap;
private var contrailColor:uint;[code].....

Using this code, the red pixels don't show up. If I initialize contrailBase to 0xFF000000 instead then I get a black screen on which the red pixels DO draw, but I need the bitmap to be transparent except for the contrail. What am I doing wrong?

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

ActionScript 3.0 :: BitmapData Draw() Method - Draw The Bitmap On The Stage At Design Time?

Mar 18, 2009

I am using the draw() method of the BitmapData to encode a jpeg of part of the image. Now this should be easy enough given the object I want to draw to the bitmap is on the stage at design time so I know its location and dimetions exactly! Heres the code I have in place.

Code:
var myBitmapSource:BitmapData = new BitmapData ( street.width, street.height, false, 0x333333);
myBitmapSource.draw(street, null, null, null, new Rectangle( 96, 5, 571, 450 ), true );

I know for a FACT that no part of the street clip I am drawing out is in negative space, and it's registration is (0,0). However, it cuts off A lot of the top of my image. y=5 in the above rectangle is where I need the top to be, but it cuts the top off of the image... even if I change it to 0, it has no effect.

View 2 Replies

Flash :: Draw Two Intersecting Circle Holes In Graphics?

Oct 25, 2011

I need draw rectangle with two circle holes inside. The problem is in circles interception. I want them to join together and cut from background, but they seems to be XORed:

At first I tried drawRect and DrawCircle:

graphics.beginFill(0, 0.5);
graphics.drawRect(0, 0, width, height);
graphics.drawCircle(width/2, height/2, 50);

[Code].....

here getCirclePath returns object with points to draw polygon which looks like circle. Also I tried different combinations of GraphicsPathWinding constants, but no luck.

how to draw two intersecting circle holes in graphics?

View 2 Replies

Professional :: Getting Bitmap Graphics From Photoshop To Import Crisply Into Flash?

Mar 29, 2012

I'm having trouble getting bitmap graphics from Photoshop to import crisply into Flash. I use the highest quality PNG codec, but graphics appear jaggy once they're in Flash.getting crisp graphics into Flash?My stage sizes are 992 x 692 or smaller, and I'm viewing at 100%, so, not expecting graphics to be sharp and clean at maximum magnification...

View 7 Replies

ActionScript 3.0 :: Draw Bitmap Instead Of Export Bitmap?

Nov 5, 2009

I'm using Sandy to animate some objects in 3D. What I currently do to images which are EXPORTED in the library, I want to do to some bitmaps that I create using the DRAW technique. But it wont work :-(

CODE FOR 'CREATED BITMAP' :
ActionScript Code:
var bData:BitmapData = new BitmapData(myObject.width,myObject.height);
bData.draw(mask5);

[Code]....

Sandy doesn't seem to treat the 'created' bitmap the same as those that are exported from the library.

View 0 Replies

Flash :: Accurately Draw Rotated Bitmap?

Jan 28, 2010

I have a container with masked bitmap in it. The scale and rotation of this container changes at runtime, and I need to draw the masked bitmap but cannot figure out the appropriate matrix calculations to do so.My code works correctly to reflect position, scale, offset for centering without rotation. When rotated, the angle is correct but the positioning is incorrect - I believe because the dimensions change when the rectangle is rotated.how to compensate for this in the positioning - here is some code:

// Adjust the transformation matrix to account for the position of the container
var tMatrix:Matrix = _imgContainer.transform.matrix;
//Offset for container

[code].....

View 4 Replies

Flash - Draw Dot As Sound Spectrum In Bitmap

Nov 18, 2010

I looking into become a sound programmer. As I could find some sound analyzer would display a nice spectrum of color on bitmap. Which API do I draw a dot shape? Is it circle or line? Is it possible to resize the bitmap width and height after adding all the dots?

View 1 Replies

Flash :: Using Bitmap Data To Draw Massive Image?

Feb 18, 2011

I am making a snow boarding game in AS3. The problem I am having is that I want to leave a trail in the snow behind the board.

I have had a think and feel that the best way of achieving this would be to use the lineTo() method to draw a line form the snowboards previous position to its current position. If I do this all of the way down the slope I would end up with a line almost 23000 pixels long which seems extremely large and will have a major impact on performance.

If I were to convert the trail movieclip to a bitmap would it improve performance? I am targeting a minimum of flash player 9 which I have found to have issues when handling bmp's over 2880 pixels so I think this method might not work.

View 2 Replies

Flash :: Bitmap Data .draw() With Transform Matrix

Jun 29, 2011

I'm working on a project wherein a user can take a snapshot of themselves using their webcam and then edit this image by transforming scale and rotation and save the result.

I've got most of it working, the user can take a snapshot of themselves, transform the object using Senocular's Transform Tool and i'm using .draw() to then save this transformed object. The problem is .draw() is only grabbing data from the top left corner of the stage. It is drawing the transformed object but only from the top left corner.

Why does it only draw from the top left corner and how can i get set the coordinates to only draw from the area where the captured image is set?

You can view the file as is at: [URL]

And i've zipped the FLA and relevant classes at [URL]

import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;

[Code]....

View 2 Replies

ActionScript 3.0 :: Flash - Draw A Line On MOUSE_DOWN-not A X_y Position?

Feb 9, 2012

I want to drag a line from the mouse down anywhere on the screen but my problem is I can only do it from a set position eg.120,120.

Everything else is fine.

Code:
var line:Sprite;
line = new Sprite();
addChild(line);

[Code].....

View 2 Replies

ActionScript 3.0 :: Memory, Graphics.draw And Clear?

Jan 11, 2010

i have a movieClip. On it i draw a few rundedRects, when i resize the window i use graphics.clear to remove it, and then reDraw the Rects. Will this result in memory leakages? or will flash reuse the memory address as long as i draw on the same sprite?

View 1 Replies

Flex :: Draw A Circular Arc In MXML Graphics?

Feb 20, 2011

Is there a simple way to draw a circular arc in MXML graphics that doesn't involve beziers? Or should I create my own component?

View 4 Replies

Actionscript 3.0 :: Draw Lines With Flash's Core Graphic Class But Attach A Custom Bitmap To That Line?

Mar 31, 2009

[URL]

Are they just constantly adding MC's to the display list as the mouse is moved around? Doesn't that kill memory?

Is there a way to draw lines with Flash's core graphic class but attach a custom bitmap to that line?

View 10 Replies

Actionscript 3 :: Draw Shapes On BitmapData / Getting Its Graphics Context

Aug 9, 2010

What would be your recommendation for drawing shapes (rects, circles...) onto BitmapData, and how to effectively switch between colors.Draw shapes on BitmapData / getting its graphics context

Is there any way to get graphics context from BitmapData so I could easily paint shapes using graphics.draw...()?

View 1 Replies

ActionScript 2.0 :: Graphics Run A Lot Smoother Than Movieclips With Bitmap Caching On?

Aug 15, 2008

I have this RPG-like screen where you have a character walking through.. the forest or something.. and the thing is.. it's lagging.. LOTS..On that scene.. there are quite a lot of Tree graphics and grass graphics.. I've tested this and apparently graphics run a lot smoother than movieclips with bitmap caching on..Also.. My character has lots of different hair styles all put into one movieclip.. and i thought that by removing them all.. and just have a attachMovie() script to pull in the appropriate hairstyle clips.. it would go faster..but apparently it doesn't seem to of made much difference..what other ways can i reduce the lag on flash?

View 1 Replies

ActionScript 3.0 :: Graphics Fill - Change From Color To Bitmap?

May 19, 2009

i have found a beautiful water effect made in as3. The effect is available to download on the website below.I am trying to change the fill of the water (that is blue or any color that you pick).The original code fills the water like this:

Code:
public function renderWater():void {
shape.grapics.clear();
shape.graphics.beginFill(0x006699);
shape.graphics.lineStyle(0, 0x000000, 0);

[code].....

I tried to follow the instructions on the beginBitmapFill help, but i am receiving the water with no fill.

[code]...

View 1 Replies

Actionscript 3 :: Draw A Rectangle Using The Graphics Class, But Move The Registration Point?

May 18, 2011

I have the following code to create a Sprite with a rectangle in it:

container = new Sprite();
container.graphics.beginFill(0x00CCFF, .5);
container.graphics.lineStyle(1, 0x00CCFF);[code].......

The only thing is, I'd like the registration point to be in the middle (not the top left corner). Is there a way to set up the registration point in the middle of the rectangle, but still have the position of the rectangle be correct?

i.e. not moved over so that the top left corner of the rectangle is in the "middle" of where I want the rectangle to be...

View 1 Replies

Actionscript 3 :: Graphics Calls Do Nothing In Draw Method, But Work Fine Inside B`s Constructor?

Jan 1, 2011

class A:

[SWF(width='800',height='600',frameRate='24')]
public class A extends MovieClip {
private var b:B;[code]....

this.graphics calls do nothing in draw method, but work fine inside B`s constructor, what i am doing wrong ?

View 2 Replies

ActionScript 3 :: Draw Two Shapes On The Same Movie Clip's Graphics Avoiding Alpha Blending Between Them?

Dec 4, 2010

for example:

var mc:MovieClip=new MovieClip();
mc.graphics.beginFill(0x000000,0.5);
mc.graphics.drawRect(0,0,100,100);

[code].....

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 2.0 :: Lock Graphics Position To The Right?

Aug 20, 2005

I have a full size page and want a graphic to stay locked to the right so when resizeing the broswer window the right side of the graphic stays on the right and the left side disapears into the left or shows more if the page is resized more, without scaleing the page size. I know how to do this in CSS but not actionscript yet?

View 3 Replies

ActionScript 3.0 :: Position Graphics In A Circular Pattern ?

Jan 13, 2010

how to position graphics in a circular pattern and they space out evenly depending on how many graphics are in a given array.So now, I want to be able to rotate the graphics in a clockwise or counter-clockwise pattern (not a sprite container that holds all of the graphics, but the graphics themselves.)

Code:
private function weaponChange(e:KeyboardEvent):void {
if(e.keyCode == LEFT_KEY1 || e.keyCode == LEFT_KEY2 || e.keyCode == DOWN_KEY1 || e.keyCode == DOWN_KEY2) {
for(var i:uint = 0; i < _weaponSymbols.length; i++) {[code]....

So this gets each graphic to the next location just fine. Now notice what I have in red... I want the graphics to animate along the parameter of the circle. All I need to do that is to identify the x,y coordinates between the two graphics. I can just subtract the y of one graphic from another... the x is something I have no idea how to do...

View 2 Replies

ActionScript 3.0 :: Get Bitmap.draw() To Work?

Apr 16, 2009

I can't seem to get bitmap.draw() to work. I've used it before in exactly the same way but this time Flash decides to put out this error:

"ReferenceError: Error #1069: Property draw not found on flash.display.Bitmap and there is no default value."

With the following code, tile1-5 are movieclips in the library consisting of a few instanced movieclips inside them.

Code:
// Add the tiles from the library into arrays for each area.
private var a1Tile1Bmp = new Bitmap();
private var a1Tile2Bmp = new Bitmap();
private var a1Tile3Bmp = new Bitmap();

[Code]....

View 3 Replies

ActionScript 1/2 :: Bitmap Data Can't Draw MC With FLV

Aug 1, 2010

I've created a prototype that will copy the pixel data from a movie clip then create a JPG image from it via PHP. It works perfectly. But when the MovieClip (called mcImage) contains a Video Object loaded with a streamed FLV, it won't copy the pixel data to the Bitmap object. The image generated is white. Here's a sample code:
 
var oBitmap:BitmapData = new BitmapData(nW, nH, true);
var oMatrix = new Matrix();
var oColorTrans:ColorTransform = new ColorTransform();

[Code].....

View 4 Replies

ActionScript 3.0 :: Draw Bitmap With Exectfit?

May 16, 2011

I have a movieclip with textfield placed on it. My stage size is 1003 X 560 pixels. When i open it in html page with exectfit and 1366 width and draw bitmap of that movieclip. Then text always gotowards right.

View 3 Replies







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