ActionScript 3.0 :: Remove Transparent Area From Bitmap?
Sep 17, 2010
So I have a BitmapData object that's 400x400, and is mostly transparent with a small area (up to 50x50) of color somewhere inside. That's drawn to a bitmap, and now I somehow need to generate a Sprite that is only the dimensions of the small colored area, and sits in the same place on the screen.The size and position of the colored area is variable, and the operation to create the new Sprite must be near-instantaneous, so no lengthy pixel comparison exercises.
View 2 Replies
Similar Posts:
Sep 18, 2008
I am importing some graphics on the fly, and want to be ableto drag them around the stage, which all works great. My issue isthat if I add a large element, like a border around the edge of thestage, this covers up all the other items so that clicking on themis not possible. I can see them, but when I click, the large itemgets the event, even though visually, it is transparent. There arethings I could do if I was doing all the development of thegraphics in the IDE, but these items load at runtime, so it has towork with bitmap
View 1 Replies
May 29, 2009
i am loading a background bitmap into a sprite. after that i make this sprite draggable. now i would like to have a copy of this sprite where just the area with the non-transparent parts of the bitmap react to the click.
i know that i can determine if a pixel is transparent with the getPixel32() method, but it seems to be overkill to anylyze every pixel... or is it not?
View 9 Replies
Aug 5, 2011
I have this function:
public static function cloneDpObj(target:DisplayObject):Bitmap
{
var duplicate:Bitmap;
[code]....
to clone target displayObject (MovieClip or Sprite) and return Bitmap Object.
It can get bitmap from the target object, but it seem don't get all the area of the image.
By give the width and height of target object, but the target object in design was applied by Glow Effect, so my question can we get the all view of bitmapdata from a displayobject?
View 4 Replies
Feb 27, 2010
I am creating a map in flash cs4 with all the countries on it. I used photoshop for creating the map and separated countries. Now I imported all pngs in Flash and I want to give Mouse CLICK event and Mouse Hover on all pngs, but as the transparent pixels are overlapping the other states, it is getting difficult. So, I converted all pngs in movieclips and now then I broke up pngs. Now I want to delete all pixels having alpha 0 using eraser tool, as per the borders. And I have to do it manually for individual countries. So is there a way to remove transparent pixels from the bitmap data?
View 2 Replies
Jul 8, 2009
How do I set an area to be transparent in ActionScript 3.0?At the moment I'm creating a subtitles area to sit over the player and it has the following code:[code]
View 1 Replies
Jan 28, 2010
On the opening of the map where it shows a transparent red spreading would you create the growing red transparent area over the map in the Pacific with transparent shape tween. Also any tutorials on doing this.
View 2 Replies
Jan 28, 2010
On the opening of the map where it shows a transparent red spreading would you create the growing red transparent area over the map in the Pacific with transparent shape tween. Also any tutorials on doing this.
View 6 Replies
Aug 11, 2005
is there a way to make a Text Area transparent?, I'm using this code:
_level0.taDescription.depthChild0._alpha = 0;
and works, but then, I'm loading that SWF in another SWF and I loose the alpha property?
View 2 Replies
Nov 29, 2010
I want to put a transparent area on my stage. When the mouse enters that area I want to be notified (so that I can do stuff).I expect to use some code like"addEventListener(MouseEvent.MOUSE_OVER, mouseInRemote);" - but the qustion is "What do I add to my stage?"
View 8 Replies
Aug 1, 2007
I have a .jpg graphic in a movieclip on layer two (1024/768). This is used as a background.I have a .jpg scrolling movieclip on layer one. It is a very wide graphic used for displaying a panorama.I would like to be able to create, dynamically using actionscript, a transparent area on the layer two movieclip (create a window) to view the underlying movieclip.I believe this is possible using the Rectangle class in the flash.geom.rectangle but I can't figure out how to attach it to the layer two movieclip or how to make it transparent so shows the underlying scrolling graphic.
View 4 Replies
Oct 17, 2007
I'm trying to make a button symbol with a transparent hit area - surounded but a dynamically drawn border. Heres what I have. I have a simple AS script that uses goTo and lineTo (plus a randomizer to make sure the buttons are skewed and differnt everytime) to create a "sketchy box" as my button. My script resides in a movie clip withing the "over" state of a button symbol. Now the active hit area is ONLY the line elements. Question : How in the world, using only actionscript an I make a second, transparent area inside of the sketchy lines to make the whole button symble clickable?
View 5 Replies
Apr 2, 2012
I am making flash with mouse over its not working properly,
1) When mouse over the button not come the transperant area to entire pic
2) How can transparent area slowely to come mouse out
View 3 Replies
May 31, 2010
Can I check if a pixel is transparent or not in a bitmap?
I want to count the nr of transparent pixels and nontransparent pixels.
View 0 Replies
Jul 29, 2008
i want to make all white pixels in my Bitmap transparent. i found the treshold-method and try to use it:
Code:
var pt:Point = new Point(0, 0);
var rect:Rectangle = new Rectangle(0, 0, 2000, 2000);
var threshold:uint = 0x00FFFFFF; // all white Pixels
[Code]....
View 3 Replies
Aug 25, 2009
I have objects that the user can click&drag. They're PNGs, mainly rectangular, no problem till here.But I then had to put an L-shaped object (a PNG with a lot of transparency), so i've made a movieclip with an shape with the same L shape than the png, and use it as its hitArea:
shape.visible= false;
shape.mouseEnabled= false;
obj.addChild(shape);
obj.hitArea= shape;
This works PERFECT, the mouse events respond as expected, and I can click on objects that are below/above the transparent area of the png/object.All objects are inside a Sprite called playgroundLayer1. The issue comes when I take the L-shaped object and put it on another Sprite (playgroundLayer2), that is above the playgroundLayer1.I this case, I can click&drag on the L, but no object below the transparent area of the L receives mouse events.
View 8 Replies
Feb 13, 2011
how to convert text into a bitmap or a mocieclip with transparent background. i could convert the text into bitmap but it has got a white background..
View 1 Replies
Mar 24, 2011
So I'm Bitmaping some heavy stuff to try bring down the [pre-render] and [render] which is quite high according to FlashBuilder's profiling. I thought this was going well until I realised that as soon as you change a MovieClip to a Bitmap, you lose the pixel based accuracy of the mouse move events (Over, Out, Move...), all your left with is the entire bounding box of the Bitmap, something which is less than desirable. I've got a game where many Bitmapped assets would be on top of each other in a scene, on the stage, arranged in various ways and need to have that pixel accuracy moving between each one and have exhausted my efforts as to how to achieve the same mouse move results with the Bitmapped guys as normal.
This, [URL], is a FLA which shows this operation, and you can see how it works here, [URL]. When it loads up, both items on stage are drawn Shapes, encapsulated in MovieClips, both that get a glow, if you hover over them. If you click the stage at all, the purple guy gets turned into a Bitmap and now, his 'hit area', when it comes to MouseEvents is his whole bounding box and you can only get through to the back green item at the edge slivers.
I'm also tracing the pixel which the mouse is over, so I can clearly tell when the mouse is over a transparent area, it's 0, but how can I tell the event to forward itself on down the chain to the green MovieClip?
Below is how it's now pretty much working for me,
var bitmap:Bitmap = this['bitmap'];
var shouldMouseOver:Boolean = bitmap.bitmapData.getPixel(event.localX - bitmap.x, event.localY - bitmap.y);
if(shouldMouseOver)
[Code].....
I shut off mouseEnabled for my item, when I know it's wrong, then I search for another item that properly fits the bill and if there is one, send an Event to that and break. If that one's also wrong, it'll do the same again, but each time taking themselves out of the loop.
This does work exactly how I want it to, but I'd always prefer to keep things like globalToLocal and looping, and reading from arrays for not frequently updated methods like listeners to MOUSE_MOVE. Is there a more efficient way to do this?
View 2 Replies
Mar 5, 2008
what i want to do is to preload some images, then multipy them on my scene ( the files are transparent png containing clouds ) the problem is that when i copy the bitmap data to create a new cloud, i loose transparency, and i can't get WHY here's my code
[Code]...
View 6 Replies
May 2, 2009
I am trying to use the bitmapData.setPixels method to set certain pixels in the bitmap transparent.But no matter what I do, it always seems to set the pixel(s) black (non-transparent).Here is my code:
[AS]
bmpd = new ImageFromLibrary(0, 0);
bmpd.setPixel(0, 0, 0x00000000);
[/AS]
why its not setting the pixel(s) transparent?
View 4 Replies
Dec 20, 2011
What I have is a bitmap as render cache for a sprite, and there're many of them present on the stage. I expected that they would react like sprites with mouse-click event, but they didn't. They're like rectangles all around, matter what the original sprite look like, And I tried put bitmap cache into sprite container and use sprite's hitArea property like [code]...
View 1 Replies
May 12, 2010
I am trying to distort a bitmap, I mean, I have this bitmap in the main stage and I want to drag a section to. I don't know, maybe drag the eye of the character in the picture but I want all the bitmap to react or at least the closest region of the point I am dragging. Is that possible? I know the drawTriangles() that is been use to gave this 3D effect, but I need something different.
View 3 Replies
Jan 7, 2011
I need to be able to detect a fill area for something similar to a coloring book picture. The user will click inside the area that needs to be filled. The image is user created bitmap content and so the fill area must be detected at runtime. Posting Flex 4 code for review:
<fx:Script>
<![CDATA[
protected function myImage_clickHandler(event:MouseEvent):void
{
[Code].....
btw stack exchange says my rep needs to be 15 for me to vote up the great answers the commenters have provided. i have 14 at this moment...
View 2 Replies
Apr 28, 2011
The background of the png images is transparent but is not actually transparent if I load the png with transparent background and add into a sprite. The transparent part also can receive the mouse event so I wanna know how can I remove these pixels?
View 5 Replies
Jan 28, 2009
Iv created an app in work which needs a rubber. I basicly have a tool to draw line (paint/pencil). This draws over the entire stage area, including over buttons and interactive mc's. Once i draw the line i then want to be able to erase bit of it.
To this end iv made an eraser tool, which works well. I turn the line into a bitmap, then turn the eraser line into a bitmap and use BlendMode.ERASE to erase one from the other. My problem is, because when creating the bitmatdata i have to create a rectangular shape, the area created then means that i cant access any of the buttons underneath.
here is my code:
ActionScript Code:
//line array is an area of all the line objects which are currently live on stage.
for(var i=0; i<lineAr.length; i++){
[code]....
The way i see it i need to remove the transparent pixels from delBitMap once the erase has been done.
View 2 Replies
Sep 27, 2011
I am using the floodfill method to colour-in sections of a bitmap image. That part is easy enough but the issue comes in with the way I am adding an effect to the colour fill routine.
To add the effect, first a copy of the bitmap data is created and floodfill is used on that instead of the original bitmap. Then the bitmapdata.compare method is used to set the alpha value of everything apart from the filled-in section to 0 and the result is saved in another bitmapdata. After that, a 1 px radius circle sprite is added to the stage and is being tweened to the image dimensions and its mask is set to the sprite which contains the result of the compare operation.
This works perfectly except for the fact that the fill sprite has to be tweened to the complete image dimensions irrespective of how small the area is being coloured-in since I am not able to find a way to get the dimensions of the fill area. I am doing an bitmap image update at the end of the tween and I have to disable user interaction till the tween is complete to avoid the errors which come in if another fill-in operation is started before the base image has been updated. If I could somehow get the dimensions of the fill area then the time during which I have to disable the user interaction will go down considerably.
View 3 Replies
Oct 30, 2011
I have added a bitmap in movieclip using attachBitmap in my Flash Actionscript 2 project. Now i am having trouble to remove bitmap that is created once. If anyone can give idea how can i do this.
View 2 Replies
Jan 9, 2007
I am very new to ActionScript programming, and I am using AS 3.0. I am attempting to create a drawing that constantly needs to be updated. The drawing is a graph based on arbitrary, constantly changing, data points.Each frame however needs to be redrawn with a new bitmap. How do I remove the old bitmap before I display the new one ? I have tried using remove child, but when I do, nothing at all is displayed.
View 1 Replies
Apr 11, 2009
Is there a way to make the transparent area from an png image not to register when I add with a mouse event to that image? What is happening is the rectangle around the symbol is effected by the mouse event.
View 2 Replies
Mar 25, 2010
I would like to make a flash movie with a picture, where when the user holds down the mouse button, part of another picture will emerge in that general area (like a magnifying glass looking into another dimension).
Technically, my idea was to make a flash file with two images, and then code the mouse to be able to make the top picture transparent in a circle-like area around the cursor, while the mouse button is down.
But how to do that? I am using Flash CS4, but I don't really care if the solution is in AS2, or AS3, as long as it works
View 2 Replies