I have wrote a function like ,
private function addSelectedFunc():void
{
/**
* Adds newly selected privilegs to assignedPrivileges
*/
var obj_inst1:Array = obj_inst.selectedItems;
for each(var obj_inst1:Object in obj_inst1)
{
objInstance1Array.addItem(obj_inste);
}
}
<ov:HPList id="obj_inst" enabled="true" allowMultipleSelection="true" width="164" height="70" dataProvider="{obj_type.selectedItem}" />
<ov:HPList id="obj_inst1" enabled="true" allowMultipleSelection="true" width="164" height="70" />
getting error: 1151: A conflict exists with definition obj_inst1 in namespace internal.
This declares
obj_inst1as anArrayThis tries to redeclare
obj_inst1as anObject– naturally the compiler is confused. Use a different identifier for the iterating variable.ActionScript Compiler wouldn’t complain if you try to redeclare a local variable with the same type as it was declared in the first place (though I can’t think of a valid reason to do this).
Also, though it doesn’t contribute to this error, there is another
obj_inst1variable of typeHPListin your code; it is not a good practice to name everythingobj_instet al. Consider using names that are more meaningful in your application context.Which of the following sounds better?