Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Error 1151

New Here ,
Jul 10, 2013 Jul 10, 2013

I am using as3 on flash cs6 and I have been trying to create a scene where the button to move onto the next scene is only available when all other interactivies have been clicked at least once. This is my coding that I am using:

backyard_door.visible = false;

var btnB:Array = ["door_1","door_2","door_3","f_book","on_light"];


for (var i:uint=0; i<btnB.length; i++)
{

getChildByName(btnB).addEventListener(MouseEvent.CLICK,g);
}


function g(e:MouseEvent)
{

n = Math.max(n,n ^ (1 << (1 + btnA.indexOf(e.currentTarget.name))));

if (n==Math.pow(2,btnB.length+1)-2)
{

backyard_door.visible = true;

}

}

Error 1151 says that in this line :

for (var i:uint=0; i<btnB.length; i++)

that 'A conflict exsists with definition i in namespace internal'

can someone please suggest a way to solve this problem or link me to a source that may be able to help? Thankyou

Also I am an as3 newbie so please be gentle with me

TOPICS
ActionScript
2.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 11, 2013 Jul 11, 2013

If there is somewhere else in your code where you declare a variable named " i " that could be the reason for the error.  If you want to use it mutl;iple times for different loops at the same level within the code then declare it separately instead of within each loop.

var i:uint; // declare it separately

(for i=0; etc.... )  // do not declare it in the loop

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 13, 2013 Jul 13, 2013

Most probably you declare i of different datatypes. In the code you show it is uint in some other case you don't show - it may be int or Number.

On a side notes - int is faster than uint, so it is advisable to use int over uint.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 15, 2013 Jul 15, 2013
LATEST

I found it was because I used the same definition in a different scene, I just changed all the 'i' definitions to a 'j' and it worked perfectly. Thanks anyway

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines