a continuación, en el primer paso para la visita: la entrada de texto addEventListener KeyboardEvent.KEY_DOWN
segundo paso: as3 imagen de carga
La enfermedad le proporcionará un código de ejemplo con la parte de entrada de texto, la parte de imagen que hacer la investigación para ello.
Asumiendo que tiene un texto de entrada en el escenario, con la inputText nombre de instancia:
inputText.addEventListener(KeyboardEvent.KEY_DOWN,inputText_onKeyDown);
function onKeyDown(evt:KeyboardEvent){
// if the key is ENTER
if(evt.charCode == 13)
{
// your code here
ProcessWord(inputText.text);
}
}
function ProcessWord(word:String)
{
word = word.toLowerCase();
switch (word)
{
case "new york": LoadSomeImage("images/newyork.jpg"); break;
case "london": LoadSomeImage("images/london.jpg"); break;
}
}
function LoadSomeImage(imagePath:String)
{
trace("loading image:" + imagePath);
// here you do the image load
}
- inputText.addEventListener(KeyboardEvent.KEY_DOWN,inputText_onKeyDown);
- function onKeyDown(evt:KeyboardEvent){
- // if the key is ENTER
- if(evt.charCode == 13)
- {
- // your code here
- ProcessWord(inputText.text);
- }
- }
- function ProcessWord(word:String)
- {
- word = word.toLowerCase();
- switch (word)
- {
- case "new york": LoadSomeImage("images/newyork.jpg"); break;
- case "london": LoadSomeImage("images/london.jpg"); break;
- }
- }
- function LoadSomeImage(imagePath:String)
- {
- trace("loading image:" + imagePath);
- // here you do the image load
- }
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”