Note that there are some explanatory texts on larger screens.

plurals
  1. POResolving a 1069 error between a child object and a parent function
    primarykey
    data
    text
    <p>I've shortened the code samples below so that it's more readable. Here's the rub:I create a whole bunch of MovieClips containing the letters a-z. These MovieClips are children of a parent MovieClip called "levelTwo", where levelTwo is a kind of a logic manager for the level.</p> <p>When they're clicked, they send off some data to levelTwo for evaluation (It's Hangman). Problem is that on click I get a 1069 error. It WAS a 1061 error until I added the event.target.parent bit in LetterButton.</p> <p>Here's the relevant code:</p> <pre><code>package { import flash.display.MovieClip; import flash.events.MouseEvent; import flash.events.Event; public class LetterButton extends MovieClip { var buttonText:String; public function LetterButton(lText:String,objX:int,objY:int) { trace ("Creating new button"); x = objX; y = objY; buttonText = lText; letterText.text = buttonText; this.stop(); addEventListener(MouseEvent.MOUSE_OVER,onMouseOver); addEventListener(MouseEvent.MOUSE_OUT,onMouseOut); this.addEventListener(MouseEvent.CLICK,onMouseClick); } private function onMouseOver(event:Event):void { gotoAndStop(2); letterText.text = buttonText; //trace ("You're over me and my text is " + buttonText); } private function onMouseOut(event:Event):void { gotoAndStop(1); letterText.text = buttonText; //trace ("You're out of me and my text is " + buttonText); } private function onMouseClick(event:Event):void { trace ("I am clicked and I am " + buttonText); event.target.parent.checkGuess(buttonText); } } </code></pre> <p>} And the relevant bit from levelTwo:</p> <pre><code>public function checkGuess(guess:String):void { //Check to see if the guess matches the string trace ("Guess: "+guess); for(var i:int=0;i&lt;answer.length;i++) { if(guess == answer.charAt(i)) { censoredAnswer[i] = guess; trace ("Got one right"); answerField.text = answerRedisplay(); //Do it now or it won't update for the check } } if (answerField.text == answer) { setWin(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload