Skip navigation
Dinkyfish
Currently Being Moderated

AnimatorFactory error

Aug 4, 2012 8:38 AM

Tags: #not #animation #found #property #animatorfactory

Hi guys, I'm trying to get my head around the AnimatorFactory class for the first time and keep hitting errors.

 

Essentially what I'm trying to do is create a game involving bugs moving around the screen. Simply straight line tweens weren't the kind of movement we wanted, so I hunted around and found the function that allows you to convert a pre-designed motion tween into AS3 code for you to use.

 

I've created an AnimationManager class to store the details of all the possible Motions, and each new instance of a bug is randomly assigned one of these motion paths when their 'go()' function is called. Here is the function:

 

public function go():void

        {

            _myMotion = _myAnimationManager.getAnAnimation();

 

            _myAnimFactory = new AnimatorFactory(_myMotion);

            _myAnim = _myAnimFactory.addTarget(_myBug, 1);

            _myAnim.addEventListener(MotionEvent.MOTION_END, motionFinishHandler);

        }

 

_myMotion is an instance of the Motion class, _myAnimFactory is an instance of the AnimationFactory class, _myAnim is an instance of the AnimationBase class. _myBug is a simple MovieClip that is a child of the class conatining the go() function. All variables are protected class variables.

 

The code compiles fine but when it runs I keep getting this error:

 

ReferenceError: Error #1069: Property instance454 not found on code.game.mobs.SmallFly and there is no default value.

    at fl.motion::AnimatorBase$/processCurrentFrame()

    at fl.motion::AnimatorFactoryBase/addTargetInfo()

    at fl.motion::AnimatorFactoryBase/addTarget

 

The "instance454" thing seems to refer to the _myBug variable. I don't understand why this should be not found? The SmallFly class is simply a subclass of my generic "Bug" class which contains this go() function.

 
Replies
  • kglad
    72,322 posts
    Jul 21, 2002
    Currently Being Moderated
    Aug 4, 2012 9:42 AM   in reply to Dinkyfish

    use trace(_myBug,_myBug.stage) to see what the problem is.

     
    |
    Mark as:
  • kglad
    72,322 posts
    Jul 21, 2002
    Currently Being Moderated
    Aug 4, 2012 12:43 PM   in reply to Dinkyfish

    what's trace(_myBug.name)? 

     

    and click file/publish settings/swf and tick permit debugging.  when you retest note the line number triggering the error message.

     
    |
    Mark as:
  • kglad
    72,322 posts
    Jul 21, 2002
    Currently Being Moderated
    Aug 4, 2012 1:15 PM   in reply to Dinkyfish

    something's out of scope. 

     

    comment out your listener to see if that's part of the problem.

     
    |
    Mark as:
  • kglad
    72,322 posts
    Jul 21, 2002
    Currently Being Moderated
    Aug 4, 2012 7:28 PM   in reply to Dinkyfish

    dynamically created objects CAN be used with the AnimatorFactory.  that's not the problem.

     

    there's something else about your setup that's causing the problem.  i'm not sure if the problem is because _myMotion or _myBug is out of scope.

     
    |
    Mark as:
  • kglad
    72,322 posts
    Jul 21, 2002
    Currently Being Moderated
    Aug 5, 2012 8:47 AM   in reply to Dinkyfish

    the toString() method is inherited from the object class so you should cast your instance:

     

    trace(Object(_myAnimFactory).toString())

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points