A Flash Developer Resource Site

Results 1 to 20 of 20

Thread: Error 1010....what is undefined?

  1. #1
    Senior Member
    Join Date
    Jul 2000
    Posts
    373

    Error 1010....what is undefined?

    This is really strange. I've got a button symbol on stage with an instance name of aboutUs_btn. My code on my AS layer is:

    this.aboutUs_btn.addEventListener(MouseEvent.MOUSE _DOWN, about);
    function about(evt:MouseEvent):void {
    this.wipe_mc.gotoAndPlay(2);
    this.gotoAndStop("history");
    head.unload();
    }

    And then I test the movie and get this error and it makes no sense to me.

    TypeError: Error #1010: A term is undefined and has no properties.
    at main1_fla::MainTimeline/about()

    What's weird is I tried this in another .fla and it didn't bring up the error. That makes no sense. They've both got Publish Settings for AS3/FL9
    Adam Bell
    dzign@datatv.com
    --
    Over 90% of all websites
    suck......
    Join the minority.

  2. #2
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,361
    trace your values and see if any come up undefined (or use the debugger to check out their values during playback)

  3. #3
    Senior Member
    Join Date
    Jul 2000
    Posts
    373
    I don't know how to do that.
    Adam Bell
    dzign@datatv.com
    --
    Over 90% of all websites
    suck......
    Join the minority.

  4. #4
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    Most likely you do not have movie clip with instance name "wipe_mc" on stage when code is run.

  5. #5
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Forget what I originally wrote. It is too early in the morning

    But what you can do is put a trace of an object at a certain point in the script. If your error occurred after the trace then the trace will be executed otherwise not.
    Last edited by cancerinform; 05-24-2007 at 08:49 AM.
    - The right of the People to create Flash movies shall not be infringed. -

  6. #6
    Senior Member
    Join Date
    Jul 2000
    Posts
    373
    First to Tonypa, there is an instance of wipe_mc on the stage. Second to cancerinform, since I'm not very aware how to do trace statements, I'd just stick it somewhere in my about_btn function and if it's in the right place in that function, it'll work?
    Adam Bell
    dzign@datatv.com
    --
    Over 90% of all websites
    suck......
    Join the minority.

  7. #7
    Member
    Join Date
    Oct 2000
    Posts
    93
    Quote Originally Posted by databell
    Second to cancerinform, since I'm not very aware how to do trace statements, I'd just stick it somewhere in my about_btn function and if it's in the right place in that function, it'll work?
    Its very basic, just stick it anywhere
    Code:
    trace ( this );
    trace ( this.aboutUs_btn );
    trace ( this.wipe_mc );
    trace ( about );
    trace ( anything else );

  8. #8
    Senior Member
    Join Date
    Jul 2000
    Posts
    373
    Well, here's what I did. I got rid of all 'this' references and then deleted all wipe_mc lines just to see what would happen. It worked. Clicking on aboutUs_btn did exactly what it was supposed to do. So I figure let's bring wipe_mc back. I started by just doing a reference to the wipe_mc instance. No this. And this is what I got as a compiler error:

    1120: Access of undefined property wipe_mc.
    Adam Bell
    dzign@datatv.com
    --
    Over 90% of all websites
    suck......
    Join the minority.

  9. #9
    Senior Member
    Join Date
    Jul 2000
    Posts
    373
    OK. Kind of expected that. Remember, wipe_mc is on the stage! So let's add the 'this.' back to this.wipe_mc:

    undefined

    That was from the trace (this.wipe_mc); statement.

    TypeError: Error #1010: A term is undefined and has no properties.
    at main2_fla::MainTimeline/about()

    So we're back to that again. Is it possible because there's no linkage property that this is occuring? Again, this didn't happen in a different Flash 9 .fla.
    Adam Bell
    dzign@datatv.com
    --
    Over 90% of all websites
    suck......
    Join the minority.

  10. #10
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Are you sure you gave it the name wipe_mc in the property inspector?
    Are you calling the movieclip from an external class script or from the main timeline?
    Last edited by cancerinform; 05-25-2007 at 10:01 AM.
    - The right of the People to create Flash movies shall not be infringed. -

  11. #11
    Senior Member
    Join Date
    Jul 2000
    Posts
    373
    That's weird. I had the instance name in there. Then it disappeared. That makes no sense. I retyped in it and the problem is finally gone! Sorry about all that. Everything seems to work now.
    Adam Bell
    dzign@datatv.com
    --
    Over 90% of all websites
    suck......
    Join the minority.

  12. #12
    Junior Member
    Join Date
    Aug 2007
    Posts
    23
    For what it's worth, I have an action game that uses for loops to iterate through arrays to check for collisions of bullets VS enemies, the old-school way. And with 30-90 collisions attempted per frame, I get this 1010 warning maybe 4 or 5 times over the course of 2 minutes of juicy combat.

    The weird thing is how inconsistantly it pops up. I have dozens of collisions being checked every frame, but it never occurs more than once per frame, and seldom occurs at all. I have not been able to discern any pattern to its appearence whatsoever, I.E. it doesn't seem to be particularly triggered by too many collisions or collisions that result in the death of an enemy, vollies of shots that miss all enemies, bullets or enemies leaving the screen en masse, or any other litmus test I can think of.

    I'm thinking it ~may~ occur when a bullet leaves the screen and is therefore removed from the screen and the array, since this check happens in a different place in code than the collision test. I.E. the two blocks of code check the same array, but when for loop one modifies the array, it doesn't tell the other for loop about it. Even if this is the case, I should point out that it doesn't seem to happen every time old bullets are removed from the screen.

    Since the error is so rare, (less than 1 in 5000 collisions attempted) it's really hard to even think of a theory that explains it.

    Most of the webpages that talk about 1010 seem to involve users going "WTF, I understand your explaination, but it doesn't explain the behavior I'm seeing."

    I'm thinking there may factors at work here the developer's not exposed to.

    Fortunately, it doesn't seem to impact performance at all. I'm tempted to just leave it.

    Is there any good reason not to just ignore 1010 warnings, in cases like mine where the cause cannot be determined because the error is not reliably reproducible?
    Last edited by WarpZone; 10-10-2007 at 02:54 PM.

  13. #13
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    sometimes really fluke things like that happen, and if it doesn't affect the actual execution of the app, its easier to just wrap it in an empty try/catch statement to suppress the error.

    For example:
    Code:
    try
    {
        trace(someUndefinedVariable);
    }catch($e:Error){}
    It will trace as undefined, but it won't actually throw an error.

  14. #14
    Member
    Join Date
    Sep 2007
    Location
    Richmond, VA
    Posts
    45
    This may or may not help you, but I just dealt with that rather cryptic error.

    It turns out that I had a bunch of text fields, mytxt0, mytxt1, mytxt2... etc.
    And I was using a for... loop to update them.

    well my for loop was: (var a=0; a<=12; a++)

    Well there were 12 text objects, but because I was starting my counting at 0 I should have only counted up to 11. so either (var a=0; a<12; a++) or (var a=0; a<=11; a++) would fix the error.

    I've done the same thing with Arrays. It tries to find that last item and can't because my count went one too high.

  15. #15
    a.k.a gltovar deadlock32's Avatar
    Join Date
    May 2001
    Location
    Naperville,IL
    Posts
    489
    Quote Originally Posted by KindaGamey
    This may or may not help you, but I just dealt with that rather cryptic error.

    It turns out that I had a bunch of text fields, mytxt0, mytxt1, mytxt2... etc.
    And I was using a for... loop to update them.

    well my for loop was: (var a=0; a<=12; a++)

    Well there were 12 text objects, but because I was starting my counting at 0 I should have only counted up to 11. so either (var a=0; a<12; a++) or (var a=0; a<=11; a++) would fix the error.

    I've done the same thing with Arrays. It tries to find that last item and can't because my count went one too high.
    Well you loop:
    (var a=0; a<=12; a++)

    defines 13 iterations of a:

    0 to 12 = 13

    1 to 12 = 12

    0 to 11 = 12

    So that may explain the issue you were having

  16. #16
    Member
    Join Date
    Sep 2007
    Location
    Richmond, VA
    Posts
    45
    yeah, i know that... I was just pointing out that a mistake like that will bring up the same error. So, if the guy is doing hit tests for thousands of missiles or bullets, pinging one that no longer exists would bring up that same error --


    (thecakeisalie.)

  17. #17
    Junior Member
    Join Date
    Apr 2008
    Posts
    11

    possible solution

    I just ran into this problem. If you have different keyframes with a movie clip on each, they can all have a different property name on each keyframe. So if you rename something on one keyframe and not on another, it may trace undefined or null. Same goes for swapping out symbols.

  18. #18
    Junior Member
    Join Date
    Jul 2008
    Posts
    1

    10 10 let's not do it again

    I had a problem with my dynamic text field leading to the 1010 error.


    I found:
    http://www.kirupa.com/forum/showthread.php?t=270559

    and it helped me to change
    this.getChildByName("menuButton0") .label_txt.text = "11";

    into

    (this.getChildByName("menuButton0") as menubutton).label_txt.text = "11";

  19. #19
    Junior Member
    Join Date
    May 2010
    Posts
    8
    Im coming up with this error:

    TypeError: Error #1010: A term is undefined and has no properties.
    at Videodoc_fla::MainTimeline/frame1()

    And my code is:

    rewindBtn.onRelease.addEventListener(MouseEvent.CL ICK); void
    function (){
    movieMc.seek(0);
    }


    Not sure how to fix the problem...help!

  20. #20
    Junior Member
    Join Date
    Jul 2010
    Posts
    1
    Hello I got the same error and i solved it like this.

    Firstly how my problem appeared:
    I got 4 answer button and they have same FUNCTION for MOUSE_CLICK event.
    And In that function i wanted to get which button is clicked and i read the answer from a text field which both of them belongs that button.
    And I used this way (the way that gives me that error).
    function cevap_check(e:MouseEvent):void <<< the function
    i catch the answer so
    var selected_answer:String=e.target.txtasnwer.text;
    but not when i click other area of that button.

    Solution way:
    yes this worked but only if the target is ONE OBJECT(this object is the one when i imported a button image and i rightclick and choose CONVERT TO SYMBOL) not other object in that button. so i got tht with trace tricks e.target
    doesnt give me the right object where i want to reach. so i found out this e.currentTarget.name so i got the name which button i clicked. i create a new MOVIECLIP var AdoptClip:MovieClip = MovieClip(this.getChildByName(e.currentTarget.name )); so i got the button and then just var select_answer:String=AdoptClip.txtAnswer.text; and so i got the answer correctly. Not the object which is clicked(i mean before the area not working on the button)

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