Форум Flasher.ru
Ближайшие курсы в Школе RealTime
Список интенсивных курсов: [см.]  
  
Специальные предложения: [см.]  
  
 
Блоги Правила Справка Пользователи Календарь Сообщения за день
 

Вернуться   Форум Flasher.ru > Flash > ActionScript 3.0

Версия для печати  Отправить по электронной почте    « Предыдущая тема | Следующая тема »  
Опции темы Опции просмотра
 
Создать новую тему  
Старый 29.06.2013, 00:58
Godwarlock вне форума Посмотреть профиль Отправить личное сообщение для Godwarlock Найти все сообщения от Godwarlock
  № 1  
Ответить с цитированием
Godwarlock

Регистрация: Jan 2012
Сообщений: 836
По умолчанию TextArea проблема

Код AS3:
function requestEntries():void {
    output_txt.text = "Populating chat window...";
    var variables_re:URLVariables = new URLVariables();
 
    var varSend_re:URLRequest = new URLRequest("chat.php");
    varSend_re.method = URLRequestMethod.POST;
    varSend_re.data = variables_re;
 
    var varLoader_re:URLLoader = new URLLoader;
    varLoader_re.dataFormat = URLLoaderDataFormat.VARIABLES;
    varLoader_re.addEventListener(Event.COMPLETE, completeHandler_re);
 
    function completeHandler_re(event:Event):void{
 
        if (event.target.data.returnBody == "") {
            output_txt.text = "No data coming through";
        } else {
            stored_id_txt.text = "" + event.target.data.stored_id;
            output_txt.condenseWhite = true;
            output_txt.htmlText = "" + event.target.data.returnBody;
        }
 
    }
    variables_re.requester = "initial_request";
    varLoader_re.load(varSend_re);
}
requestEntries();
 
var fiveSecs:Timer = new Timer(1000, 5);
fiveSecs.addEventListener(TimerEvent.TIMER, onTick);
fiveSecs.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
fiveSecs.start();
 
function onTick(event:TimerEvent):void {
    timer_txt.text = "" + event.target.currentCount;
}
 
function onTimerComplete(event:TimerEvent):void{
 
    var variables_cc:URLVariables = new URLVariables();
    var varSend_cc:URLRequest = new URLRequest("chat.php");
    varSend_cc.method = URLRequestMethod.POST;
    varSend_cc.data = variables_cc;
    var varLoader_cc:URLLoader = new URLLoader;
    varLoader_cc.dataFormat = URLLoaderDataFormat.VARIABLES;
    varLoader_cc.addEventListener(Event.COMPLETE, completeHandler_cc);
 
    function completeHandler_cc(event:Event):void{
        if (event.target.data.statusline == "is_new") {
              output_txt.condenseWhite = true;
              output_txt.htmlText = "" + event.target.data.returnBody;
              stored_id_txt.text = "" + event.target.data.stored_id;
              status_txt.text = "" + event.target.data.statusline;
        }
    }
    // ready the last_refresh_time variable for sending to PHP
    variables_cc.requester = "chat_check";
    variables_cc.stored_id = stored_id_txt.text;
    varLoader_cc.load(varSend_cc);
    fiveSecs.reset();
    fiveSecs.start();
}
 
 
input_txt.restrict = "^&<>";
// hide the little processing movieclip
processing_mc.visible = false;
// Assign a variable name for our URLVariables object
var variables_se:URLVariables = new URLVariables();
//  Build the varSend variable that is the URLRequest object
var varSend_se:URLRequest = new URLRequest("chat.php");
varSend_se.method = URLRequestMethod.POST;
varSend_se.data = variables_se;
// Build the varLoader variable
var varLoader_se:URLLoader = new URLLoader;
varLoader_se.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader_se.addEventListener(Event.COMPLETE, completeHandler_se);
 
// Handler for PHP script completion and return
function completeHandler_se(event:Event):void{
    // remove processing movieclip(or make invisible)
    processing_mc.visible = false;
    // Load the response from the PHP file
    stored_id_txt.text = "" + event.target.data.stored_id;
    output_txt.condenseWhite = true;
    output_txt.htmlText = "" + event.target.data.returnBody;
}
 
// Add an event listener for the submit button and what function to run
submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);
// Validate form fields and send the variables when submit button is clicked
function ValidateAndSend(event:MouseEvent):void{
 
    // validate form fields
    if(!input_txt.length || !uname_txt.length) {
         // Please type your name and chat content error display goes here
    } else {
 
        processing_mc.visible = true;
 
        variables_se.requester = "new_chat";
        variables_se.user_name = uname_txt.text;
        variables_se.chat_body = input_txt.text;   
 
        varLoader_se.load(varSend_se);
        input_txt.text = ""; // Empty the input field
        output_txt.text = "Waiting for server connection...";
 
    } // close else after form validation
} // Close ValidateAndSend function //////////////////////////////////////////////////////////////
Проблема в том, что при тесте весь код копируется в TextArea output_txt. Почему он это делает?

Создать новую тему   Часовой пояс GMT +4, время: 19:06.
Быстрый переход
  « Предыдущая тема | Следующая тема »  

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.


 


Часовой пояс GMT +4, время: 19:06.


Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.