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 =" ";
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
Okay I've made these changes but still have errors...this seems to still be the problem:
for (var i:int=0; i < wordLength; i ++)
Help please.
import flash.text.TextField;import flash.text.TextFormat;
var words:Array = Re: 1151: A conflict exists with definition i in namespace internal;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 Re: 1151: A conflict exists with definition i in namespace internal;wordLength = inProgress.length;
for (var i:int = 0; i < wordLength; i ++){ myDisplay Re: 1151: A conflict exists with definition i in namespace internal = "_"; 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);answerText.x = 375;answerText.y = 100;answerText.width = 250;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:int = 0 ; i < wordLength; i+) { if (inProgress.charAt
== guessLetter) { trace ("true"); myDisplay Re: 1151: A conflict exists with definition i in namespace internal = 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:int= 0; c < wordLength; c+) { displayOut += " " + myDisplay[c]; }
answerText.text = displayOut;answerText.setTextFormat(myFormat)letterIn_txt.text =" "; }
Date: Fri, 8 Jun 2012 09:04:14 -0600
From: forums@adobe.com
Subject: Re: 1151: A conflict exists with definition i in namespace internal 1151: A conflict exists with definition i in namespace internal
Re: 1151: A conflict exists with definition i in namespace internal
created by dmennenoh in ActionScript 3 - View the full discussion
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 initialze c and you have wordLengthl not wordLength
Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: Re: 1151: A conflict exists with definition i in namespace internal
To unsubscribe from this thread, please visit the message page at Re: 1151: A conflict exists with definition i in namespace internal. In the Actions box on the right, click the Stop Email Notifications link.
Start a new discussion in ActionScript 3 by email or at Adobe Forums
For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.
North America
Europe, Middle East and Africa
Asia Pacific