Actionscript :: Flash - Get Transparency To Work On A Bitmap?

Apr 23, 2011

For a class project I'm working on "Pissed Off Pigs" (I think you get the idea, the pigs get revenge, don't worry, I'm not going to release it!) and I want to create circles with a fill from a bitmap (circles because the collision math is easier). Here is how they look now.

Of course, the white is the problem. Below is my "pigs" class. I've tried gif's, pngs, 8-bit pngs, etc and it seems to make no difference. The image itself is 20px square and the radius of the circle is 10px (so a 20px diameter). Here is the image I'm using:

And I know I should probably load the image outside the class and just pass the BitmapData when I make a new pig so I don't have to load the image every time I create a new pig but for now it works! (Sorta).

Oh, and I have checked bmpImage.transparent and it returns true (even when I don't specify true in the constructor).

package {
import flash.display.;
import flash.net.;
import flash.events.;

[Code].....

View 2 Replies


Similar Posts:


Flash :: Copy A Masked Bitmap Maintaining Masking Transparency In Actionscript?

Jan 6, 2010

I need to find a way to copy a masked bitmap. I have a bitmap on stage, and a user drawn sprite that acts as a mask. I need to capture/copy the masked area bitmap, maintaining the transparency created by the masking to eventually encode as a png.

I could find no documentation on how to accomplish this using copyPixels(), or any other directions.

View 1 Replies

Actionscript 3 :: Draw() With Transparency On A Bitmap

Nov 7, 2011

I want to apply transparency to a non-transparent logo then add it to an image. So I change the alpha of the logo, then I draw() the logo on the image. But it doesn't work, the transparency isn't applied as expected.

Note: I will later save the resulting bitmapData to a file, so an addChild() won't be enough to solve this.

var image:Bitmap;
var logo:Bitmap;
//...
logo.alpha = 0.3;
image.bitmapData.draw(logo);

View 1 Replies

ActionScript 3.0 :: Remove Transparency In Bitmap?

Jul 7, 2010

i placed png file inside movie clip... when a event trigger the image there should pop up appear.. main thing is the event should not trigger in the transparent image area.. using as3..

View 2 Replies

ActionScript 3.0 :: Igonore The Transparency Of A Png Bitmap, OnRollOver Or Click?

Dec 4, 2009

Does anyone know if in AS3 it is possible when using a png as bitmap and you wouldadd this to a sprite.  And when having an MouseEvent Listener to this sprite to ignore the transparency of the picture?  I am hoping that this is possible in AS3, because in AS2 it was not possible.

View 5 Replies

Flash :: How Does ScaleX/scaleY Work On Bitmap

Jan 26, 2010

I'm using a Bitmap cache that stores down a few Bitmaps. I called scaleX/scaleY on some of them, but the next time I retrieve from the cache, the Bitmap is screwed up. How does scaleX/scaleY work with Bitmap?

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

IDE :: Doesn't Scale9Grid Work With Bitmap

Aug 1, 2007

I have uploaded a test here

Code:
a2.width = 300;
a2.height = 300;
b2.width = 300;
b2.height = 300;

Both clips in library have scale9grid enabled, but it just wont apply to the imported bitmap, just vector.

If there is no way around it, I cant imagine it is too hard to write a custom class that applies scale9grid to the bitmap aswell, maybe someone know if it has been made already?

trace(a1.scale9Grid); and chop the bitmapdata manually?

View 6 Replies

ActionScript 3.0 :: Making Bitmap From Video Does Not Work Right

Aug 4, 2010

In my current project I need to create a bitmap from the last frame of a video. For this I use:
Code:
var _vidBitmapData = new BitmapData(video.width, video.height, false, 0x0000ff);
_vidBitmapData.draw(video);
var bmp:Bitmap=new Bitmap(_vidBitmapData)

This works like a fairy in wonderland if I create the video with dimensions matching the stream:
Like
Code:
video =new Video(1280,800)

However, when I change the Video's size on receiving the onMetaData Event according to the actual streams width and height properties, the capture i get from _vidBitmapData.draw is still in the dimensions of how I created the Video. So if I do
Code:
video =new Video(10,10)
and then
private function onMetaData(metadata:Object):void {
video.width=metadata.width;
video.height=metadata.height;
}
I get a nice display of the video.

However when doing the
Code:
var _vidBitmapData = new BitmapData(video.width, video.height, false, 0x0000ff);
_vidBitmapData.draw(video);
var bmp:Bitmap=new Bitmap(_vidBitmapData)
I get a 10 x10 px image....

View 4 Replies

Checking Cache As Bitmap Doesn't Work

Jun 29, 2009

Checking Cache as Bitmap doesn't work, you have to .cacheAsBitmap = true with actionscript? 

View 2 Replies

ActionScript 3.0 :: OOP - When Transfer To Packages It Doesn't Work Where Concerning The Property Of The Bitmap

Sep 12, 2011

Im trying out some basic OOP.. and cannot understand where I am going wrong. It works within the timeline - but when I transfer to Packages It doesnt work where concerning the property of the bitmap. I have a 'MyClip' instance in the library. here is my bask Document Class package::

[Code]...

View 4 Replies

ActionScript 3.0 :: Get Security Settings Right To Permit Bitmap.draw() To Work With Objects From Another Domain?

Jan 8, 2008

This is a two fold query involving the same issue. As you know, if you attempt to use bitmap.draw() with an object (image or swf) that is not in the same domain as the calling swf the bitmap will not draw. As described by Adobe livedocs, if Security.allowDomain() is setup in the calling swf then draw() will work. However, I cannot get this method to work. I have supplied an example fla (make sure to get the .as for it too).

1. How do I get Security settings right to permit bitmap.draw() to work with objects from another domain? (not any domain - just the domain I define in the allowDomain parameter)

2. How do I setup an event handler (listener) for bitmap.draw() so I can detect when it doesn't draw?

[Code]...

View 2 Replies

PNG Transparency Limit In Flash 8?

Apr 4, 2006

I have a PSD with about 30 layered transparencies. I exported each individual layer as a PNG 24 with the transparent background in tact. I then made identical layers in Flash just like I had in Photoshop, and imported each PNG to it's corresponding layer at which point I converted the graphic to a movie clip for future scripting animations. Once I got to the 24th layer Flash quit recognizing my transparencies and my first Flash layer masked anything else I brought in from layer 24 on....but the layers above remained OK!! I checked and double checked my Photoshop exports and had several Flash "gurus" check my work. Nobody can figure out what is wrong! Is there a limit to the number of PNG tranparencies allowed on seperate layers in a Flash document?

View 7 Replies

PNG Wont Show Transparency In Flash?

Mar 15, 2011

I have a problem I can't seem to fix - why wont the transparent attributes of the PNG files I have substituted into the XML gallery wont show? instead there is a heavy white border that overlaps other images in when the flash is rendered

var tn:Number = 0;
var current_tn_x:Number;
var current_tn_y:Number;

[code].....

View 1 Replies

Bring In An Image With Transparency In Flash CS4?

Oct 21, 2009

What's the best way to bring in an image with transparency in Flash CS4?I have a logo in Photoshop that looks great on a black background.  But when I bring it in as a GIF or PNG in Flash, the edges get really jagged.Is there a preferred way to import this so the edges are smooth?

View 2 Replies

Bring The Video Into Flash And Export Out Of There To Get The Transparency?

Nov 24, 2009

I have created an animation using illustrator files in AE CS3 and now want to convert this to flash so it will play on my website.The problem I am having (or rather my web designer) is getting the transparency in flash.

1. How should I export out of AE

2. Do I need to bring the video into Flash and export out of there to get the transparency?

3. Can this workflow even be done?

4. What is the best way for me to deliver the files to my web designer?

I have attached a movie file of the look I am going for. The birds were done in AE and I want them to move across my home page.

Attachments:Hone Bird Anim DEMO.mov (983.4 K)

View 3 Replies

Professional :: Flash BlendMode.OVERLAY On Transparency

Feb 17, 2011

Overlay blending mode in flash on trasnaprent, imported images, doesn't work properly! It leaves dimmed black background instead of transparency. Same thing is in CS4 and in CS5. What is even more weird is that in Flash preview stage window everything is fine, and it works, but after publishing the SWF, you can see black background.I looked for workaround that...no success. No one answeres to this question.

-I tried with 24png, 8png, gif with different settings. No success.
-Tried also with After Effects, and then export to SWF, it works surprisingly.

View 1 Replies

Flash :: Change Transparency Of A Movieclip Object

Mar 28, 2010

i've a MovieClip and i would like to change the transparency of this movieclip how can i do?

View 1 Replies

Actionscript 3 :: Flash Transparency Of Overlapping Items?

Sep 7, 2010

In Flash, I have a container with several overlapping children. When I give this container an alpha value of .5, some of the children can be seen behind others that overlap them. I would rather be able to take the whole thing as a composite image and blend it that way.

View 2 Replies

Flash :: Preserve Transparency When Resizing Picture?

Jul 25, 2011

I use a flash program in my website to resize pictures before transfert, for preserve my bandwidth.

But, when i try to transfer a .png file with transparency, the resize don't maintain transparency in the .png file result. It's a problem for use it after.

[Code]...

View 1 Replies

Flash :: Use The CS4 Tool's On A Bitmap Image After Tracing The Bitmap Image And Applying My Settings?

Aug 7, 2009

Use the flash CS4 tool's on a bitmap image after tracing the bitmap image and applying my settings?

View 10 Replies

Export Flash Image To Illustrator : Bad Colors And No Transparency?

May 15, 2008

I've tried to export my vector work from Flash to Illustrator. The result is bad : colors have faded and transparent colors became opaque. It is a shame that Flash doesn't provide a correct export function to
Illustrator now that Flash and Illustrator are both Adobe's softwares.

View 1 Replies

Professional :: Flash Mask Working - Transparency (wmode) Is Not

Feb 16, 2010

flash mask working - transparency (wmode) is not

[Code].....

View 1 Replies

Flash :: Change MovieClip Transparency As A Single Image?

Aug 27, 2010

Here is my code:

var menu = new Menu ();
menu.x = 0;
menu.y = 0;[code]...........

This works, but transparency varies for each element MovieClip separately, but I would like that would have changed the whole MovieClip transparency as a single image.

Menu(); is generated from XML.

View 2 Replies

Flash :: Create Videos With Transparency/alpha-channel

Sep 21, 2010

What is the best way to create a video with an alpha channel, suitable for flex/flash? Does it need to be FLV, or can it be MP4/MOV as well?

View 1 Replies

Actionscript :: Printing Transparency Pngs With Printjob (Flash)

Dec 2, 2010

I am trying to print a movieclip with printjob in flash. This movieclip contains two layers: one with a PNG image with transparency and one below with a jpg image. The problem is that the transparency of the png is not respected so the jpg image does not appear. The code i'm using is real simple: var my_pj:PrintJob = new PrintJob();

[Code]...

View 2 Replies

Flash :: Setting Transparency Of Itemrenderers In Spark List?

Jan 25, 2012

I have a list that has alternating item colors.

<s:List id="myList" change="selectionChanged(event)" alternatingItemColors="[0x000000, 0xFFFFFF]" dataProvider="{alResults}" itemRenderer="itemRenders.Results" width="100%"></s:List>

[code].....

View 1 Replies

ActionScript 3.0 :: Bitmapdata.hitTest - Bitmap 'emptyBitmap' With Bitmap Data Created

Feb 3, 2009

I'm cutting my teeth in actionscript 3 on a game that has a character running through a world. So, I have set up my Hit Testing by using the bitmap data hit test method, since I figured my world is going to be destructible - it'd be nice to update the level and then redraw it and have the character interact with the new change. (That works beautifully) I am however; a bit confused as to how I have my hit Testing set up. I've been messing around with it, and it works for now - but I'm not sure why.. currently, I have a character set up by using a class I built and using a series of animations I created. So, this character has a walking and falling animation, etc. This is a movie clip.

Then there's a bitmap 'emptyBitmap' with bitmap data created - however; I never really added this as a child to the character. This is sized to the dimensions of my character. My level is created as a movielip, then it's drawn to a bitmap - when the level movieclip is changed, the bitmap redraws, and that's how this updates.

[Code]....

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

Flex - Function To Redraw Bitmap On Sprite Without Passing In Said Bitmap?

Feb 22, 2011

If I have a BitmapData that's already been drawn onto a Sprite. Is there a way to redraw the BitmapData onto a Sprites Graphics object without having to invoke beginBitmapFill and passing in the same BitmapData?

View 1 Replies







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