Skip navigation
ekh_fj
Currently Being Moderated

1151: A conflict exists with definition i in namespace internal

Jun 8, 2012 7:39 AM

Tags: #problem #cs5 #error #flash #script #game #actionscript3 #function #actionscript_3.0

I've double checked my codes but can't seem to find the solution to the problem. 1151: A conflict exists with definition i in namespace internal this keeps coming up and I don't know how to get around it.

It's meant for this bit of code:

for (var i: = 0; i < wordLength; i ++)

{

     myDisplay [i] = "_";

     displayOut += " " + myDisplay[i];

}

 

Help please.

 

Code for the script as a whole is below just in case.

 

 

 

 

import flash.text.TextField;

import flash.text.TextFormat;

 

 

 

 

var words:Array = ['BUTTERFLY', 'GOGGLES'];

var number: Number;

var inProgress:String = new String;

var wordLength:Number;

var myDisplay:Array = new Array;

var displayOut: String = new String;

var rightCount:Number = 0;

var used : String = new String;

var guess : String = new String;

var guessLetter: String = new String;

var correctGuess:Boolean = false;

 

 

 

 

number = (Math.floor(Math.random() * 6));

inProgress = words [number];

wordLength = inProgress.length;

 

 

for (var i: = 0; i < wordLength; i ++)

{

          myDisplay [i] = "_";

          displayOut += " " + myDisplay[i];

}

 

 

 

 

var answerText: TextField = new TextField ();

var myFormat : TextFormat = new TextFormat ();

          myFormat.font = "Janda Curlygirl Chunky";

          myFormat.color = 0X336600;

          myFormat.size = 22;

 

addChild(answerText);

this.answerText.x = 375;

this.answerText.y = 100;

this.answerText.width = 250;

this.answerText.text = displayOut;

 

 

answerText.setTextFormat(myFormat);

 

 

this.guess_btn.addEventListener(MouseEvent.CLICK, playMe);

 

 

 

 

function playMe (Event:MouseEvent) : void

          {

                    guessLetter = this.letterIn_txt.text.toUpperCase();

                    for (var i = 0 ; i < wordLength; i++)

                    {

                              if (inProgress.charAt == guessLetter)

                              {

                                        trace ("true");

                                        myDisplay [i] = guessLetter;

                                        correctGuess = true;

                                        rightCount++;

                              }

                    }

 

 

if (correctGuess == false)

          {

                    used += this.letterIn_txt.text;

                    this.usedLetter_txt.text = used;

                    this.hang_mc.gotoAndStop('paths');

          }

          else

                    correctGuess = false;

 

                    displayOut = "";

 

for (var c=; c < wordLengthl; c++)

          {

                    displayOut += " " + myDisplay[c];

          }

 

 

this.answerText.text = displayOut;

this.answerText.text. set TextFormat(myFormat)

this.letterIn_txt.text =" ";

 
Replies
  • Currently Being Moderated
    Jun 8, 2012 7:47 AM   in reply to ekh_fj

    change

     

    this.answerText.x = 375;

    this.answerText.y = 100;

    this.answerText.width = 250;

    this.answerText.text = displayOut;

     

    to

     

    answerText.x = 375;

    answerText.y = 100;

    answerText.width = 250;

    answerText.text = displayOut;

     

    also do you have a textfield on the stage with instance name answerText ?

     

    make sure debugging turned on copy the error here with the line number and indicate which line in your code corresponds to that line number

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 8, 2012 7:58 AM   in reply to ekh_fj

    then you shouldnt create one locally

     

    with

     

    var answerText: TextField = new TextField ();

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 8, 2012 8:04 AM   in reply to ekh_fj

    You have:

    for (var i: = 0; i < wordLength; i ++)

     

    With i: but no type after it. Use:

     

    for (var i:int = 0; i < wordLength; i ++)

     

    Later you also have:

     

    for (var c=; c < wordLengthl; c++)

     

    you're missing the value to initialize c and you have wordLengthl not wordLength

     


     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points