Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 1.0/2.0 (http://www.flasher.ru/forum/forumdisplay.php?f=93)
-   -   второй ComboBox тормозит при складывании (http://www.flasher.ru/forum/showthread.php?t=92672)

enepx 03.03.2007 14:00

второй ComboBox тормозит при складывании
 
Есть два ComboBox'а area_combobox и carrier_combobox. Присваиваю им свойства так:
Код:

...
function setComboBoxStyle(target:ComboBox) {
        target.setStyle("themeColor","haloGreen");
        target.setStyle("selectionColor",0xF7C655);
        target.setStyle("rollOverColor",0xF9D686);
        target.setStyle("borderStyle", "alert");
        target.setStyle("backgroundColor", 0xFFFACA);
        target.setStyle("fontFamily", "Verdana");
        target.setStyle("fontWeight", "bold");
        target.setStyle("fontSize", 12);
        target.setStyle("color", 0x547700);
        target.setStyle("textSelectedColor", 0x764701);
        target.setStyle("textRollOverColor", 0x764701);
        target.setStyle("marginLeft", 5);
        target.setStyle("openDuration", 200);
        target.setStyle("openEasing", Bounce.easeIn);
}
...
setComboBoxStyle(area_combobox);
setComboBoxStyle(carrier_combobox);
...

Все нормально, только вот второй (carrier_combobox) тормозит при складывании. Не могу понять, ведь первый комбик работает на ура! :)

etc 03.03.2007 14:07

Показывай исходник.

enepx 03.03.2007 15:08

да в исходнике вроде ничего нету страшного:
все что я делаю с комбами - это заполняю их из xml. может это из-за того, что я это делаю в первом кадре и он циклится? щас проверю ) :rolleyes:

etc 03.03.2007 15:09

Вот в этих троеточиях ищи ошибку.

enepx 03.03.2007 15:10

исходник
 
