need some help on Flash

Discussion in 'Programming' started by MTA, Jan 17, 2008.

  1. #1
    I am doing where a person can enter some text into a input text box.. It is multiline.. What I want to happen is the user can us # to do to the next line..

    test # test
    will be
    test
    test

    Can anyone help me with this..
     
    MTA, Jan 17, 2008 IP
  2. jprice259

    jprice259 Peon

    Messages:
    100
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If its written in php you can always try the $variable = str_replace("#","<br>" $variable);

    would that work? You have to be more specific and less abstract :)
     
    jprice259, Jan 19, 2008 IP
  3. Xavier_3D

    Xavier_3D Well-Known Member

    Messages:
    1,299
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    140
    #3
    I don't think that would be easy with Flash. For Multi-line fields its usually Enter that Works in Flash. I'll ask Some friends about this and let you know.
     
    Xavier_3D, Jan 19, 2008 IP
  4. MTA

    MTA Well-Known Member

    Messages:
    185
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    125
    #4
    Thanks you
     
    MTA, Jan 19, 2008 IP
  5. nishanthe

    nishanthe Peon

    Messages:
    121
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    There is not a imple solution within flash because ActionScript Doesnt have simple replace function. Here is a simple function replace any text

    
    
    var my_str:String = "One#Two#Three#Four";
    function replace_txt(my_str:String) {
    	var my_new_str:String = "";
    	var my_arr:Array = my_str.split("#"); //You can change the character or string you want to use a a breaker
    	for (i=0; i<my_arr.length; i++) {
    		my_new_str += my_arr[i]+newline;
    	}
    	return my_new_str;
    }
    my_txt.text = replace_txt(my_str); // my_txt text field 
    
    
    Code (markup):
     
    nishanthe, Jan 20, 2008 IP
  6. MTA

    MTA Well-Known Member

    Messages:
    185
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    125
    #6
    MTA, Jan 21, 2008 IP
  7. nishanthe

    nishanthe Peon

    Messages:
    121
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I visited the example. unfortunately, This is not a place to explain all the functionalities of that app. But if you want to see how to swap "*" with a linebreak, please use following function.

    
    var my_str:String = "One#Two#Three#Four";
    function replace_txt(my_str:String) {
    	var my_new_str:String = "";
    	var my_arr:Array = my_str.split("*"); //You can change the character or string you want to use a a breaker
    	for (i=0; i<my_arr.length; i++) {
    		my_new_str += my_arr[i]+newline;
    	}
    	return my_new_str;
    }
    my_txt.text = replace_txt(my_str); // my_txt text field
    
    
    Code (markup):
     
    nishanthe, Jan 21, 2008 IP
  8. MTA

    MTA Well-Known Member

    Messages:
    185
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    125
    #8
    ok This is what I have..
    //this is the variable for the dynamic box
    var text = "Make your changes, copy to get your code!!" //if the text on the Input box is changed this event is called 
    var my_str:String = "";
    function replace_txt(my_str:String) {
    	var my_new_str:String = "";
    	var my_arr:Array = my_str.split("*"); //You can change the character or string you want to use a a breaker
    	for (i=0; i<my_arr.length; i++) {
    		my_new_str += my_arr[i]+newline;
    	}
    	return my_new_str;
    }
    iText.text = replace_txt(my_str); // my_txt text field
    
    
    
    iText.onChanged = function() 
    { _root.text = "<center><font size='-1'><a href='http://www.mateable.com/'>Giving a new definition to love and friendship</a></font><br><embed src='" + lnpath + "vday.swf' FlashVars='&ms=" + ms + "' quality='high' wmode='transparent' width='385' height='380' name='Christian Bible' align='middle' allowScriptAccess='samedomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /><a href='" + lnpath + "'>" + linktext + "</a></center>";
    }
    
    
    Code (markup):

    I have two text boxes..

    one is dynamic Text Var ms and instance Name iText

    the other is input Text with the same VAR and Instance Name..

    When i type in the input box it puts it on the dynamic Text so If i type in * it wont do anything..
     
    MTA, Jan 21, 2008 IP
  9. nishanthe

    nishanthe Peon

    Messages:
    121
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    You have made many mistakes from naming to refering, and many things. I just uploaded the corrected version at http://www.srilankaexpedition.com/christian_biblegen.rar
     
    nishanthe, Jan 21, 2008 IP
  10. MTA

    MTA Well-Known Member

    Messages:
    185
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    125
    #10
    Thanks you for all of your help.
     
    MTA, Jan 23, 2008 IP