A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [RESOLVED] Error 1120 with letters but not numbers?

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    24

    resolved [RESOLVED] Error 1120 with letters but not numbers?

    Hi there, I'm using an array to create a level. When I use numbers in this array, such as in the code below:
    Actionscript Code:
    if(lvlArray[i] == 1){
                //mcCastleWall
                var newPlacement1:mcCastleWall = new mcCastleWall();
                CastleWallHolder.addChild(newPlacement1);
            }
    everything works fine. However, when I use letters, such as in the code below:
    Actionscript Code:
    } else if (lvlArray[i] == u){
                //mcCastleExit
                var newPlacementu:mcCastleExit = new mcCastleExit();
                CastleExitHolder.addChild(newPlacementu);
            }
    I get the error '1120: Access of undefined property k.'
    What's wrong with using letters? Or, if not letters, the code?
    If it helps, it says the error is in line 193, which refers to this section of code:
    Actionscript Code:
    } else if (lvlArray[i] == u){

  2. #2
    Junior Member
    Join Date
    Dec 2011
    Posts
    24
    Actually don't worry, I discovered I needed to add this at the beginning:
    Actionscript Code:
    var u:String = 'SCastleExit';
    And then change the code to:
    Actionscript Code:
    } else if (lvlArray[i] == 'SCastleExit'){
                //mcCastleExit
                var newPlacementu:mcCastleExit = new mcCastleExit();
                CastleExitHolder.addChild(newPlacementu);
            }
    Just thought I'd post that for others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center