Skip to main content
cegsea9669
Participant
July 11, 2013
Question

Error 1151

  • July 11, 2013
  • 3 replies
  • 2020 views

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

This topic has been closed for replies.

3 replies

cegsea9669
Participant
July 16, 2013

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

Inspiring
July 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.

Ned Murphy
Legend
July 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