проверил, не так... :(
Код:

stop();

import mx.controls.TextInput;
import mx.controls.ComboBox;
import mx.controls.Button;

function setTextInputStyle(target:TextInput) {
        target.setStyle("borderStyle", "alert");
        target.setStyle("borderColor", 0x363C0B);
        target.setStyle("backgroundColor", 0xFFFACA);
        target.setStyle("fontFamily", "Verdana");
        target.setStyle("fontWeight", "bold");
        target.setStyle("fontSize", 12);
        target.setStyle("color", 0x547700);
}
function setTextInputPhoneStyle(target:TextInput) {
        target.setStyle("borderStyle", "alert");
        target.setStyle("borderColor", 0x363C0B);
        target.setStyle("backgroundColor", 0xFFFACA);
        target.setStyle("fontFamily", "Verdana");
        target.setStyle("fontWeight", "bold");
        target.setStyle("fontSize", 20);
        target.setStyle("color", 0x547700);
}
function setComboBoxStyle(target:ComboBox) {
        target.setStyle("themeColor","haloGreen");
        target.setStyle("selectionColor",0xF7C655);
        target.setStyle("rollOverColor",0xF9D686);
        target.setStyle("borderStyle", "alert");
        target.setStyle("backgroundColor", 0xFFFACA);
        target.setStyle("fontFamily", "Verdana");
        target.setStyle("fontWeight", "bold");
        target.setStyle("fontSize", 12);
        target.setStyle("color", 0x547700);
        target.setStyle("textSelectedColor", 0x764701);
        target.setStyle("textRollOverColor", 0x764701);
        target.setStyle("marginLeft", 5);
        target.setStyle("openDuration", 200);
        target.setStyle("openEasing", Bounce.easeIn);
}
function setButtonStyle(target:Button) {
        target.setStyle("borderStyle", "alert");
        target.setStyle("borderColor", 0x363C0B);
        target.setStyle("backgroundColor", 0xFFFACA);
        target.setStyle("fontFamily", "Verdana");
        target.setStyle("fontWeight", "bold");
        target.setStyle("fontSize", 13);
        target.setStyle("color", 0x547700);
}
setTextInputStyle(name_edit1);
setTextInputStyle(name_edit2);
setTextInputPhoneStyle(phone_edit1);
setTextInputPhoneStyle(phone_edit2);
setTextInputPhoneStyle(phone_edit3);
setComboBoxStyle(area_combobox);
setComboBoxStyle(carrier_combobox);
setButtonStyle(send_btn);
//setButtonStyle(unsubscribe_btn);
//unsubscribe_btn.setStyle("fontWeight", "normal");
name_edit1.setFocus();
name_edit1.tabIndex = 1;
name_edit2.tabIndex = 2;
phone_edit1.tabIndex = 3;
phone_edit2.tabIndex = 4;
phone_edit3.tabIndex = 5;
area_combobox.tabIndex = 6;
carrier_combobox.tabIndex = 7;
send_btn.tabIndex = 8;

var answer_xml:XML = new XML();
answer_xml.ignoreWhite = true;
answer_xml.load("params.xml");
answer_xml.onLoad = function(success:Boolean) {
        trace
        if (success) {
                for (var i=0; i<this.firstChild.childNodes.length; i++) {
                        if (this.firstChild.childNodes[i].nodeName=="headline") {
                                text_txt.text = this.firstChild.childNodes[i].attributes.text;
                                subtext_txt.text = this.firstChild.childNodes[i].attributes.subtext;
                        }
                        if (this.firstChild.childNodes[i].nodeName=="areas") {
                                area_combobox.removeAll();
                                area_combobox.addItem({data:0, label:"please select"});
                                for (var j=0; j<this.firstChild.childNodes[i].childNodes.length; j++) {
                                        area_combobox.addItem({data:this.firstChild.childNodes[i].childNodes[j].attributes.id, label:this.firstChild.childNodes[i].childNodes[j].attributes.title});
                                }
                        }
                        if (this.firstChild.childNodes[i].nodeName=="carriers") {
                                carrier_combobox.removeAll();
                                carrier_combobox.addItem({data:0, label:"please select"});
                                for (var j=0; j<this.firstChild.childNodes[i].childNodes.length; j++) {
                                        carrier_combobox.addItem({data:this.firstChild.childNodes[i].childNodes[j].attributes.id, label:this.firstChild.childNodes[i].childNodes[j].attributes.title});
                                }
                        }
                }
        } else {trace("INCORRECT LOADING!");trace(answer_xml)}
}

function redBlink(fFields:Array) {
        var p:Number=0;
        hlColor = 0xFED6C5;
        stdColor = 0xFFFACA;
//        trace(fFields);
        this.onEnterFrame = function () {
                if (p==13) {
                        delete this.onEnterFrame;
                }
                if (p%3==0) {
                        if (fFields[0]=="1") name_edit1.setStyle("backgroundColor",hlColor);
                        if (fFields[1]=="1") name_edit2.setStyle("backgroundColor",hlColor);
                        if (fFields[2]=="1") phone_edit1.setStyle("backgroundColor",hlColor);
                        if (fFields[3]=="1") phone_edit2.setStyle("backgroundColor",hlColor);
                        if (fFields[4]=="1") phone_edit3.setStyle("backgroundColor",hlColor);
                        if (fFields[5]=="1") area_combobox.setStyle("backgroundColor",hlColor);
                        if (fFields[6]=="1") carrier_combobox.setStyle("backgroundColor",hlColor);
                } else {
                        if (fFields[0]=="1") name_edit1.setStyle("backgroundColor",stdColor);
                        if (fFields[1]=="1") name_edit2.setStyle("backgroundColor",stdColor);
                        if (fFields[2]=="1") phone_edit1.setStyle("backgroundColor",stdColor);
                        if (fFields[3]=="1") phone_edit2.setStyle("backgroundColor",stdColor);
                        if (fFields[4]=="1") phone_edit3.setStyle("backgroundColor",stdColor);
                        if (fFields[5]=="1") area_combobox.setStyle("backgroundColor",stdColor);
                        if (fFields[6]=="1") carrier_combobox.setStyle("backgroundColor",stdColor);
                }
                p++;
        }
}
function checkEmpty():Boolean {
        var failedFields = new Array(7);
        for (var i=0; i<7; i++) failedFields[i] = "0";
//        trace(failedFields);
        if (name_edit1.text=="") failedFields[0] = "1";
        if (name_edit2.text=="") failedFields[1] = "1";
        if (phone_edit1.text=="") failedFields[2] = "1";
        if (phone_edit2.text=="") failedFields[3] = "1";
        if (phone_edit3.text=="") failedFields[4] = "1";
        if (area_combobox.selectedIndex==0) failedFields[5] = "1";;
        if (carrier_combobox.selectedIndex==0) failedFields[6] = "1";
       
        redBlink(failedFields);

        var flag:Boolean = false;
        for (var i=0; i<7; i++) if(failedFields[i]=="1") flag = true;
        return flag;
}
function onLoginReply() {
//        trace(loginReplyXML);
}

//"continue" button click
send_btn.toggle = true;
var loginForm:Object = new Object();
loginForm.click = function(eventObj:Object) {
        eventObj.target.selected = false;
        if (checkEmpty()) return;        //check fields
        loginXML = new XML("<subscribe first_name=\""+name_edit1.text+"\" last_name=\""+name_edit2.text+"\" phone_number=\""+phone_edit1.text+phone_edit2.text+phone_edit3.text+"\" area=\""+area_combobox.selectedItem.data+"\" carrier=\""+carrier_combobox.selectedItem.data+"\" />");
        trace(loginXML);
        loginReplyXML = new XML();
        loginReplyXML.onLoad = onLoginReply;
//        loginXML.sendAndLoad("http://moon/akharitonov/recector/receptor.php",loginReplyXML);
};
send_btn.addEventListener("click", loginForm);
///////////////////////////////

//"phone1" change
var phone1change:Object = new Object();
phone1change.change = function(eventObj:Object) {
        eventObj.target.selected = false;
        if (eventObj.target.length == 3) phone_edit2.setFocus();
};
phone_edit1.addEventListener("change", phone1change);
///////////////////////////////

//"phone2" change
var phone2change:Object = new Object();
phone2change.change = function(eventObj:Object) {
        eventObj.target.selected = false;
        if (eventObj.target.length == 3) phone_edit3.setFocus();
};
phone_edit2.addEventListener("change", phone2change);
///////////////////////////////


etc 03.03.2007 15:12

Проверь с одинаково заполненными боксами установку стилей.

enepx 05.03.2007 13:44

пробовал заполнить одинаковым текстом типа:
item1
item2
item3
item4
item5

Один фиг, от данных не зависит ИМХО.

etc 05.03.2007 14:01

А без стилей всё ОК?
Вообще, давай рабочий исходник.


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

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