Flash - Cut A Shape Out Of BitmapData?
Dec 5, 2010
I have a filled Shape, and a BitmapData that is the same width and height as the Shape's bounding box. I need to cut the Shape from the BitmapData (basically draw the BitmapData onto the shape...) [URL]I use the rather hackish method of:
public static function cutPoly(img:BitmapData, s:Shape, bounds:Bounds):BitmapData {
var temp:BitmapData = new BitmapData(bounds.width, bounds.height, true);
Main.inst.stageQuality("low"); //hack to kill anti-aliasing
[code]....
View 4 Replies
Similar Posts:
Dec 10, 2007
How can I attachBitmap to an irregular shape?I load a pattern into my movie (pattern.jpg), it is a square image 500x500. I want to draw that image onto an irregular shape. If I do the following it simply shows the large square overtop of my shape. The pattern isn't actually applied to my shape.
Code:
var bitmap:BitmapData = new BitmapData(500, 500, true, 0x00000000);
myShape.attachBitmap(bitmap,1,"auto",true);
bitmap.draw(pattern);
View 2 Replies
Dec 7, 2010
Imagine you have two BitmapData objects that you want to combine into one. One framed inside the other. CopyPixels seems the best approach no doubt, but what implimentation of it would you say is the most optimised?
1) Print the image that will be the frame, then just print the second image on top
2) Break down the dimentions of the 4 sides of the frame and the image inside then just print them to the screen
3) Get the shape of the picture and use it to somehow cookie cutter the frame image and print them both in whatever
[Code]...
View 3 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
Nov 30, 2009
ActionScript Code:
package {
import flash.display.MovieClip;
public class Base extends MovieClip {
public var baseHP:int = 50;
var newRect:Shape = new Shape();
1046: Type was not found or was not a compile-time constant: Shape. 1180: Call to a possibly undefined method Shape. What does it mean by "undefined method"? I am somewhat of a newby, so sorry if there are any stupid errors
View 1 Replies
Jun 22, 2010
Whenever I add shape hints to a shape tween the shape disappears in the between frames. I am using CS5 on Vista. I using files from [URL]to practice.
View 2 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
Oct 11, 2011
need to draw the shape of a existing movieclip which is irregular shape.
View 2 Replies
Oct 11, 2011
need to draw the shape of a existing movieclip which is irregular shape.
View 1 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 9, 2009
Id like to know if there is a way to do a shape hitTest.Not as the normal hitTest would do, but shape colliding another shape, not the rectangleof a movieclip.It can be in a movieclip.
View 23 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
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
Oct 19, 2010
using the shape tool you can draw basic shapesthen using the subselection tool you can re-shape them by relocating certain points
What i want to do is create a tween whereby one of the points is movedthe problem is you have to convert to a symbol first and after you have done that you cant change the shapes shape.so how do i go about using a motion tween to change the shape of a shape?
View 1 Replies
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, 2009
The title might be a little misleading. Look at my code and I will explain
public static function loadTile(tileDir:String = "empty"):void
{
if(tileDir != "empty")
{
tPoint = new Point(0,0);
tRect = new Rectangle(0,0,30,30);
[Code]...
I am trying to do tiling with sprites. I want my tiles to be interactive, so that is why I am using the sprite object instead of using regular bitMaps to represent my tiles. You might be wondering why I wouldnt just use graphics.beginBitmapFill(tImage); and graphics.drawRect(0, 0,tWidth ,tHeight ); to pick out the tiles I want to use. Well reason being is because it turns out that drawRect() first and second parameters actually alter the location of where the actual sprite sits at.
So if I set the x and y properties of the sprite to x = 20, and y = 20. then I set my drawRect(20,20). it actually adds an extra 20 pixels to my x and y coords of my sprite. And I know the reason why, I just need to know a better way.
View 2 Replies
Jul 30, 2010
I am completely in the woods here - i have a sprite with a shape drawn in there (there are two different sprites in the example.) At any given point, I need to get the x and y value of the topmost point of the shape. The sprite does rotate so it's going to change at any point as well. I don't even know where to begin here
View 2 Replies
Dec 8, 2009
I'm trying to load several jpeg images dynamically XML into bitmapdata object in fla. I can see them on the stage of this .swf file.However, I load it into another .swf which is my main to call while clicking on one of menu option.I got this error:Error #1034: Type Coercion failed: cannot convert com::Fashion@1daf4ca1 to flash.display.MovieClip.Does anyone know how to convert that??
private function initBitmapFile(file:String):void
{
loadBMP = new Loader();
[code].......
View 1 Replies
Jun 6, 2010
When I use it, the only thing that is filled is a white rectangle, doesn't matter the parameter.This is what I do:var map:Bitmap = new Bitmap (new BitmapData(200,200))map.bitmapData.fillRect(new Rectangle(0,0,100,100),0xFF0000)A 100x100 rectangle is added to the bitmap, but it is always a white shape. I want it to be red, as set in the parameter (0xFF0000).
View 1 Replies
Nov 14, 2009
Can a flash.display bitmapData object be converted to flash.displayObject? i bump with an error when i tried to convert a bitmapData to DisplayObject
=> setChildIndex(DisplayObject(bitmapData),0);
"TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::BitmapData@35f4779 to flash.display.DisplayObject."
View 2 Replies
Sep 8, 2009
is there any sample on using array bitmapdata to record video from webcam and generate flash movieclip file? i want to record sound as well without using red5/flash streaming server
View 3 Replies
Aug 11, 2010
Is there an option to rotate a shape 90 in Flash CS5 Professional?
View 2 Replies
Jun 19, 2011
i have rectangle movie and i want to make it triangle or round so it show round in the page. can i do so with i embed it or it must be done in flash before i export swf?Also i forgot how you make transparent area in flash?
View 1 Replies
Sep 26, 2009
I'm using Flash CS4 on a MacBook Pro with Snow Leopard OS X 10.6.1.I've added two shape tweens on two layers in my main timeline. The SWF tests fine. All is good.I close the document.I open it up again and the tween shapes are gone and there are only regular frames between the transitional shapes in their respective keyframes.I've already added shape hints, and they are completely restored when I convert the intermediary frames back to shape tweens.Exporting to SWF after restoring the shape tweens works fine.
Closing and then opening the FLA still results in the shape tweens reverting back to regular frames.Exporting an SWF from the newly opened document shows no shape tweening as it is gone from the main timeline.Is this a bug or am I doing something wrong?
View 5 Replies
Nov 3, 2011
I want to make a Shape Tween where a text of a small size increases in size. I followed a tutorial, and I did what it tells me: I put the starting text in the first frame, create a blank keyframe at the end where I put the bigger text, I then use the selection tool to right-click on both text objects in the video clip and select Break Apart which I do twice, and then I should be able to create a proper Shape Tween... but when I click on a random free and either right-click or go to Insert, Shape Tween is greyed out. How come? I also tried the other Tweens, but they don't do anything.
View 5 Replies
Mar 19, 2011
I am using flash as3.I have some shapes I have drawn on the screen. They are made using:
graphics.beginFill(0x00ff00);
graphics.drawRect(0,0,50,50);
graphics.endFill();
to draw them. Each shape has a different color for fun (different beginFill).How can I get the color of the shape under the mouse pointer as I move the mouse around the shapes?I see two choices so far but don't know how to do either of them: Get color under the mouse point get the color from the shape properties (preferred)how to do either of these...
View 3 Replies
May 3, 2011
I was wondering if there any way to change movieclip shape, when it on stage by as2.
View 1 Replies
Oct 22, 2011
The issue I am having is how to tackle forming a logo using circles. I have done one letter manually, however it would take forever to do this with every single letter, and so I am asking here if anyone knew of a faster method. Requirements:
- Has to fill non-circular letters(i.e. does not have to be precise, but look like it has edges)
- Circles have to animate in, therefore they need to have drop shadow and seem like they are landing in place
View 1 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