A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Basic AS3 question

  1. #1
    Member Mofo SwirlyKing's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    476

    Basic AS3 question

    Can anyone tell me why this isn't working?

    I get this error when I use the button:

    TypeError: Error #1010: A term is undefined and has no properties.
    at MD_13_fla::MainTimeline/moveProjects()
    at MethodInfo-197()
    PHP Code:
    function moveProjects() {
        if(
    this.project.== 598){
            
    this.project.2000;
        }else{
            
    this.project.== 598;
        }
    }
    projectsBtn.addEventListener(
      
    MouseEvent.CLICK,
      function(
    e:MouseEvent):void {
        
    moveProjects();
      }
    ); 

  2. #2
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    in named functions, "this" refers to the timeline. so "this.project" needs to be a variable declared on the timeline; that error is saying that's not the case.

  3. #3
    Member Mofo SwirlyKing's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    476
    Moagrius - thank you for the help.
    I'm not sure I understand. I took "this." off and then got this error:
    1120: Access of undefined property project.

    "project" is a movie clip sitting on the stage.

  4. #4
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    put "this" back. it should work fine, except for this line
    PHP Code:
    function moveProjects() { 
        if(
    this.project.== 598){ 
            
    this.project.2000
        }else{ 
           
    //  should be = not ==
            
    this.project.== 598
        } 


  5. #5
    Member Mofo SwirlyKing's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    476
    Moagrius - thank you again, I figured it out. I had to take off "this." and I stupidly called my mc "project" instead of it's real name "projects". Oops.

  6. #6
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    In AS3 you don't need to use "this", because objects are automatically referenced to the timeline or class.
    - The right of the People to create Flash movies shall not be infringed. -

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