A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: hitTestObject problem.

Hybrid View

  1. #1
    Your Mom
    Join Date
    Jan 2005
    Posts
    84

    Question hitTestObject problem.

    I am converting a as2 file to as3. I am trying to convert this. I tried this:

    for (var a:uint=1; a<=10; a++) {
    if (player.hitTestObject(root.["wall"+a]) == true) {
    player.x += 0;
    }
    }

    but i get this error.
    TypeError: Error #2007: Parameter hitTestObject must be non-null.
    at flash.display:isplayObject/flash.displayisplayObject::_hitTest()
    at flash.display:isplayObject/hitTestObject()
    at MyFile_fla::MainTimeline/onEnterFrame()
    hi

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Although why you'd want to += 0 is beyond me...

    PHP Code:
    for(var a:uint 110a++){
        if(
    player.hitTestObject(root['wall' a])) player.+= 0;


  3. #3
    Your Mom
    Join Date
    Jan 2005
    Posts
    84
    I used +=0 to stop movement... I should use = 0....
    but i changed to code and i still get that error
    hi

  4. #4
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    doh...my bad - I copied that wrong - you need the version with getChild in it :P

    PHP Code:
    for(var a:uint 110a++){ 
        if (
    player.hitTestObject(getChildByName('wall'+a))) player.0;


    assuming you are executing on the root level...otherwise root.getChildByName...

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