2016-04-13 32 views
0

ActionScript diline oldukça yeniyim ve dinamik bir metin alanına satır sonları nasıl ekleyebileceğimi merak ediyordum.Action Script 3 Satırlar tırnak işaretleri içinde kırılıyor

Metin kutusunda bir dizi aracılığıyla görünecek metin kümesi var, ancak bazı sorular diğerlerinden daha uzun. Bu, metnin bir kısmının veya bir kısmının ekrandan çıktığı anlamına gelir.

Bir şey mi veya html <br> etiketi ile aynı şeyi/etkiyi arıyorum.

Herhangi bir cevap takdir ve zaman ayırdığınız için teşekkür ederiz.

var textField:TextField = new TextField(); 
textField.text = "Line\nBreak"; 
addChild(textField); 

enter image description here

: Sen metne yeni bir satır eklemek için kaçış dizisi \n kullanabilirsiniz

import flash.events.MouseEvent; 

stop(); 

var nQNumber:Number = 0; 
var aQuestions:Array = new Array(); 
var aCorrectAnswers:Array = new Array("c", "ab", "c", "c", "d", "b", "a", "b", "a", "a", "abceg", "a", "b", "a", "a") 
var aUserAnswers:Array = new Array(); 
var cQAnswers:Array = new Array(); 

aQuestions[0] = "What does the evacuation siren sound like?"; 
aQuestions[1] = "What must you do if you hear the eacuation siren? (Multiple Answers)"; 
aQuestions[2] = "What must you do with cigarette lighters or matches while on the manifacturing site?"; 
aQuestions[3] = "Is it OK to carry a mobile phone on the manufacturing area of the site?"; 
aQuestions[4] = "What must you do if a chemical comes into contact with your eyes or skin?"; 
aQuestions[5] = "What is the maximum speed permitted on site?"; 
aQuestions[6] = "Who has the right of way at pedestrian crossings?"; 
aQuestions[7] = "Who must you report any injuries, incidents, near misses or hazards to?"; 
aQuestions[8] = "Where is the evacuation assembly area?"; 
aQuestions[9] = "Where can you access a Saftey Data Sheet? (Multiple Answers)"; 
aQuestions[10] = "What Personal Protective Equipment is required to be worn at all times on the manufacturing site? (Multiple Answers)"; 
aQuestions[11] = "Who is permitted to drive a forklift on site?"; 
aQuestions[12] = "When are you permitted to remove a tag?"; 
aQuestions[13] = "What is required before any maintenance or repairs are carried out on the plant? (Multiple answers)"; 
aQuestions[14] = "When should you wash your hands?"; 

cQAnswers[0] = ""; 
cQAnswers[1] = ""; 
cQAnswers[2] = ""; 
cQAnswers[3] = ""; 
cQAnswers[4] = ""; 
cQAnswers[5] = ""; 
cQAnswers[6] = ""; 
cQAnswers[7] = ""; 
cQAnswers[8] = ""; 
cQAnswers[9] = ""; 
cQAnswers[10] = ""; 
cQAnswers[11] = ""; 
cQAnswers[12] = ""; 
cQAnswers[13] = ""; 
cQAnswers[14] = ""; 

questions_txt.text = aQuestions [nQNumber]; 

submit_btn.addEventListener(MouseEvent.CLICK, quiz); 

function quiz(e:MouseEvent):void 
{ 
    aUserAnswers.push(answers_txt.text); 
    answers_txt.text = ""; 
    nQNumber++; 
    if(nQNumber < aQuestions.length) 
    { 
      questions_txt.text = aQuestions[nQNumber]; 
    } 
    else 
    { 
      nextFrame(); 
    } 
} 

The questions in the quotation marks in the array

cevap

0

(İşte kare için kodudur) here

01 Sıralı sıralama tablosuna göz atın