Flash :: Trim Whitespace Around A Transparent PNG
Oct 22, 2010
I've managed to get myself stuck in a situation where a database full of images ( transparent images of various products ) needs to be placed on the stage, all of which need to be aligned the same by the products height. My problem is that the png's of products are 'floating' and I have no control of where about's in the png it will sit ( could be tight at the top and loads of room at the bottom, vice versa)
Does anyone know an existing way to find out the png's 'true' height ( width is an extra ). I've thought about looping through the bitmap data and checking but wondered if anyone has invented this wheel already?
View 4 Replies
Similar Posts:
Nov 16, 2011
I have a Flash fla file that contains a whole lot of images. The majority of each image is composed of transparent pixels with a visual object in there somewhere. Each image at the moment is at {x:0, y:0}.I want to trim away the transparent pixels of the image down to a minimum bounding box, but keep the object at the same global position. This requires shifting the trimmed image to the global position of the object in the untrimmed image.This is not so much a problem, but the fact that the images are all contained in a fla is the problem. The options I see at the moment are:
investigate JSFL, the Bitmap object has a getPixels, this in combination with a selection and delete operation could work save the fla to xfl and enumerate the images and associated xml with something like Ruby + image processing lib
Questions: Does anyone know upfront if this operation is possible in JSFL? Have anyone done much automated processing of xfl files? Is there an off the shelf image processor that can perform this trimming operation?
View 3 Replies
Feb 23, 2009
Is there a way to trim a bitmap so that the width and height are not effected by transparent pixels?
View 5 Replies
Jan 7, 2010
I am using flv player in my application and i want to trim my displaying video in run time.Is it possible in flash or let me know if you have any solution for this problem.
View 2 Replies
Feb 2, 2010
I need to trim away away all the extra spaces that a users types into my input text field. I know that there are a few ways possible, but i'm not sure how to go about doing it.
View 5 Replies
Mar 19, 2010
I want to trim a sound and then let it loop in a slideshow. The sound -- a roaring crowd at a soccer game-- should loop as a slideshow plays. As the movie repeats the sound should continue to play. It doesn't have to be in sync.
This works if I use Streaming, but there's a gap at the beginning of the movie as if the sound was being loaded over and over again.
I've been advised not to use Streaming, but if I don't, the sound is reproduced in its entirety-- there is no trimming.
View 2 Replies
Aug 29, 2009
how to trim starting and ending spaces and also how to replace two or three spaces into one space in as2
View 9 Replies
Mar 9, 2011
How would I trim the following string: "id":"102184499823699","name":"Montreal, Quebec" to only display Quebec. Basically I want to look for name": and trim everything before it including itself.
View 2 Replies
Sep 14, 2011
I have a text field that a user can enter a value and right now they can enter "150.55" or "125.55555"
I want to limit the entry to a decimal with a scale of 1.
So they would be only be able to enter "150.5" or "125.5"
I have a var as an integer that I'm reading for the scale. Just not sure how to trim the string so I only display the shortened 150.5
View 9 Replies
Aug 16, 2011
i am loading a jsp file, which had some space at the beginning. i want remove the space,then i need ot parse the data, just like ignoreWhiteSpace in xml.
View 5 Replies
Apr 22, 2010
How can one remove whitespace from a string in as3?
I would like to be able to remove all carriage returns, spaces, tabs etc.
View 2 Replies
Dec 12, 2009
I am trying to parse a string in order to remove all extra white spaces.Iām working in AS3 and at the moment the only pattern I found remove all content:
field.text = field.text.replace ("As+|s+z", " ");[code].....
View 3 Replies
Feb 3, 2010
create a function in my program which trims away all the extra heading and trailing spaces in my input text field. I've just begun to learn actionscripting not long ago so I am not really proficient in it yet.
View 0 Replies
Mar 15, 2010
I have few ActionScript skills. But I have built a multimedia career by stealing chunks of AS2 code and reworking them to suit my purpose. I have searched long and hard here for a solution to my current problem. I have found code here that seems to address it, but I cannot make it work. I simply have some textAreas that I wish to validate. The user may input text that could include extra spaces, returns, and odd capitalization. It would be easiest for me to simply strip out the capitals, spaces and returns. I found some simple code that changed the caps to lowercase:[code]
View 5 Replies
Jun 4, 2008
Does anyone know of a way to crop out whitespace/transparent pixels in a BitmapData object? I've got this movieclip I'm rendering that has a huge amount of whitespace all around it. I'd like to crop all of that out before I convert it to a JPEG (with corelib). Is there a way to do this? I can't seem to find a way to figure out where the first opaque pixel starts on each axis to determine the extents.
View 6 Replies
Oct 4, 2011
I'm trying to serach for the following string "Type/Pages" in long external files and am using the follwoing code which works: indexOf("Type/Pages");
However, sometimes it appears in the file as "Type /Pages" - with the extra space
As the files can be VERY long, I don't want to search twice - is there anyway to search with or without the space?
I've tried all sorts of cominations with s* but to no avail
View 6 Replies
Oct 24, 2008
I have a website I'm making. The contents of it is set via xml documents.Now because in the xml for the sake of keeping it clean I make sure when setting all text to any TextField I set it with condenseWhite set to true:[code]Now this condense white creates a few weird bugs when using htmlText... things like img tags acting really weird and the sort.But that isn't my concern right this second. What I want to do though is allow the user to choose the ability to preserve whitespace in some manner for instance here is the main xml document loaded and used to load all subsequent docs:[code]
I've tried stick in there and that fails. I've tried the <pre> tag from html, failed, which I assumed it would. %20 doesn't either.I also thought of sticking a "preserve" attribute on it and checking that before setting text (as you can see in the xml code)but in some scenarios in my application it creates very convoluted code just to update dynamic textFields (I have textfields that swap out a lot, like in the photogallery as can be seen here: URL...Or maybe knows a site that has a well documented explanation of the html abilities of the TextField.I've been reading around on the internet and playing in flash for a while now testing different things and still no result.
View 3 Replies
Jun 28, 2010
I have a variable that contains the text from an input box.
let's call it "name"
People may enter the persons first and last name into this box. If they do .. I want to be able to capture just the first name from that string. So somehow capture everything before the first whitespace.
View 3 Replies
Feb 17, 2011
In the following complete functional Flex application the line breaks between the two links ought to be preserved when importing the input text into the TextFlow:
[Code]...
View 2 Replies
Apr 18, 2011
In my flex code I am getting error whitespace required before attribute what may be problem below is code
[Code]...
Even on this code too I am getting error whitespace required before attribute below is code
[Code]...
View 2 Replies
Sep 13, 2009
When I try to load text from XML into a text field any leading line breaks or spaces are ignored. For example:
Code:
<text> some text</text>
The preceding loads into the text field without the leading spaces before "some text". How can I force the spaces to appear?
View 2 Replies
Mar 25, 2010
Not sure if I phrased that correctly. I have about 6 pieces of illustrator outlined text.imported into flash, set as symbols with event listeners and works fine. but i notice I can only click on the outline itself, if i click on the inside of an "o" or "R" it doesnt work.I added white boxes behind each of the symbols and that fixed the problem, but now i want to do a color transform on the symbol (the text only of course), but when I apply the transform, its the background box and the text that have the new color applied, just leaving me a rectangle. I gave the box an alpha of 0, hoping if i didn't affect the alpha in the transform, the pointer would still read the box, but no go, it doesnt even see the box again.
View 4 Replies
Oct 17, 2010
I imported a video into flash and have a transparent photoshop layer to create an iPod skin. The video works fine, but I cannot get the "stage" to be transparent so that you do not see the flash background color behind the iPod skin.
I've read in the forums and have followed the instructions here from Adobe. If you look at my code, I have
[Code]...
View 6 Replies
Feb 5, 2012
I'm trying to draw PNGs onto BitmapData that is transparent.
I create my BitmapData like this (using ARGB for the color):
new BitmapData(width, height, true, 0x00000000);
And clean it by using the same ARGB value:
bitmapData.fillRect(bitmapData.rect, 0x00000000);
When I use copyPixels() to draw graphics onto the cleaned BitmapData, I get this result:
If I don't use ARGB for the BitmapData color, it works fine:
But I have to specify a solid fillColor, meaning I can't render what's behind the Bitmap.
How can I make my BitmapData transparent, but not have the above occur?
View 1 Replies
Aug 13, 2011
Turning of the whitespace around relationals formats the code into:
getDefinitionByName("Helloworld") as Class
into
getDefinitionByName("Helloworld")asClass
Has this been changed in FDT 4.0?
View 1 Replies
Oct 17, 2011
I'm new to AS3, as well as this forum,and had a question. I created a simple ad-lib type game for practice and would like to be able to remove any leading and trailing whitespace that a user inputs from the final outputted ad-lib, as well as if the user tries to submit their input with missing fields of text, it would throw an error and ask them to try again.[code]...
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
Oct 12, 2011
I'm trying to code a click-and-point adventure game for a class, in which interactive objects glow when you mouse over them.... In the frame I have the background image (in which there is, say, a drawer), and an image of the drawer glowing placed exactly over top of that. The glow image is invisible until you mouse over it, at which point it is supposed to become visible (and disappear upon mouseout). I have the mouseover function linked to the entire glow image (which is a movieclip), but it only seems to work when you mouseover a specific portion of the image (usually a corner). The code looks something like this:
ActionScript Code:
DeskDrawer.addEventListener(MouseEvent.MOUSE_OVER, drawerLightUp);
function drawerLightUp(e:MouseEvent){
DeskDrawer.alpha = 100;
}
when the glow-image is moused over, it moves upward slightly and a small amount of whitespace appears at the top of the image.
View 1 Replies
Oct 6, 2009
I have two png's that kind of look like paint brush strokes. they have some transparency in them that lets the stage colour bleed through a bit.
I am adding two of these images to the stage in AS 3. One adds quite fine - looks as expected. The second one however doesn't have any transparency other than around its edges. What i mean is it looks more like GIF than a PNG. Rough around the edges, no transparency "inside" the image itself (where there should be)
i have tried re-creating the image (yes it IS a PNG) which did nothing. I ensured the library item is not being treated as a JPEG. I also even tried externally calling the PNG to see if that made a difference. Unfortunately it did not.
why this second PNG doesn't seem to have a transparency set?
View 8 Replies
Oct 31, 2011
I am trying to export these gifs with transparency and I am still getting the background with transparency selected in publish settings. Does anyone know a way to remove the background and just have a transparent gif?
View 20 Replies