ActionScript 3.0 :: Merge Two Alpha Channels?
May 4, 2010
What is the best way to merge two alpha channels? What I want to do is, given channel values, use the value which is greater.
I tried using .merge(), but it appears to only blend channels with a linear value between current and destination value.
I looked into .draw(), which would work well using a blendmode like LIGHTEN, but it doesn't allow drawing per channel so I can't target the alpha channel only. The ALPHA blendmode didn't seem to do anything when used with .draw(), and ERASE gives an unwanted hard edge.
I also looked into .copyChannel(), but it doesn't allow any blending logic, merely copying a rectangular region from one BitmapData to another.
View 5 Replies
Similar Posts:
Aug 22, 2011
i have the following situation:
one drawing layer (graphics object with lineTo, etc.)
one png with an alpha channel (supposed to serve only as a mask)
now i want to be able to only draw lines within an area restricted by the png mask.
i am trying like this:
var bitmapData:BitmapData = new BitmapData( 320, 320 );
bitmapData.draw( drawingLayer );
bitmapData.copyChannel( maskBitmapData, new Rectangle( 0, 0, 320, 320 ), new Point( 0, 0 ), BitmapDataChannel.ALPHA, BitmapDataChannel.ALPHA );
now the borders get cut off fine, but i get a black background, since the drawing layer has an alpha between the drawn lines (and it should remain like this) and the mask bitmap has an alpha outside the shape. so naturally the mask's alpha replaces the drawing layer's.
i tried it with merge, copyPixels and also with just setting the mask property on the drawing layer (i set everything to cacheAsBitmap) but to no avail.
ADDITION:
when trying to use a mask i tried it with
<s:BitmapImage id="mask" source="@Embed(source='...')" cacheAsBitmap="true" />
and also as
[Embed("...")]
private const BodyMask:Class;
var maskBitmap:Bitmap = new BodyMask();
and assigned them to the mask property of a s:Group element (cacheAsBitmap=true) where the operations on the graphics object occured. i also tried reassigning the mask after each draw operation.
View 1 Replies
Nov 14, 2010
I copied this from some other forum because it's explain well "...Let�s say you are loading in an external asset that has an alpha channel, such as a PNG. Now let�s say that you want that asset to act like a button, with rollover and click actions. No problem. No reason you can't do that. But, actually, there is a problem. The hit area for that external asset will be its entire bounding box. Take this octy image for example: Even if you rolled over the top left of the image where it�s totally transparent, it will still trigger rollover actions, which is certainly not ideal and could potentially be very confusing for a user..."
[Code]....
View 2 Replies
Jun 6, 2011
I'm trying to take a png and create two images, one that represents the color data and the other a grayscale version of the alpha channel.
Extracting the correct data was no problem, i'm just embedding the png, creating a new instance (as a Bitmap) and then extracting the relevent channels of it's bitmapData to two new bitmapData instances.
ActionScript Code:
[Embed(source='/../deploy/images/alpha_test.png')]
public var image : Class;
[code]....
The problem that i'm having, is that when i assign the colors bitmapData to a bitmap instance to display it, the background color is showing as black, even though the default fillColor of a bitmapData instance is white. how i can use the alpha channel data to create an 8 bit, grayscale image, that's the reverse of the channel?
View 1 Replies
Feb 12, 2010
I'm trying to merge two display objects into a single new BitmapData object, when it uses the color from one and the alpha channel from the other. The concept seems straight forward enough but I'm getting lost in the BitmapData APIs. I've been trying to use the Alpha blendmode with draw() but that doesn't seem to work.
View 2 Replies
Aug 26, 2011
I am using an application which load games as an external swf file(total 10 games). When I click on the game icon it loads the game and also the sounds related to that game.
But when I close the game in that app, ideally it should also stop the sound for that game. It happens for few games, but for some games the sound still plays in the background even if the game is closed.I have used
import flash.media.SoundMixer;
SoundMixer.stopAll();
In some games the sound is embedded in the game swf file and in some games sound is called from the external mp3 files.Is there a way in which if i close the game. ie any game , the sound should stop.
View 3 Replies
Sep 26, 2011
We are working at a complex AS3.0/Flash game project, where we need to preload and cache around 70 movie files with sound. But somehow the preloaded videos all seem to block a sound channel and so some sounds are not played in the game, as we seem to exceed the 32 sound channels. I cannot provide any technical details at the moment, but I will add them as soon as the developer in charge is back in the office.
View 1 Replies
Jul 9, 2009
got this code from herehttp:
[Code]...
View 1 Replies
Aug 12, 2010
So as you may or may not know, BlazeDS (open source version of LiveCycle Data Services) is a nice way to get your server-side Java and client-side Flex application to play together. Unfortunately, it does have several pitfalls that need to be corrected. I'll try to explain one of them here.
All of BlazeDS's configuration is written via XML files in the flex/ folder of your webapp. The default names are separated for clarity, such as services-config.xml, remoting-config.xml, messaging-config.xml, etc. In these configuration files (particularly services-config.xml), Channels are defined; these setup URIs and objects used to capture and send information between the server and the client. In these config files, it is quite common to use a syntax like so:
[Code]...
Unfortunately, what they don't tell you is that some of these key-in replacements (ie: {context.root}) are not replaced dynamically upon execution but upon compilation of the WAR file you intend to distribute. Obviously not a good idea when switching domains.
So, instead I seek to dynamically define these channels. According to the documentation, that's all good and fine, but it only works if the channel already exists when the webapp is launched. I feel like that sort of defeats the point. So my question is, how do you truly create channels dynamically so that both the client and the server recognize their existence?
View 1 Replies
Sep 9, 2011
I am using 2 sound channels to play 2 separate, externally loaded mp3 files at the same time. Right now I have the play button tied to a function that starts the first mp3, then the 2nd. The problem is - the 2nd mp3 starts a few milliseconds after the first. Is there a way that I can make sure these 2 start playing at the exact same time?
[Code]...
View 1 Replies
Nov 17, 2011
Are there any audio management libraries for ActionScript 3? The more tailored they are for game development the better.I'm finding it hard to understand and work with multiple channels, which is making a lot of my audio sound screwy and cancel each other out, etc. I've been working on an RPG that can at a given time have quite a number of sounds playing such as environmental noise (like opening doors, thunder, rain, etc), walking enemies, inventory sounds (for events like dropping an item into your inventory), passive spell-casting sounds, voice clips, weapon swinging etc. Alternatively, if there are any good resources that explain how to use multiple sound channels strategically.
View 1 Replies
Jul 14, 2009
is it possible to have multiple SoundChannels? And have a volume control control multiple volumes?
i have a site that uses .flv's with sound all throughout. Volume control is attached to a sound transform that affects the stream. I also added a piece of code to this function that creates a new soundtransformation object, adds it to a soundfactory object i have in a private var and adjusts that volume by 40% of the .flv's volume. This seems like it should work - but doesn't so i am wondering two things. a) can i have multiple sound channels (in this case the stream and the channel i made for bkg music) b) if i can why do my sound transformations not get implemented on this music track. I also tried to explcitly set the music volume to 0.4 via a sound transform right after i load it - which does not work either.
heres the code
ActionScript Code:
trace("current vol is :" + currentVolume + " And 40% of that is: " + (currentVolume * 0.4));
var st:SoundTransform = new SoundTransform(currentVolume, 0);
stream.soundTransform = st;
[Code].....
View 1 Replies
Nov 20, 2010
Simple question here, lets say you have a color in RGB, white:255, 255, 255Pixel bender needs values between 0-1 not 0-255.So white = 1, 1, 1What about:134, 132, 123I dont know how to work it out.
View 3 Replies
Oct 31, 2011
referring to my old question AS3: Analyzing sound spectrums one by one, one channel at once , with flash player 11 and using Sound.extract,is it possible to extract a single channel and manipulate/visualize it's spectrum? I mean, if i mix 2 sounds into one file, can i control them separately, acting on thing like their soundwaves or volume?
View 1 Replies
Nov 26, 2010
I'm developing an online meeting system with audio/video sharing, using Adobe Flex 4 and Flash Media Server 4. I'm using the RTMFP protocol to make the transmission of audio/video which increases considerably the performance. The trouble now is that i must record the audio/video transmitted, but i figured out that when using the RTMFP protocol the FMS doesn't operate in the channels. So, how could i make FMS record this channels?
View 1 Replies
Jun 17, 2009
I've been trying to find the right configuration for supporting both http/s requests in a Flex app. I've read all the docs and they allude to doing something like the following:
<default-channels>
<channel ref="my-secure-amf">
<serialization>[code]..........
I'm running with Tomcat 5.5.17 and Java 5.The BlazeDS docs say this is the best practice. Is there a better way? With this config, there seems to be 2-3 retries associated with each channel defined in the default-channels element so it always takes ~20s before the my-amf channel connects via a http request. Is there a way to override the 2-3 retries to say, 1 retry for each channel?
View 4 Replies
Sep 28, 2011
Can I figure out somehow sound's frequency (primarily .mp3s) and if it is mono or stereo?
View 4 Replies
Oct 23, 2010
[URL] i want the object to fade out but in the object there's a lot of overlapping pictures and each becomes half transparent. how to make the movieclip to change the alpha as it was without objects?
[Code]....
View 2 Replies
Dec 15, 2011
just spotted this curious trick. If you want to flip something to go invisible on a click, and then reappear on another click (etc etc), try this:
create the sprite, setting alpha to either to 1 OR -1
mySprite.alpha=1; //OR
mySprite.aplha=-1;
[code]....
View 9 Replies
Jun 27, 2003
using AS, on loading a movie a solid shape is there with alpha at 100% then over a period of 5 secs its alpha is reduced to 0.
i'm new to this......please help if you want to if you don't have a good weekend but think of me struggling onwards and upwards...
View 14 Replies
Mar 3, 2010
I'm tring to merge two nice effects file into one .fla file.I've tried in several ways but the result was very poor.Is there someone able to do it ?My goal is to have the changing aurora as background and have the possibility to see the mouse effects over.
View 1 Replies
Sep 7, 2009
How do you merge FLV files in Flash Pro CS4?
View 3 Replies
Feb 20, 2010
Basically i have 2 flv movie clips. i want to put them both together (i can do)
But what i want is for the 1st one to pause at the end and the 2nd one to start coming in but the music first for a few seconds then it fade into the 2nd ones visuals.
View 1 Replies
May 11, 2010
How to merge two xmllistcollection in Flex 3. Please note, addAll method is not available.
View 1 Replies
Dec 10, 2009
Is there away through which i can merge two mp3 files and output a new one in as2.0 or as3.0?
View 6 Replies
Jan 25, 2010
I have a some mClips on the stage. i want to merge all of them or some of & drag those clips too with single click.
View 8 Replies
Oct 14, 2009
Is there any way to merge cells (vertically and/or horizontally) in a datagrid? At least, for example, is there a way to show that certain datagridcolumns belong to one group. For example, I'll take three columns: column1, column2, column3. All these three should be grouped to the Category cell with a rowspan of 3 -- a "super header" if you will.
View 4 Replies
Oct 8, 2010
I am looking for a solution to this issue but I have not yet found anything conclusive. I would love to get some input. What I need to do is basically to take two or more individual PDF-files and merge them into one. Nothing fancy just sticking one after the other and ending up with one file.
I have found AlivePDF and purePDF but those libs both seem to be focused towards generating PDF's from scratch.
View 2 Replies
Oct 26, 2010
I have an application w/ 2 side-by-side pages of text. I have the VDivided box set up so the user can drag it to make one of the documents bigger or smaller.Is there a way to get the look of a VDivided box & the functionality of an Accordian, so that when the user clicks the VDivided box (or double clicks, I haven't decided) one of the documents will be hidden? (For instance, double clicking on the right-most side of the divider will hide the left document, and vice-versa)
In addition, if the user wanted to drag the divider, then they can do that as well. I don't have much, but here it is so far:
<mx:HBox width="100%" height="100%">
<mx:HDividedBox width="100%" height="100%">[code]......
View 1 Replies
Oct 6, 2011
I have two ArrayCollection and I want to merge them into one...
[Code]...
But there is an important problem, if array2 (b) has a item.month that there isn't in the array1 (a) the value is lost...
View 4 Replies