A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: error 1034

  1. #1
    Member
    Join Date
    Jan 2009
    Location
    London
    Posts
    62

    error 1034

    i created some textfield variables and set their .text value to be equal to a number.

    when i try and load up the textfields in a movieclip i get this error:
    TypeError: Error #1034: Type Coercion failed: cannot convert "100" to flash.display.DisplayObject.

    but the weird thing is i copied code that worked perfectly in the same flash file and just changed the name of the movieclip. could anyone help?

    here's some of my code for one of the textfields:

    var playerHealth:String="100";
    var playerHealthInput:TextField = new TextField();

    (here i write about the textfield attributes)

    playerHealthInput.text=playerHealth;

    advOptionsWindow_mc.advOptionsSettings_mc.difficul tyIndivSettings_mc.addChild(playerHealth);

  2. #2
    rabid_Delineator AttackRabbit's Avatar
    Join Date
    Dec 2003
    Location
    Orlando, Florida
    Posts
    481
    Code:
    advOptionsWindow_mc.advOptionsSettings_mc.difficul tyIndivSettings_mc.addChild(playerHealth);
    you are trying to add a string , playerHealth , as a display object. I think you want to do this :
    Code:
    advOptionsWindow_mc.advOptionsSettings_mc.difficul tyIndivSettings_mc.addChild(playerHealthInput);

  3. #3
    Member
    Join Date
    Jan 2009
    Location
    London
    Posts
    62
    thank you!

    i was being stupid and mixing up names...

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