Truncating last character in a string



  • 1. reloading images?
    I have an application that allows a user to delete a photo. When the user deletes the photo, I call a cfm page and delete the photo file on the server, then I go to the last photo and rename it to fill the hole created by the deleted photo. When I go back to the display section the deleted photo still is displayed. If I close the browser and reload the flash application the changed display is correct. I assume that this is cause by flash loading from the images in memory and not downloading the images again. Is the a way to force flash to redownload the photo?
  • 2. Timeline controlling problems
    Alright, I ran into a rather odd situation: my setup includes the main timeline, which has a movie clip that acts as a menu, and buttons inside the movie clip. Orignally, I was using code in a action frame on the main timeline like this and it had been working fine: this.Eventmenu.Cancel_btn.onRelease= function() { Eventmenu._visible=false; Eventmenu.gotoAndStop("Basic"); } Though for some random reason it stopped working recently. To make sure the button was being pushed, I included this code to Cancel_btn: on (release) { trace("Yo, I've been pushed"); } The trace statement occurs, but nothing else does. I have another problem where another button in that same menu has this code: on(release) { _parent.gotoAndPlay("ActionsOne"); } ActionsOne being a labeled frame in different scene. Likewise, this code USED to work, but has recently stopped. I'm fairly certain that I haven't done anything to my Flash MX to merit a change in language behavior. Any suggestions about what could be going wrong or show I should get around it? PS. My project works a lot with SharedObjects, and some of the above buttons had code ommited that included things like .flush() or .clear() commands. I bring it up because maybe the code isn't finished working on it's flushing and clearing and this delays or skips the later commands. I have no idea whether that can actually be the case or not.
  • 3. createEmptyMovieClip action to dynamically load sw
    Here is the code which I am trying to debug. I am trying to capture click event of dynamic buttons to load external swf files but it is not working. How do I get this done? Thanks in advance. for (count=1;count<=15;count++) { this.createTextField('textArea'+count,count,0,count*20,50,20); textRef=eval('textArea'+count); textRef.text= 'PLACE YOUR TEXT VARIABLE HERE'; this.createEmptyMovieClip('button'+count,count+16); clipRef=eval('button'+count); with (clipRef) { _x=textRef._x; _y=textRef._y; _width=textRef._width; _height=textRef._height; } clipRef.onRelease=function() { //Loads only one movie for all buttons } } button1.onRelease=function() { load("1.swf"); //Not working trace("1"); //Not working } button2.onRelease=function() { load("2.swf"); //Not working trace("2"); //Not working }
  • 4. menustructures and flash
    Hi, First of all i really like flash, the big set back for me is that when i design something that has to be adjusted i have to adjust my whole flash file. My question is... is it possible to let the content of a menu depend on external information. Like using a database for instance and let flash create a menubutton with a specific name for each entry in the database. I believe this is possible but i would like to know how, does anyone know any tutorials about this?? Also, in dreamweaver there is the possibility to use predefined flash buttons, is it also possible to create these buttons myself complete with the dreamweaver menu and all?? grtz

Truncating last character in a string

Postby schefz » Fri, 19 Oct 2007 02:31:45 GMT

I am making a dialpad. It is just for display so I am using a string for the 
numbers selected. I am trying to make a back button that would clear the last 
number added. I tried mystring.length-1  but that doesn't seem to be doing the 
trick. Is there a simple way to truncate the last character in a string, of 
variable length?? 

Re: Truncating last character in a string

Postby GWD » Fri, 19 Oct 2007 04:33:27 GMT

Here's an example

var someStr="asdfasdf saf asdf sadfas dfs fsa asf";

while (someStr.length) {
	someStr = someStr.substring(0,someStr.length-1)

Re: Truncating last character in a string

Postby schefz » Fri, 19 Oct 2007 08:55:07 GMT

thank you GWD!! once again you have helped me solve my problems.. I might have to start calling you Dr. Phill  :-)

Similar Threads:

1.Input text - losing last character

Nubie (and hopefully, easy) question - my input text fields all fail to capture 
the last character typed into the text field.  I'm currently asking users to 
hit the <ENTER> key before submitting their input (and this works because then 
ENTER becomes the final character), but there must be some simple fix that I'm 

 Here's a code example:

 Answer_a.type = TextFieldType.INPUT;
 Answer_a.addEventListener(TextEvent.TEXT_INPUT, textInputCapture);

 function textInputCapture(event:TextEvent):void {
 	submit_answer = Answer_a.text;

2.Deleting last char in string

Hey guys and girls,  I'm new to this actionscript thing and have used various 
other languages. All I want to do is find the last character in a string and 
delete it. Essentially what the backspace key does. But I can't work this out 
using the string class. Do I have to convert to an array?  thanks in advance 
for any help offered people. TUUK

3.Replacing characters in a string.

I am passing a string to a sql server database from within flash as a query, I 
have mostly successfully queried the database, but have had problems with 
queries that contain certain characters (such as pipes |, or '&') is there a 
way I can replace these characters before passing the query string to the 

4.I can't POST a variable (string) which contains greek characters correctly

I have a problem posting string variables from a flash movie to an ASP file.
When the ASP file recieves the posted variable, the text looks ok only when I
am posting english characters.
I can't POST a string variable with greek characters to an ASP or CFM file.
For example...

At Flash movie (ActionScript)...

var topostit = "<greek characters>";

At ASP file (JavaScript)...

var topostit=Request.Form('topostit')();

When topostit="English" then ASP file gives "English"
When topostit="<greek characters>" then ASP file gives "#^%$^$$$#"

Please tell me if you know the answer to this problem.

5.Passing Special characters in string from html to flash

6. Search String For Characters

7. special characters in strings and text feilds

8. Replacing String Characters

Return to FLASH


Who is online

Users browsing this forum: No registered users and 95 guest