ActionScript 3.0 :: Tell BitmapData Do Draw MC On Custom Coordinates?
Dec 30, 2009
How to tell BitmapData do draw MC on custom coordinates?
when I call draw function, it has not got argument of coordinates, where to draw, and It draws on x=0 and y=o coordinates, and if I want x=50?[code]...
View 6 Replies
Similar Posts:
Jan 9, 2012
I am having an issue with using BitmapData.draw(stage). I am getting the following error:
SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: file:///C|/Documents%20and%20Settings/bla...bla...bla.swf cannot access null. No policy files granted access. Here is a portion of my code:
var bd:BitmapData = new BitmapData(2800, 2100); bd.draw(stage);//this is where the error happens All of the files referenced (.xml/.jpg/.swf) are located in the same local folder as the main .swf. How do I get around this error? The main objective is to print the stage using PrintJob(). I am using Flash Professional CS5.5 and publishing to Flash 10.0/10.1. Let me know if I need to supply any more info.
View 4 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
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
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
Jun 30, 2011
I'm making something that requires me to draw() the youtubeplayer Giving me this pretty error:
[Code]...
View 4 Replies
Dec 15, 2009
I'm trying to do some lean blitting for an object that rotates by rotating it once at startup and capturing a BitmapData snapshot of each 5 degrees. The problem I'm having is that the draw() method of the BitmapData object is only picking up pixels in the MovieClip that are below and to the right of the registration point. If I change the MC so that the registration point is in the top left corner, I sometimes get what looks like most of the pixels, but the entire object rotates into and out of the frame, since it's rotating around the corner and not the center.
View 5 Replies
Dec 16, 2010
i have a class thats create a class with bitmapData that merge 2 IBitmapDrawable. one of them is 24*20 while the other is 16*16.i want to draw the smaller first in a bitmapData object which its width and height are 24*20 but i want to draw it in the center of the big bounds.
[Code]...
View 2 Replies
Dec 19, 2009
is it possible to give specific x and y coordinates to a BitmapData?
you can give the width and height, but no x or y... I dont want it to start at (0,0)
ActionScript Code:
var bmd : BitmapData = new BitmapData( m_mask.width, m_mask.height, true, 0xFFFFFFFF );
View 4 Replies
Oct 6, 2007
After seeing the I've been told that movieclips aren't suited for games, what do you use? thread, I thought I would try to incorporate the approach into a game I'm currently programming to make it a little less processor intensive.
I have a giant movieclip of a football field, of which only 5-10% is shown at any given time. I'm guessing that flash still has to make calculations for the other 90-95% of the field every frame, even though it's of no use. From what I understand (not much), copyPixels seems like the perfect candidate for such a situation.
It seems simple, but I'm having trouble actually implementing it, and I'm not sure which actions are needed and what might be introducing unnecessary work. I have a movieclip (mc_field, exported for as), but if it would save the processor some effort,I could easily save this as a bitmap and export that for actionscript. The width and height of the final product (bitmap/BitmapData) will be Stage.width, Stage. height,respectively,and I can handle making the calculations of the x,y coordinates of the rectangle cropping (which part of the source bitmap I want to crop).I'm sure it's only 3 lines of code, and I know that there are a few examples online, but for some reason.
Say, for frame one, I want to take the field (either mc_field or bm_field) and copy 500px x 300px, starting at 140,230 from the source bitmap to mc_container.Then, for frame two, I want to copy 500px x 300px starting at 240,540 from the source bitmap to mc_container.
View 4 Replies
Oct 2, 2009
If i have a set of xyz coordinates,
[Code]...
how do i draw them to screen seeing as they will not be straight lines?
View 2 Replies
Oct 2, 2009
I have problem when drawing transparent png image on transparent bitmapData.
code of first frame:
stop();import flash.display.Bitmap;import flash.display.BitmapData;import flash.display.BlendMode;import flash.geom.ColorTransform;import flash.geom.Matrix;
var bmd: BitmapData = new BitmapData(500, 400, true, 0);var bitmap: Bitmap = new flash.display.Bitmap(bmd);addChildAt(bitmap, 1);
[Code]...
View 1 Replies
Nov 16, 2011
I want to extract a bitmapdata from one of the first frames of a video flv, and it works correctly in Flash debug with these statements[code]...
When i test this in [url].. not work, I've inserted trace statements before and after this, and only the first are displayed.
View 9 Replies
Aug 8, 2010
how can I draw strings onto BitmapData, is there something like Java´s Graphics.drawString()?
View 2 Replies
May 20, 2011
the problem may be a simple one but I can't figure it out. I have an image loaded into BitmapData. now I want to take text from a textinput and put it on the BitmapData. Basically it's drawing a text on the BitmapData and get the result as another BitmapData that will consist of the original BitmapData with the text drawn over it on a specified position
View 2 Replies
Jan 6, 2012
Right now I only have this code, but I'm not using BitmapData.draw(). How can I write my code using BitmapData.draw()?[code]
View 2 Replies
Nov 17, 2009
When is a Bitmap not a Bitmap ?I can apply (using Sandy) an image as a texture :
var material:BitmapMaterial = new BitmapMaterial(new myImage(1,1));
myCone.appearance = new Appearance( material );
I can trace an object and form a bitmap :
[code]......
View 1 Replies
Apr 28, 2010
I am trying to copy an image.The green stuff on the first image is a mask(which is not set, its just there to show it)Everything works fine when I dont set a mask to an image (picture 1)But when I set the mask I get picture 2.What I want is to copy a part of the image which is visible when the mask is set. I know what size the mask and image are going to be so I can calculate the size of the area which i need to copy.This is the code I am using, image has registration point in the center, thats why i use matrix.translate (not sure if its the right way).Also there is no image scaling applied (there might be later), thats why I am using matrix.scale.
Code:
var _reflectionHolder:Sprite = new Sprite();
addChild(_reflectionHolder);
_reflectionHolder.y =_targetObject.y + _targetObject.height / 2 + 10;[code]......
View 0 Replies
Mar 25, 2008
I'm building a flickr application in flex at the moment but i keep getting sandbox errors when i invoke BitmapData.draw();.After doing some google research i found that the proper policyfile needs to be loaded.i do this using: Code:Now this still doesn't resolve the issues. Upon further research i found that i need to check the policy file first using checkPolicyFile = true;
View 2 Replies
Nov 20, 2009
I'm trying to use images from wikimedia to tile a shape, but Wikimedia does not use crossdomain.xml files, so I get a security error whenever I try to do anything with BitmapData.draw().
[Code]...
View 3 Replies
Jan 16, 2012
I'm new to Flex, I've tried to do this using a CartesianDataCanvas inside backgroundElements in mxml, then using ActionScript to draw lines on the data canvas using moveTo(x1,y1) and lineTo(x2,y2), which draws a line between (x1,y1) and (x2,y2).
The problem with the above method is the tick mark length is a function of the chart area (which depends on the browser window size).
What I need is a method that:
(1) starts at a data coordinate (e.g. moveTo(x1,y1) works fine for this)
(2) draws a line to a screen coordinate (e.g. lineTo(x_screen, y_screen) where x_screen and y_screen are screen coordinates).
Is there anything that can accomplish this in Flex/AS3?
Alternatively, could I use screen coordinates for both steps above? If so, how to convert between screen and data coordinates? For example, is the upper right corner of the screen always a fixed data coordinate that I could reference is creating such a conversion?
Alternatively, could I save a five-pixel line in Illustrator and simply paste that image in the chart somehow? If so, how to paste it exactly at a data coordinate?
View 1 Replies
Dec 17, 2009
I have a sprite with some objects in it which are transformed in 3D (positioned and rotated). The objects form a coneshape in such a way that the objects that make up the back are hidden.When I use that sprite as a source for the bitmapData.draw() it is drawn from another viewpoint so it seems. In my case the copy is viewed slightly from the bottom and right.
Bottomline:Does anyone know of a way to duplicate the image of a sprite which contains 3D manipulated graphics?
View 2 Replies
Apr 9, 2011
I am using NetStream.appendBytes() to play a local video (no server involved) in Adobe AIR. I would like to use BitmapData.draw() to take a picture of the video output, but I am getting this error:
Error #2123: Security sandbox violation: BitmapData.draw: cannot access null. No policy files granted access.
Here is some sample code:
package
{
import flash.display.Sprite;
import flash.filesystem.File;
[Code].....
This is only sample code use for an explanation. The error would happen when calling the getImage method while the video is playing. The error mentions a policy file not found. Since the file is loaded locally there isn't really a place to put a policy file. Is there a policy setting somewhere that needs to be set or is the BitmapData.draw feature just not available when using appendBytes?
View 5 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 4 Replies
Jan 26, 2011
I know half of the problem:the embedded movieclip is "content" of a Loader, and you can not draw Loaders directly with bitmapData.draw(aLoader);with a normal Loader, you could access the Loader.content and draw it but not in the embedded case.adobe forums could not give an answer to this and i searched for hours through the web ...
[Embed(source="aMovieClip.swf")]
private static var AMovieClip:Class;
//...
[code]....
View 3 Replies
Apr 13, 2006
I am trying to load a external swf and then use the BitmapData.draw() method to draw the loaded swf to a bitmap. This does not seem to work. If I draw some lines into the loaded swf using the .lineTo() method and then use BitmapData.draw() i do see the lines that are made by this method, but not the content i put in the swf. Is it just not possible to do this
View 1 Replies
Dec 14, 2009
I have a problem with strange memory allocation. I tried to illustrate the problem on a sample application, you'll find it in the attached zip file, or you can open this page: [URL] You'll also need something to see the memory currently allocated to flash applications - I use WSMonitor, please open it here: [URL] The code in the sample application is very simple. It does the following (please run the WSMonitor html, press "Start", and open the test page from above in another tab/window):
1. Download a file called "sample.swf". This is a swf file generated from PDF using pdf2swf tools, I'm sure you know this utility. The swf looks fine, it contains some images, but for some reason it causes me trouble - see below.
2. Once the file loads, I try to draw and display a bitmap representation of the loaded file, using bitmapdata and its draw function. So far so good. Note that I store the reference to the loaded MovieClip - I need it! Well not in this case, but say I might need it later.
3. Once the bitmap is displayed, you can click in the application. This should result in disposing of the bitmap. However, if I watch the memory allocation using WSMonitor, the memory usage won't drop down to the expected values - some tens of MB still remain. And that is the problem - say if I do this repeatedly with more swf files like this, I will have some hundreds MB of useless memory in my application - not cool.
From what I understand, the memory usage of this simple application goes as follows (let's say that after the start of my application, the usage is 0). After the swf is loaded, the usage goes to say +1 MB (reflecting the fact that I've downloaded some data). After the bitmap is drawn, the usage jumps to say +40 MB (why so much?).
[Code]...
View 9 Replies
Apr 30, 2010
I have been pulling my hair out on this one for too long. I have a web banner that uses Erik Hallander's Pixelator Class. Everything works fine when the timeline plays just once, but as soon as it loops I get error:
ArgumentError: Error #2015: Invalid BitmapData.
I have tried removeChild, removeEventListener, nulling the variables involved, disposing of the BitmapData. I also tried some conditional statements depending on the loop but no success. The actual class code is beyond my experience.
View 1 Replies
Jan 31, 2009
I'm trying to create a simple flash that will draw the Mandelbrot set by looping through coordinates, sending those coordinates through iterations of the Mandelbrot function and drawing a line at those coordinates, who's color is dependent upon the amount of iterations taken. Here is that code:
ActionScript Code:
var dot:Sprite = new Sprite()
this.addChild(dot)
for (var X:int = 0; X <= 500; X++) { //Iteration for horizontal
[code]....
View 2 Replies
Jan 17, 2010
I'm using BitmapData.Draw to draw a masked movieclip to a bitmap.Flash behaves very strangely in many different ways. To give a couple examples:1) Normally, the position of the mask is relative to the masked object. Ex. if I Draw() the movie clip at 10,10 and the mask's position is 20,20, then during the Draw() the mask will effectively be at 30,30. Weird, but consistent. However, if I Draw() the mask to another surface first, and then Draw() the movie clip, the mask position will be absolute (20,20 in the example)
View 3 Replies