ActionScript 3.0 :: Creating Masks From BitmapData

Oct 17, 2009

I'm trying to modify the alpha layer of a bitmapData by taking a source iamge and masking out areas that don't have the correct channel. ATM I'm using copyChannel to achieve the effect, but I'd liek more than 3 channels (use alpha kills the other channels it seems). 255, 0, 255 should be able to act as another mask.

This is what I'm doing now...

Code:
bitmap.bitmapData.copyChannel(tempMask, new Rectangle(0, 0, tempMask.width, tempMask.height), new Point(0, 0), BitmapDataChannel.RED, BitmapDataChannel.ALPHA);

So the red parts of the image mask out the source image. All I want is to be able to mask out things basic on multiple channels (the lesser of the 2).

1) How does copyChannel work? Can I just test each pixel manually and achieve relatively similar speeds? and 2) if the Flash inline functions are infact faster, is there a function that can do what I want, or would it be better to use a shader?

Code:
var tempBitmapData:BitmapData = new BitmapData(tempMask.width, tempMask.height);
var matrix:Array = [];
matrix = matrix.concat([0, 0, 0, 0, 0]); // red
matrix = matrix.concat([0, 0, 0, 0, 0]); // green

[Code].....

View 1 Replies


Similar Posts:


Getting Error When Creating Tweens And Masks

Oct 22, 2009

When i create a new motion tween for example, i get the yellow "!" error in properties and it says "Motion tweening will not occur on layers with ungrouped shapes or on layers with more than one group or symbol". Thing is, i dont have more than one symbol or thing more than one shape and that is actually being tweened.the ! error only shows when i select the last frame in the tween. any ideas how i can get around this? i've never had this problem previously.

when i create a motion tween, i draw the object (in this case a circle), right click on the single keyframe, select create motion tween, then copy this keyframe and paste it further down the timeline, say at frame 10. At frame 10, i will move the circle to another location. the tween seems to work and it has created the symbol in the libary (tween 1) as a graphic, and when i export, it works ok, but the last frame has still the same error with the "!".  Same thing happens with shape tweens.

View 1 Replies

ActionScript 3.0 :: Creating Multiple MovieClip Masks Dynamically?

Mar 14, 2012

I have made a movieClip (mcMask) which I can use to mask another movieClip containing a bg image (mcImage). I have given the image movieClip an instance name(bg_mc) and I have given the mask movieClip a class of "Mask" in the "linkage" field. Now, I want to create multiple "Mask" movieClips using AS3 and use these to mask the image movieClip (bg_mc).The problem comes when I want to call the instance names of the "Mask" movieClips and set them to be the .mask value of the image movieClip.Because they are created from a class dynamically they don't have instance names. Is there a way to easily give them all instance names and then call them to use as masks? Or is there another way of calling them without assigning instance names?

Code:
//creates Var to create new "Mask" movieClips
var timer:Timer = new Timer(100, 999999);

[code].....

View 5 Replies

ActionScript 2.0 :: Creating BitmapData From Camera?

Nov 26, 2009

I have the following code:

ActionScript Code:
_camera = Camera.get();
_camera.setMode(320, 180, 12, false);
_video.attachVideo(_camera); //attaching to Video object

[Code]....

2) why is the image from the camera so small? It doesn't fill the 320x180 white background, it's size is actually 160x120. Is this some Flash limitation or how exactly did it get to this size?

View 3 Replies

ActionScript 2.0 :: Creating BitmapData Object Of Jpg

Sep 4, 2007

I am trying to create a BitmapData object of a jpg that is loaded into a movieClip, so that I can then remove the jpg and have just the BitmapData of the image to manipulate. I have the original image loading into my temporary MC without any problems..and am using a listener to check to make sure that the image has been fully loaded before it moves onto creating an empty movie clip for the BitmapData... but for some reason the BitmapData isn't working as nothing shows up in my holderMC.. and it says the width of the holderMC is 0 when it should be something liek 367 for the 'surf.jpg' test image I am using. My code is below..

Code:
import flash.display.BitmapData;
stop();
_root.createEmptyMovieClip("tempMC", 1, {_alpha:0});

[Code].....

View 1 Replies

Flex :: Creating Dynamic Class For Bitmap Containing BitmapData From SWC?

Jun 1, 2011

I have the following code

