ActionScript 3.0 :: Drawing Bitmapdata With Negative Top Left?
Apr 20, 2009
I wanted to use the well known method for turning your vector graphic into bitmaps.Ie, something like:
Code:
var bmd:BitmapData = new BitmapData(src.width, src.height)
bmd.draw(src);
[code].....
View 1 Replies
Similar Posts:
Sep 13, 2009
i am trying to draw in flex in all four quardrants!i mean i have a 2-d plane,and i have values that i have calculated now i need to draw these in a plane! i tried the plotchart, but it only works in first quadrant,it doesnt take negative values!
View 0 Replies
Jun 23, 2010
I've seen the BitmapData object used for graphics a fair bit, especially in games. Many of these cases have done things in somewhat fundamentally different ways, and I was wondering what the best way generally is.
Method 1: Each animation frame is kept in a separate BitmapData object using an array.
Method 2: The animation is kept in a strip using a single BitmapData object and using the "sourceRect" parameter of copyPixels.
The draw and hitTest methods appear not to provide any "sourceRect" parameter. Most of the code I have seen using method 2 has worked around this by copying the bitmap frame into a temporary bitmap for these methods. This seems like quite a large processing overhead to me. Using method 1 this is generally not a problem, unless hitTest needs to be used with scaling and/or rotation, in which case a temporary transformed copy is still needed it seems as hitTest doesn't except a transformation.
I'm thinking method 1 is the better choice since it avoids having to make temporary copies for the most part, and I don't think it would waste much memory (just the duplicated width, height, etc values?). Is this generally true or is there a reason lots of people seem to do things the second way?
Also is there a better way to use hitTest for bitmaps that have been scaled, rotated, etc?
View 1 Replies
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
Mar 16, 2010
I have a huge background bitmapdata with a corresponding grid. I'm trying to draw the two parts onto a different bitmapdata, but for some reason, the bitmap for the grid is overriding the bitmapdata of the background that is being drawn first. The grid seems to be making the entire third bitmapdata transparent for some reason.
My code for creating the background and corresponding grid:
Code:
viewWidth=stage.stageWidth;
viewHeight=stage.stageHeight;
bmdScreen=new BitmapData(viewWidth,viewHeight,true);
[Code].....
I want to draw a grid on top of the background I have. For some reason, the grid is making the background underneath it transparent.
View 1 Replies
Mar 17, 2011
having a problem while drawing a complex combinations of TextFields into BitmapData in as3,The problem happens when i change the parent's (x,y) or (width, height) and the drawn object got a bad effect like left blur.[code]
View 3 Replies
Feb 6, 2011
I have the following display hierarchy:- - container- - - objectI need to draw 'object' to a BitmapData instance which matches object.getBounds(stage) rectangle area. So the first part is easy:
ActionScript Code:
var rect:Rectangle = object.getBounds(stage);
var bmp:BitmapData = new BitmapData(rect.width, rect.height, true, 0x00000000);
[code]......
View 2 Replies
Feb 19, 2010
I have a drawing application likewhere the user can select a brush size to draw.I need a way to determine that all the surface has been drawn.
View 2 Replies
Oct 29, 2009
I have a comic book style game where you have to complete the story by dragging the right frame to the right place, but when I drag the frames pieces of the frames left behind and sucked on the screen. The frames are loaded swf files.
View 2 Replies
Apr 16, 2009
i am creating a very simple particle system. My only issue is trying to create a blurry trail effect on the particles in motion. I started by creating a large bitmap container, and applying a colormatrix filter and a blur filter . It seems to do the trick , but the issue now, is i have to make this container cover the stage, which has a two unwanted a effects:
-it's slower
-it covers all the content beneath. Perhaps my approach to creating trails is wrong?
i can post the whole class, but before i litter this post with long lines of code, is there a way to place a bitmapdata drawing over content and still get the desired effect. NOTE, if make transparency false in the bmdata, i loose the effect
View 2 Replies
Mar 31, 2011
I'm getting this one: Error #2123: Security sandbox violation: BitmapData.draw
while I try to draw the image of a video from a rtmp server onto a BitmapData object. The workarounds I've found all apply to a SWF file being loaded from another domain. This involves having logic in that file.However, I see no possibility to place logic into the video and hardly have access to the (WOWZA) video server of which there are multiple and to me unknown ones at forehand due to the CDN's load balancing nature.
View 3 Replies
Oct 14, 2010
I'm looking for the most efficient possible way of drawing an 8 x 4 grid (960x600 total size). Each square of the grid has a variable alpha and the grid is redrawn every enter frame. The problem is my application is doing a lot already and I'm looking for the most efficient way to execute this loop 32 times (possible more in fact) per frame without overloading processor.
Code:
private function init():void {
var dimensions : Array = [ 0, 0, 960, 600 ];
var gridRaw : Array = [ 8, 4 ];
var stageRect : Rectangle = new Rectangle( Number( dimensions[0] ), Number( dimensions[1] ), Number( dimensions[2] ), Number( dimensions[3] ) );
[Code] .....
I'm under the impression there could be better ways of drawing the shapes straight to BitmapData without using Sprites, or maybe I'm doing something wrong about memory usage as I can see memory going up and down in a cycle.
View 5 Replies
May 27, 2011
I am using a custom Flex skin to create an active blur/frosted glass effect on the background of floating Panels, TitleWindows, and other containers (similar to http:url....). There is a background image in the Application skin, and potentially any number of other components above and below the active blur component. Here's some relevant code within the skin:
public static const BLUR_FILTER :BlurFilter = new BlurFilter(16, 16, BitmapFilterQuality.HIGH);
private var _bitmapFill :BitmapFill = new BitmapFill;
private var _matrix :Matrix = new Matrix;[code]....
Unfortunately, the performance of this when the component is being resized, and especially when moved, is poor. There is noticeable drag delay and overall slowdown, and this is with only one popped-up TitleWindow in the test application. There is especially poor performance when components inside the TitleWindow are changed (button hover states, etc.)I've attempted to optimized a little bit by avoiding reinstantiation of the blur filter, bitmap fill, and matrix, but this has had little or no effect. I removed the blur at one point, just drawing the Application to a bitmap, and the performance is still poor, so it's clear that it's mostly the BitmapData.draw() call.
I've read about using scrollRect and cacheAsBitmap, but I'm not sure where to apply these properties (or other optimizations I'm not aware of) within the Application or its components.
View 2 Replies
Jul 17, 2011
check if a negative number is less than another negative number. The if condition logic seems to be in order as far as i can tell but it doesent work for some reason :
Code:
public function minuscheck(testnumber:int):void
{
if (testnumber < -1)
[code]....
View 6 Replies
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
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
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
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
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
Jul 2, 2008
i hav a left right moving thumbnail gallery from xml, i need that on the last image image come on focus from the left side so automatically the left button will be disable or opacity goes 0 anything and same thing from right side also.
View 14 Replies
Jul 20, 2006
I have a series of thumbnails that should scroll from left to right & right to left when you roll over the movie clip buttons on either side. IT was working in another flash movie, but I moved it to a different flash file and now it's not working. The hit buttons within the movie clip buttons have this action script:
[Code]....
View 6 Replies
Sep 11, 2009
looking to create an image/mc slider that moves form right to left via user clicks of a left and right button.I would assume I would create an array to hold a series of mc's in (my images) and then tell the left and right buttons CLICK events to move linearly through the array (displaying next in line and previous etc.
View 1 Replies
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
May 12, 2010
I've some components with dynamic heights. They have to be aligned with respect to the bottom of my canvas container, so I cannot set the same y for all components.
I could compute their heights and successively set the y but I was wondering if there was an easier way to do it.
View 2 Replies
Jun 22, 2011
I have an Image called "PanoramaImage" (which is very long in width). I want this image to move from right to left & from left to right automatically.
I am using flash as3. I am loading this image from the same folder where the .fla file exist. my image to move by using Up & Down arrow keys.
The following is the sample code i found on web.
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, completeHandler);
loader.load(new URLRequest("panorama.jpg"));
[Code]......
View 7 Replies
Apr 24, 2005
I have an Image called "PanoramaImage" (which is very long in width). I want this image to move from right to left & from left to right automatically.I am using flash as3. I am loading this image from the same folder where the .fla file exist. Right now I have the code which will help my image to move by using Up & Down arrow keys.The following is the sample code i found on web.
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, completeHandler);
loader.load(new URLRequest("panorama.jpg"));
var content_mc:Sprite = new Sprite();
[code]....
View 3 Replies
Sep 14, 2009
My vision is to have a colored square at the top of the site Im working on which should span across the entire browser window. I have created a square 1280 x 100 pixels in size and imported it to the stage, alignment is set to x=0, y=0 ad alignment. The scene is the same size as the square I 've imported. When I view my Flash creation its displayed 8 pixels from the top left corner of the browser window. The flash file only contains the square and nothing else. take a look at the 3 files I've attached: issue-scrreen1-3.jpg. The first 2 screens are my Flash, properties and library screen shots. The third screen shot is my browser window.
View 2 Replies
Oct 19, 2003
I have a movieclip with the instance name of top. I want the box to grow from right to left, not left to right. Here is my code:
[CODE]...
View 4 Replies
Nov 9, 2010
i've tried to simulate a pencil tool, for drawing above a imagem, but the drawing is below the picture. How fix it?
[Code]....
View 3 Replies
Jul 22, 2009
Basically I've got a reasonably complex drawing object in a fla and I want to reproduce it in a class definition using the drawing api. However obviously this is a tedious task, so is there some trick or automated method of doing this?
Last time I needed to do this it was a drawing of an arrow and I ended up writing down x,y,width,height values for everything but this one has curves in it which I don't have experience with drawing anyway.
View 2 Replies