# Your standard: “OMG PLEASE HELP ME!”

**URL:** <https://forum.kirupa.com/t/your-standard-omg-please-help-me/315577>\
**Category:** Uncategorized\
**Created:** [October 29, 2010, 11:01am UTC](https://forum.kirupa.com/t/your-standard-omg-please-help-me/315577 "2010-10-29T11:01:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RHayabusa](https://avatars.discourse-cdn.com/v4/letter/r/8edcca/32.png) [@RHayabusa](https://forum.kirupa.com/u/RHayabusa)\
**Post date:** [October 29, 2010, 11:01am UTC](https://forum.kirupa.com/t/your-standard-omg-please-help-me/315577/1 "2010-10-29T11:01:45Z")

</div>

[FONT=Calibri][SIZE=3]Okay, so I’m trying to get a button when pressed to display text from an external .txt file (which I’ve done so far), but _**(1)**_ I want it to only display certain paragraphs (the actual dialogue) of this text and \*\*\*(2) \*\*\*every time I click the button it should replace the old text with the new (like in any RPG). Now I asked a former lecturer for help and he gave me a link to a website and gave me a hint of what to do, but seeing as I was recently voted #48 on Forbes worst 100 programmers of all time (actually I haven’t’ used AS for 5 years) so I thought someone could explain it to me in a much clearer fashion? Please help. Thank you in advance.[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3]PS: My lecturer said: “[/SIZE][/FONT][FONT=Courier New]When you click the button to add text to the textfield but you ewant the previous text to be cleared the first thing you do is empty the box ( myText.text = “”) then fill the box again with your new text…[/FONT]  
[FONT=Courier New]MyText.text = whateverYouWant[/FONT][FONT=Calibri][SIZE=3]”[/SIZE][/FONT]

**[FONT=Cambria][SIZE=4][COLOR=#4f81bd]My code[/COLOR][/SIZE][/FONT]**

_**[SIZE=3][FONT=Calibri]var Dialogue\_txt:TextField = new TextField();[/FONT][/SIZE]**_  
_**[SIZE=3][FONT=Calibri]var externalReq:URLRequest = new URLRequest(“MySQL script.txt”);[/FONT][/SIZE]**_  
_**[SIZE=3][FONT=Calibri]var externalLoad:URLLoader = new URLLoader();[/FONT][/SIZE]**_

_**[SIZE=3][FONT=Calibri]externalLoad.load(externalReq);[/FONT][/SIZE]**_

_**[SIZE=3][FONT=Calibri]externalLoad.addEventListener(Event.COMPLETE, textReady);[/FONT][/SIZE]**_  
_**[SIZE=3][FONT=Calibri]FastForward\_Btn.addEventListener(MouseEvent.CLICK, onClick);[/FONT][/SIZE]**_

_**[SIZE=3][FONT=Calibri]Dialogue\_txt.x = 92.70 ;[/FONT][/SIZE]**_  
_**[SIZE=3][FONT=Calibri]Dialogue\_txt.y = 46.70;[/FONT][/SIZE]**_  
_**[SIZE=3][FONT=Calibri]Dialogue\_txt.border = false;[/FONT][/SIZE]**_  
_**[SIZE=3][FONT=Calibri]Dialogue\_txt.width = 372.20;[/FONT][/SIZE]**_  
_**[SIZE=3][FONT=Calibri]Dialogue\_txt.height = 220.75;[/FONT][/SIZE]**_  
_**[SIZE=3][FONT=Calibri]Dialogue\_txt.wordWrap = true;[/FONT][/SIZE]**_

_**[SIZE=3][FONT=Calibri]function textReady(event:Event):void[/FONT][/SIZE]**_  
_**[SIZE=3][FONT=Calibri]{[/FONT][/SIZE]**_  
_**[SIZE=3][FONT=Calibri]Dialogue\_txt.text = event.target.data;[/FONT][/SIZE]**_  
_**[SIZE=3][FONT=Calibri]}[/FONT][/SIZE]**_

_**[SIZE=3][FONT=Calibri]function onClick(event:MouseEvent):void[/FONT][/SIZE]**_  
_**[SIZE=3][FONT=Calibri]{[/FONT][/SIZE]**_  
_**[SIZE=3][FONT=Calibri]addChild(Dialogue\_txt);[/FONT][/SIZE]**_

_**[SIZE=3][FONT=Calibri]}[/FONT][/SIZE]**_