///Get BitmapData from library in SWC
var ClassReference:Class = getDefinitionByName(products[i].producticon+"Data") as Class;
// Create new BitmapData Instance From it

[Code]....

I get null in the trace. How do I make a dynamic class that I can refer to for this bitmap similar to how your reference a class from and embedded media?

View 1 Replies

ActionScript 2.0 :: BitmapData - Creating New BGHolder Clip On Resize

Aug 21, 2008

I am using bitmapdata to make me a nice lil' background image, and it works great...until it's resized. Whats happening is it's creating a new bgHolder clip on the resize, NOT resizing the current empty clip "bgHolder"

Here's the code:
import flash.display.BitmapData;
#include "mc_tween2.as"
Stage.align = "TL";
Stage.scaleMode = "noScale";
var myListener:Object = new Object();
myListener.onResize = function() {
[Code] .....

View 1 Replies

ActionScript 3.0 :: Creating Scratch Lottery Ticket Using BitmapData Class?

Nov 5, 2009

I'm trying to make an scratch lottery ticket in as3 by using the bitmapData class. The scratch function is working fine, but I want to add an function that is challenging. When 75% of the lottery ticket surface is scratched of I want to trigger an event.

My ActionScript Code:
var toolsize = skraper_mc.width;
var tooloffset = toolsize/2;
var basepoint = new flash.geom.Point(0,0);
var bitmap:Bitmap=new Bitmap();
[Code] .....

View 4 Replies

ActionScript 2.0 :: Flash 8 BitmapData - Getting Error : The Class Or Interface 'BitmapData.loadBitmap' Could Not Be Loaded?

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

ActionScript 3.0 :: Error #2015: Invalid BitmapData At Flash.display::BitmapData()

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

Actionscript 3 :: Quickly Rotate The Pixels That Make Up BitmapData Without Using BitmapData.draw()?

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

ActionScript 3.0 :: BitmapData.hitTest - What Angle Or Coordinate Of The BitmapData The Collision Happens?

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

Flex :: AddChild A BitmapData Or Draw A BitmapData To Screen?

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

ActionScript 3.0 :: BitmapData = New BitmapData(); Eating Up Memory?

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

ActionScript 3.0 :: Using BitmapData.draw(stage) - Error #2123 Security Sandbox Violation: BitmapData.draw

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

IDE :: Two Masks On One Layer?

Sep 24, 2009

I'm trying to display a shape using a mask in a way that it unhides the shape from left to center and in the same time from right to center.

--shape--
---><---

Is there a way to create a mask layer that animates two masks or to create two masks above one layer?

View 6 Replies

CS3 Multiple Masks To One Layer?

Mar 16, 2009

I was wondering whether it was possible to include multiple masks to just one layer?I have a huge deadline in for thurs and it would be a huuge help if it is possible.

View 1 Replies

Actionscript 3 :: Create Masks In It?

Mar 18, 2011

I can SEE the maskObject unless I set its alpha to 0 and then it doesn't let clicks through to objectToBeMasked

And every single tutorial that I've seen fails to mention this and how to solve it, as if it should be obvious.

How do I mask objects through AS3 so that the masks act like masks act like the ones added in the IDE?

View 3 Replies

ActionScript 2.0 :: Movieclips Under Masks

Jan 9, 2009

So I have a MovieClip, A, and inside of it is a layer that has shapes on it for a mask, this layer does have some keyframe animation (the masks move). Then I have MovieClips on other layers that are masked by the masking layer. When the movie loads, I load in an external jpeg and draw it onto a bitmap object, and then use that bitmap object and attach it to the moviecilps that are masked. This works fine, until the animation hits the part where the masks actually animated, then it reverts back to whatever i had in it before i attached the bitmaps. Is this a bug? or am i missing something? the only way i can get it to work is to run a function every single frame that the mask changes to reattach the bitmap. but that seems quite unefficient to have to do

View 0 Replies

ActionScript 2.0 :: Masks Over Two Objects?

Jul 2, 2008

I have two seperate MCs which I want to have the same mask effect on it Ie a gap in the middle, the mask is spinning round as stated they are separate, the blue thing gets moved whist the white one doesn't

View 4 Replies

ActionScript 2.0 :: Movieclips Under Masks?

Jan 9, 2009

So I have a MovieClip, A, and inside of it is a layer that has shapes on it for a mask, this layer does have some keyframe animation (the masks move). Then I have MovieClips on other layers that are masked by the masking layerWhen the movie loads, I load in an external jpeg and draw it onto a bitmap object, and then use that bitmap object and attach it to the moviecilps that are masked. This works fine, until the animation hits the part where the masks actually animated, then it reverts back to whatever i had in it before i attached the bitmaps. Is this a bug? or am i missing something? the only way i can get it to work is to run a function every single frame that the mask changes to reattach the bitmap. but that seems quite unefficient to have to do

View 2 Replies

ActionScript 2.0 :: Dynamic MCs And Masks?

Oct 4, 2011

I'm creating a starry sky for a header and there are mountains in the image which obviously I want the randomly generated stars to appear behind it.I've tried setMask() but I don't see it doing anything. The generated stars still appear on top of everything regardless of layer order and such.

View 2 Replies

ActionScript 2.0 :: FMX Scripted Masks?

Mar 19, 2004

I have a client who is IN LOVE with this site: http:[url]...I was just getting ready to start tweening and wondered if there's a way to script masks to do the same thing easily...NOT on mouse drag, but on the click of the button. I found a nice tutorial which will make a similar thing happen when you drag the mouse. But when I tried to target x and y the whole thing fell apart.

View 3 Replies

ActionScript 2.0 :: Multiple Masks For 1 Mc?

Apr 2, 2005

I have this problem that has been makin me crazy. I want to make an erasor for the drawing api basically. Since I wasn't able to accomplish it, i looked everywhere!!! no luck So far I have been able to "erase" with shapes. For instance, I can drag a circle out and see the masked item underneath. The very next shape I drag out cancels the mask from the previous shape as if you can only have 1 mask per maskee. Also, I cant get a line drawing to become a mask.

//creating the shape
_level3.drawingPlane.createEmptyMovieClip("layer"+ _level3.layer+"_"+i, _level3.layer);
// dynamically setting the mask_level3.water.setMask(_level3.drawingplane["layer"+_level3.layer+"_"+i]);

View 3 Replies

ActionScript 2.0 :: Drawing Api And Masks?

Jan 23, 2005

I've been having this issue for a day or two now and it's really bothering me. Sometimes the drawing api draws to the mask perfectly fine other times it doesn't work at all.

[Code]...

View 5 Replies

ActionScript 3.0 :: Can One Movie Clip Have Two Masks

Mar 27, 2009

I'm trying to make flash add two maks in one movie clip,like this (pseudo-code)

PHP Code:

MovieClip.mask = mask1
MovieClip.mask = mask2
Print (MovieClip)

but it only shows me the last mask.

View 12 Replies

Create Movie Clips With Masks?

Oct 5, 2010

I have an animation I've created of a rotating Earth. I want to turn it into a movie clip, so I can easily use it in other files. The problem is, I can't make it into a movie clip because there are some layers that are masks and they are locked.

View 3 Replies

ActionScript 3.0 :: Movie Clip Have Two Masks?

Feb 3, 2011

I'm trying to make flash add two maks in one movie clip,like this (pseudo-code)

PHP Code:
MovieClip.mask = mask1
MovieClip.mask = mask2
Print (MovieClip)

but it only shows me the last mask. I believe this is not possible?

View 1 Replies

ActionScript 3.0 :: Define In SVG While Avoiding The Use Of Masks?

Aug 17, 2009

i have a red rectangle. On top of this rectangle is a bitmapped (not vector unfortunately) pattern fill that needs to include some white/transparent pixels that should show the red color of the rectangle. How do you define this in SVG, if possible while avoiding the use of masks? The 'transparent' pixels keep coming up white instead of red.

View 1 Replies

Actionscript 3 :: Working With Masks In Flash?

Jan 12, 2010

I'm having a hell of a time trying to get a custom mask to work on a project I'm creating.The mask I'm trying to use is applied as a pixel mask on a layer in the photoshop doc I'm working off, but I can't seem to figure out the proper way to get that layer mask imported into flash, to then compile into my .swc and be called from actionscript. (I'm coding in Flex)Whats the proper workflow for getting a pixel mask imported from photoshop so that when I call:

container.mask = myMask;

It'll show up as the shape I want, and not just a square box the size of my shape?

View 2 Replies







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