Error #1056: Cannot create property x on String.
Hi everyone. I am new to As3 and I'm getting this error but not sure how to change it from a string. I can 'trace("myfilling: " + myfilling);' and this outputs the instance I want to change the X and Y position of fine but when I try to do myfilling.x = leftBaseX, it throws up the error:
ReferenceError: Error #1056: Cannot create property x on String.
Could someone help please!?
function generateRandomSandwhich() {
while (numFillings < maxFillings) {
var randNum:uint = randomNumber(0, (fillings.length - 1));
if(sandwhichFillings.indexOf(fillings[randNum]) == -1) {
sandwhichFillings.push(fillings[randNum]);
numFillings++;
}
}
for (i = 0; i < sandwhichFillings.length; i++) {
sandwhichToMake.appendText(sandwhichFillings[i]);
if((i+1) < sandwhichFillings.length) {
sandwhichToMake.appendText(", ");
}
//trace(sandwhichFillings[i])
var myfilling = sandwhichFillings[i];
//trace("myfilling: " + myfilling);
myfilling.x = leftBaseX;
myfilling.y = leftBaseY - fillingSpacing;
addChild(myfilling);
}
}