я новичок в программировании; особенно объектно-ориентированное программирование, и уже некоторое время работают над этим.
У меня есть файл .fla; кадр 1 является контейнером. Если щелкнуть по нему, отобразятся еще три кадра (слой 1). Кадр 2 слоя 1 — правильная анимация; кадр 3 неправильный. На кадре 2 (я думаю, слой 2) находится динамическое текстовое поле. Здесь я хочу, чтобы мой _correctText находился (_incorrectText должен располагаться в кадре 3 (слой 2). ПРИМЕЧАНИЕ. Я смог добавить текст динамически, но мне нужно настоящее текстовое поле, к которому наши художники-графики могут «прикасаться», чтобы техника был непроходной.
Я чувствую, что мне нужно «пузыриться», добавлять слушателей и отображать, но я не могу понять, как это реализовать.
Никакой код не может жить на временной шкале; идея состоит в том, чтобы «компонентировать» это; следовательно, проверяемые.
Любая помощь очень ценится, и если вы можете «отупить» терминологию, это было бы здорово...
Вот мой код:
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.display.DisplayObject;
import flash.display.FrameLabel;
import flash.display.SimpleButton;
import flash.text.*
public dynamic class hotSpotContainer extends MovieClip
{
var _incorrectText:String = "";
var _correctText:String = "";
public function hotSpotContainer()
{
stop();
addEventListener (Event.EXIT_FRAME, onExitFrame);
}
protected function onExitFrame($event:Event):void
{
removeEventListener(Event.EXIT_FRAME, onExitFrame);
ButtonClicks();
}
public function ButtonClicks()
/*If the mouse is clicked on one of the buttons listed below, go to the appropriate function.*/
{
(this as MovieClip).correct_Btn.addEventListener(MouseEvent.CLICK, correctAnimation);
(this as MovieClip).incorrect_Btn.addEventListener(MouseEvent.CLICK, incorrectAnimation);
}
public function correctAnimation($event:MouseEvent)
/*If the correct_Btn is clicked, go to the correctScreen frame and stop.
The correctScreen frame includes the correct animation (Correct_anim) which tweens to a correct screen.*/
{
gotoAndStop("correctScreen");
(this as MovieClip).reset_Btn.addEventListener(MouseEvent.CLICK, resetImage);
}
public function incorrectAnimation($event:MouseEvent)
/*If the incorrect_Btn is clicked, go to the incorrectScreen frame and stop.
The incorrectScreen frame includes the incorrect animiation (Incorrect_anim) which tweens to an incorrect screen.*/
{
gotoAndStop("incorrectScreen");
(this as MovieClip).reset_Btn.addEventListener(MouseEvent.CLICK, resetImage);
}
public function resetImage($event:MouseEvent)
/*If the reset_Btn is clicked, go to the startPoint frame and stop.
The startPoint frame brings the user back to the beginning. Reinvoking ButtonClicks allows the user to start over.*/
{
gotoAndStop("startPoint");
ButtonClicks();
}
[Inspectable(name = "01) Incorrect Message Text: ", type = "String", defaultValue = "")]
/*Creates a parameter field in which to type the incorrect answer message.*/
public function set incorrectTextBox ($value:String):void
/*Puts the incorrect answer message in the incorrect text box.*/
{
_incorrectText = $value;
}
[Inspectable(name = "02) Correct Message Text: ", type = "String", defaultValue = "")]
/*Creates a parameter field in which to type the correct answer message.*/
public function set correctTextBox ($value:String):void
/*Puts the correct answer message in the correct text box.*/
{
_correctText = $value;
// correctTxtBox.text = _correctText
}
}
}