PDA

Просмотр полной версии : Компонент alert и как с ним бороться?


Виктор_123456
03.03.2009, 14:19
Помогите разобраться из xml документа гружу вопросы и ответы+чекбоксы, после выбора и проверки вывожу alert c результатами, окно получается под текстом? Может когда я контейнер создаю с вопросами надо указать уровень??:wacko:

//----------------------------------------- Создаем вопросы --

function createQuestionnaire():Void{
rootNode = this.firstChild;
for(var i:Number=0; i<rootNode.childNodes.length; i++){

//КОНТЕЙНЕР
movie = _root.createEmptyMovieClip("mcQuestion"+i, _root.getNextHighestDepth());

//ТЕКСТ
movie.createTextField("tQuestion"+i, movie.getNextHighestDepth(), 0,0, 400,40);
//movie["tQuestion"+i].border = true;
movie["tQuestion"+i].selectable=false;
movie["tQuestion"+i].multiline = true;
movie["tQuestion"+i].html = true;
movie["tQuestion"+i].htmlText = rootNode.childNodes[i].attributes["Q"];
movie["tQuestion"+i].htmlText += "<b><u>Пожалуйста выбирите " + rootNode.childNodes[i].attributes["noCorrect"] + " вариант(а)</u></b>";
movie["tQuestion"+i].setTextFormat(tfQuestion);

movie._x = posX;
movie._y = posY;

//РАСТАВЛЯЕМ ЧЕКБОКСЫ
for(var j:Number=0; j<rootNode.childNodes[i].childNodes.length; j++){
checkbox = movie.attachMovie("mcCheckbox", "mcCheckbox"+j, movie.getNextHighestDepth());
checkbox.tAnswer.autoSize = true;
//----------------------------------не выделяем
checkbox.tAnswer.selectable = false;
//-----------------------------------
checkbox.tAnswer.text = rootNode.childNodes[i].childNodes[j].attributes["A"];
checkbox.isCorrect = rootNode.childNodes[i].childNodes[j].attributes["correct"];
aCheckboxes.push(checkbox);
checkbox._y = (j * 25)+50;
checkbox._x = 40;
}

posY += movie._height + 10;
}
}


//---------------------------------- Действия / функции ---------

mcSubmit.onRelease = checkAnswers;
mcAnswers.onRelease = showAnswers;
mcPlayAgain.onRelease = replay;
//----------------------------------------------------------

function checkAnswers():Void{
for(var i:Number=0; i < aCheckboxes.length; i++){
if(aCheckboxes[i].isCorrect == "true"){
if(aCheckboxes[i].cmpCheck.selected){
score++;
}
totalScore++;
}
}
//----------------------Активируем кнопки-----------
mcPlayAgain._visible = true;
mcAnswers._visible = true;
//----------------------Сообщаем результат
Alert.show("Вы выбрали " + score + " из " + totalScore + " правильных!!", " Ваш Результат!!!");
//----------------------Убираем кнопку ответа--------
mcSubmit._visible=false;

Alkaz
03.03.2009, 16:23
ни разу не работал с этим алертом и в код ваш сильно не вникал, но вы уверены что проблема не в этом:

getNextHighestDepth (MovieClip.getNextHighestDepth method)
...
Note: If you are using version 2 components, do not use this method. If you place a version 2 component either on the Stage or in the Library, the getNextHighestDepth() method can sometimes return depth 1048676, which is outside the valid range. If you are using version 2 components, you should always use the version 2 components DepthManager class.
?

cleptoman
03.03.2009, 17:00
отправляйте ваше окно на заведомо высший уровень.
как вариант Alert.swapDepths(20000);

Виктор_123456
04.03.2009, 15:34
НЕ компилятор ругается -The property being referenced does not have the static attribute.