Actionscript 3 :: Remove Whitespace In It?
Apr 22, 2010How can one remove whitespace from a string in as3?
I would like to be able to remove all carriage returns, spaces, tabs etc.
How can one remove whitespace from a string in as3?
I would like to be able to remove all carriage returns, spaces, tabs etc.
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 Repliesi 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 RepliesI 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 RepliesI'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?
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 RepliesI'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
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.
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.
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]...
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]...
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?
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 RepliesTurning 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?
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.
is being returned once the onrelease event happens. the loadmovie works fine but I want to remove
[Code]...
I'm making a game for children where they have to pay money by dragging it on a square. It al works wel only when i pick the first coin of one euro without going over the coin of 2 euro and then pick up a 2 euro coin the one euro disappears. after then it all works fine.i cant remove my duplicate euro's from the stage when i clic on pay here is my code for the euro's the euro's are in a emty movieclip
[code]...
In flash AS3 Do I need remove childs, if I remove the parent itseft? If I remove childs first, then remove the parent object afterall OR If I just remove parent object Will flash take same memory?
View 1 Repliesdo to the lack of good on Kongregate, I have come here =D
if(_root.row2.block1._x == _root.row1.block1._x)
{
_root.row2.block1.removeMovieClip();
[code]....
Just wondered if I remove a parent movieclip and then set it to null, will it remove all the child movieclips within it from the Display list and also from memory, or do I need to iterate through the parent movieclip removing all its children before removing the parent?
View 8 RepliesIn my experiment memory usage keeps growing a little (more, and more RAM usage after GC) when I use repeatedly:
Code:
removeChild(picContainer);
addChild(picContainer);
[code].....
I have exported data .xls file using as3.
var xml:ArrayCollection;
xml=Labneuron8.lastResult.Response.Terminal as ArrayCollection;
var str:String=xml[0].Value;
var xml1:XML=new XML(str);
[Code]...
Previously i had unloadmovie, but now?how to remove swf from swf when animation is goind to some frame?[code]...
View 1 RepliesSo I am still pretty new to AS3 and I am trying to put together a site. I have most of the functions working properly except one and this is the issue. I have a main SWF and inside this SWF i have a button, that when clicked, loads a image gallery SWF. The problem I am having is inside that gallery swf is a close button and when i click the close button to remove the swf, it doesnt work. I have looked through several forums without success. Does anyone know how to remove or close out a SWF with in a SWF? here is the code I am currently using in the gallery swf to close it out.[code]...
View 4 RepliesI want to remove an swf once a second page has been added .here is the website design
> a preloader loads my main menu , on the main timeline of my preloader.swf I create a new loader (loader1) and tell it load the URLRequest "menu.swf"
> The menu.swf loads, on menu.swf main timeline I create a click function (instantiates once a button has been clicked) that loads my second loader (loader2) and this loads the URLRequest "cast.swf"
I want cast.swf to replace menu.swf and remove it entirely but I cant figure out how to do it,here is what I have tried inside the click function of menu.swf(is this possible? can you write code to remove an swf if you are actually inside that swf's main timeline? )
removeChildAt(0); ( this only removes the bottom layer of the menu.swf)
removeChild(MovieClip(root).loader1); inside the click function ( this does not remove the menu.swf )
I'm trying to remove a loaded swf from inside the loaded swf itself. Here's my simplified code:
PHP Code:
// code on the loading swf
var movie_loader:Loader = new Loader();
addChild(movie_loader);[code]....
The removeChild code keeps generating the error: The supplied DisplayObject must be a child of the caller.
Let's say I have a global SoundChannel object, and inside a function I am repeatedly creating new instances of the Sound object to play songs one after the other. Each time I do this, I need to add a new eventListener to the SoundChannel to call the function 'onSoundComplete' that will load the next song on completion.Coming from a strict C++ programming background, I often wonder if it's necessary to do some kind of cleanup in Flash, or if it handles it automagically.Here's example code that specifically removes the eventListener from the previous Sound object everytime a new one is created, but I don't want to be doing this if it isn't necessary:
Code:
// Setup sound object buffer
var slc:SoundLoaderContext = new SoundLoaderContext(3000);
[code].....
I have images loading from an array. A slideshow. This works fine, but they pile on top of each other. I cannot figure out how to remove them. what's the simplest way to remove them? How do I say - if pic1 is loaded, before loading pic2, remove pic1?
Code:
var aPics:Array=new Array("pic1.jpg","pic2.jpg","pic3.jpg","pic4.jpg","pic5.jpg");
var threeSeconds:Timer=new Timer(3000,aPics.length);
threeSeconds.start();
[code]....
I was trying to integrate two game flash files that I created, by combining them into one file (on one timeline), but was having issues with making my timer stop. As the lesser of two evils (or so I thought) I decided to load one of the games into the other file on a particular button click as an external .swf. This solved the timing issue, but now I don't know how to get rid of the .swf once im done playing it and ready to move on with the original game! I need some buttoncode (AS2) to remove .swf on button click.
Button code to load .swf looks like this...
on (release){
LoadMovieNum("racing_part1_me.swf",2)
_level2.gotoAndPlay(25);
if (_level2.variable=="yes") {
_level2.play();
}}
I have a Main.as tied to the root stage.Inside the Main.as I create a MC called subClass.as Inside that subClass movieclip I have another movieClip called subsubClass.as by going this.addChild(subsubClass).now how do I remove subsubclass?
View 4 Replies