Battle loop error. error #1009, null

battle loop error. error #1009, null

TypeError: Error # Cannot access a property or method of a null In a loop I was disposing all the items before getting them back from the pool and. My connection problems crop up when I try to start a battle. :P TypeError: Error # Cannot access a property or method of a null object reference. TypeError: Error # cannot access a property or method of a null object reference. The loop runs once as the test Array [0] and table [1]. battle loop error. error #1009, null

Battle loop error. error #1009, null - congratulate, this

Hit Test help

  • Can I disable hit testing in Flash button?

    I recently created a Flash game which is the extreme slowing down on the greatest levels. Use Adobe Scout with a version of the game that has Advanced telemetry activated, I learned that, on these levels, what we call 'hit test button' is engulf a huge piece of my game processor cycles - we're talking about 25 to 33 percent or more.

    A few searches on Google directed me to this thread over 2 years, in which Mark Shepard noted that the hit test button is a process legacy meant to support the old class SimpleButton. He said that this led to the slowdown in scenes with many objects from the display list, and there is no way to avoid it otherwise than to reduce the number of objects in the display list.

    Other users Chorus to say that the hit test button moved not when they switched to using touch rather than the events of mouse events. However, my game is for PC, and as such, I can't use the touch events rather than mouse events.

    So my question is, basically: in 2 years because this problem has been reported, did you do something to allow programmers to turn off Flash button hit-testing? (Like, say, allowing us to set a flag to supportSimpleButtons to false to disable the button hit testing process?)

    It answers the question, but it was not sufficiently clear.

    Yes, disable mouse interactivity will stop the hit test.  to stop the interactivitee use:

    sprers.eunabled = false;

    If this object is also a container of displayobject, also use

    sprers.euhildren = false;

  • Simple Hit test

    Hey, I have a clip with a provision of

    1 PEnemy

    2. the enemy

    3 enemy

    then the animations and on some mounts a MC with an instance name of "hit".

    My video clip anime and I would like to detect testing with another child of another movie clip, called 'you' with a child MC called "target".

    So I want bacicly to of hitTest

    I don't understand not hit test well in as3, it's what I have:

    If (you. sprers.eutObject (;

    But it does not work

    Also, I get this output:

    TypeError: Error # hitTestObject parameter must be null.

    at sprers.euy::DisplayObject/_hitTest()

    at sprers.euy::DisplayObject/hitTestObject()

    at eugenehoudin5AS3_fla::MainTimeline/EnterFrame()

    Code cannot target an object that does not exist, it must put in a logical conditional to check if the object is null or not.  One thing you could do to make sure that the object still exists for the code also is it present in all frames, but make it invisible in frames where you do not want to be seen.  In your code, you could test its visible property before you try to do the placement test - if it is invisible, pass the hit test.

  • Hit test timer

    I am a construction game.

    There is a timer that counts down from 60

    the main character is a diver who must swim to the other side of the cave, but the diver must collect "oxegen icons" in order not to run out of air.

    I am able to make the icon disappear when the diver swims above with a Hittest. How to add more time on the "timer" on the same hit test? Thank you

    onClipEvent (enterFrame) {}
    {if (This, HitTest (_root. Man))}
    _sprers.eudPlay (10)


    onClipEvent (enterFrame) {}
    {if (This, HitTest (_root. Man))}
    _sprers.eudPlay (10)

    _root. Timer +=?;  where? is any time you want to add

  • Helps the animation/Hit Test in AS3

    I am developing a game in a school using Flash CS4 and Actionscript project.  I have searched the web for help, but are empty.  Here's what I want to do

    I have a grid of 3 by 3 on the screen.  Each block in the grid contains a clip with four objectives that scroll at 24 fps.  Each target with have a different result depending on which frame the mouse is clicked.  I do not what the animation to stop after that the frame is clicked, however.  There are several different types of targets in the game.  Some add points, some subtract points, a target has the avility to freeze activities for a defined period and another is basically an instant on play.  Is that the way that I have found no help via the web before this post, I'm not even positive that it is possible to code in AS  Does anyone know if this is possible, and if so, how I would go about coding it?  Any help would be great!

    If you have set your targets already on stage, make sure that you named all, jump the 2 lines and

    var: target = new Target(); = "target1";

    getChildByName("target1").addEventListener (, clickHandler);

    getChildByName("target2").addEventListener (, clickHandler);

    function clickHandler(e:MouseEvent):void {}

    trace (;

    results eventually in "target1".

    trace (MovieClip (sprers.eutTarget) .currentFrame);

    results in some framenumber animation of the selected MovieClip is during the click


    Based on this here that you can easily write any other code that processes the results

  • TypeError: Error # with hit test, please help

    -The actions and events-

    sprers.euntListener (sprers.eu_MOVE, charMove);

    function charMove(evt:MouseEvent)


    addEventListener (sprers.eu_FRAME, checkcharCollision);


    function checkcharCollision(event:Event)


    for (var i: uint = 0; i <; i ++)


    if (char [i] .hitTestObject (cur))

    { (i, 1);

    lalLChannel = (); = 1;

    sprers.euransform = lalL_transform;

    sprers.eudStop ("ful");

    sprers.euntListener (sprers.eu_COMPLETE, lalLComplete);




    and it gives me this error as soon as I move the mouse:

    TypeError: Error # cannot access a property or method of a null object reference.

    to INDEX_fla::MainTimeline/checkcharCollision()

    NY ideas?

    THX pavel

    for (var i: uint = 0; i

  • Hit testing objects in the table problem

    Hey guys, thank you very much in advance for any comments.  These forums are a great help.

    I have a serious problem with a loop in a table. I'm trying to hitTestObject each MC in a table against all other MC in this table.   That part works.

    The problem is that in my statement of hitTestObject, so obviously examines only 2 items at a time.  When touch 2 MC, I put a property called 'Touch' to true.  The problem is they are moving MCs and at one point touching only 2 / 3.  What is happening is:

    The loop runs once as the test Array [0] and table [1].  Say that those who are affected.  She sets their properties 'Touch' true (it's what I want).  THEN it works again test Array [1] and table [2] and finds that they are NOT overlapping.  It this process it defines two of their properties 'Touch' to false, EVEN IF one of them may overlap a different array object.

    I want to individual, set the property to "Touch" for each object in the table.  Currently, these properties are getting crushed even if 2 / 3 objects are superimposed in fact.

    That makes sense?  Essentially the "else" statement is too often called because certain combinations of array objects are not touch, but others are.


    sprers.euntListener (sprers.eu_FRAME, hitTestBalls);

    function hitTestBalls(e:Event) {}

    for (var m1:int = 0; m1 <; m1 ++) {}

    for (var m2:int = m1 + 1; m2 <; m2 ++) {}

    {if (MonsterArray [M1] .hitTestObject (MonsterArray [m2]))}

    MonsterArray [m2]. Touch = true;

    MonsterArray [m1]. Touch = true;

    trace (MonsterArray [m1]. The touching, MonsterArray [m2]. Touch);

    trace (M1, m2);


    } else {}

    trace (M1, m2);

    trace ("NotTouching");

    MonsterArray [m1]. Touch = false; MonsterArray [m2]. Touch = false;




    While waiting for a response, here's something to consider.  You don't want to affect the Touching false at any time after that you start the analysis, only front

    function hitTestBalls(e:Event) {}

    first put all wrong

    for (var m0:int = 0; m0<;="">

    MonsterArray [m0]. Touch = false;


    now test for overlapping - this way you don't overwrite anything with fake

    for (var m1:int = 0; m1<;="">

    for (var m2:int = m1 + 1; m2)<;="" m2++)="">

    {if (MonsterArray [M1] .hitTestObject (MonsterArray [m2]))}

    MonsterArray [m2]. Touch = true;

    MonsterArray [m1]. Touch = true;





    And if there be oinky be a pair that overlap as you say, you can add a breakdown; orders to end a loop when a hit is detected.

  • APP created with air for Android but does not work on the emulator to test - help!

    When I createan applicationusingFlashCS> > > AIRFORANDROID.
    After creatinga test pageI'm going topublishparameters andSendleApp onEmulatorRELEASE ofLeAPPisload correctlybut as soon asyou startthe emulator, give thiserror "applicationXXnameappXX(process air .)" XXnameappXX) hasstoppedunexpectedly. Pleasetry again"Please Help!

    "Okay I find this before ' and install it on the android emulator! Now work all that I hope so! Thanks for your response!

  • Hit Test Dosent work

    im making a type of game where you send your troops in battle when you click on the button buy

    This is my script that will put the troops so stop thay and attack the target.

    onClipEvent (enterFrame) {}

    If (sprers.eut (enemyHouse)) {}

    _x += ;

    _sprers.eu_sprers.eu_sprers.eudPlay (9);

    } else {}

    _x += ;



    so your troop in this case, which is a giant (giant_mc) walks when it reproduces until it hits the enemyHouse then it stops and goes to frame 9 his offensive frames, but that doesent happen he walks right past the enemyHouse and it dosent stop and animate.

    Your design is a failure because of the way in which you are coding.  Just do things because they work is not helping you solve the problems of things that do not work.

    I would recommend that you stop placing code 'on' objects and start using the calendar for all of your code.  Place the code on the objects is a bad habit.

    Here you can use the code that replaces everything you have shown so far and it is placed on the timeline.  I removed the useless lazy code (like Treasury = 0);.  For this code, you must assign an instance name of your button (I use 'btn' in what I watch)

    Giants of var = 0;

    function addGiant() {}
    If (cash > = ) {}

    var giant = attachMovie ("giant_mc", "giant_mc" + giant, _sprers.eutHighestDepth (), {_x, _y});})
    sprers.eurFrame = moveGiant;
    Giants += 1;

    cash-= ;



    sprers.euase = addGiant;

    function moveGiant() {}
    If (sprers.eut (enemyHouse)) {}
    delete sprers.eurFrame;
    sprers.eu_sprers.eudPlay (9);
    } else {}
    This ._x += ;

  • whenever I hit the help in the taskbar it help & support not able to boot

    original title: help & support does not

    whenever I got help on the bar he spots help & support not able to start do - what I do

    Hi Frank,.
    Try this:

    Go to start/run and
    type: helpctr - regserver

    To reinstall the help and Support: go to C:\Windows\inf\ Right
    Click on, then choose install. Have your CD at hand.

    Note: The folder is hidden by default. Go to start/run and type in: control
    records. View: Display the hidden files and folders and uncheck Hide extensions for
    known file types.
    hope this helps,
    Eddie B.

  • How to make an ahpe base hit test.

    I have a form that is currently added to the step. The user must interact with objects in the level. If they hit a set of objects above. Currently the car is moving only in a straight line. But I want that he follow the shape of the track to make it better. Any ideas as to how I could do this?

    This is my current code:


    var: = new track;
    var: car = new car;
    flag: flag of var = new Flag;
    var end: = end of new part EndGame;

    sprers.euld (car);

    car.x = ;
    car.y = ;

    sprers.euld (track);

    Track.x = ;
    Track.y = ;

    sprers.euld (flag);
    Flag.x = ;
    Flag.y = ;

    sprers.euntListener (sprers.eu_FRAME, moveCar);

    function moveCar(e:Event):void
    car.x += 5;
    sprers.euntListener (sprers.eu_FRAME, CheckForCollisions);

    function CheckForCollisions(e:Event):void
    If (sprers.eutObject (flag))
    removeEventListener (sprers.eu_FRAME, moveCar);
    trace (":)");
    because. Visible = false;
    sprers.eue = false;
    sprers.eue = false;
    removeChild (track);
    addChild (end);
    end.x = ;
    end.y = ;

    Answered my self

  • hit test

    I have a problem with the admission tests, if you make an object which is any shape other then a square he createds an invisable square around him and uses the ACE edge for admission tests. I have a ship that you move rounded astriods and I need to be exactly where you see the edge and no where is the edge of the box.
    It's the code using im.
    Thank you.

    Yes, this is called the "BoundingBox" represents the min and max space occupied by the instance. In Flash, using a "shapeFlag" founded, there is another hitTest method, but it will compare only a single point. What you're looking for is to compare the two forms and it is not taken in charge, but there are solutions, is somewhat complex but. See Grant Skinners CollisionDetection class that does exactly this:


  • irrational behavior in the hit test

    OK, so I made three modules that were supposed to "align on" place when some of them crept over a particular coordinate (in this case, I created a grid using squares mc). When you release the mouse, the rest object and stopdrag lights for this object. When the object is clicked once again, it can be moved from it of locked position and moved elsewhere.

    The problem is when each of the three objects are locked in place, even if they all have their own interaction with unique film clip coordinates, the other two cannot be moved. It doesn't matter which of the three is locked in place, the other two do not move either. I found this very confused, so I mounted three layers on each module to indicate if it was to drag a status of drag stop or "locked".

    When using the following code, the elements begin to blink. By clicking on any of them changes the model of flashing and sometimes its quick, sometimes its slow and sometimes stops. We thought there was a reason (fast, slow, fast slow, stop) but discovered it wasn't really, and it's probably due with synchronization.

    My big question is WHY the two other movie clips/modules are locking up when the third module snaps into place?

    paleos var = - 1;
    Andromeda var = - 1;
    synergy var = - 1;

    onEnterFrame = function() {}

    redpod_sprers.eudStop ("frame2");
    } else {redpod_sprers.eudStop ("frame1");

    violetpod_sprers.eudStop ("frame2");
    } else {violetpod_sprers.eudStop ("frame1");

    bluepod_sprers.eudStop ("frame2");
    } else {bluepod_sprers.eudStop ("frame1");

    If (redpod_sprers.eut (grid01_mc._x, grid01_mc._y, true) & & paleos == 1) {}
    redpod_mc._x = grid01_mc._x;
    redpod_mc._y = grid01_mc._y;
    redpod_sprers.euag ();
    redpod_sprers.eudStop ("frame3");
    synergy synergy = *-1;
    Andromeda = Andromeda *-1;

    If (bluepod_sprers.eut (grid02_mc._x, grid02_mc._y, true) & & Andromeda == 1) {}
    bluepod_mc._x = grid02_mc._x;
    bluepod_mc._y = grid02_mc._y;
    bluepod_sprers.euag ();
    bluepod_sprers.eudStop ("frame3");
    Paleos = paleos *-1;
    synergy synergy = *-1;

    If (violetpod_sprers.eut (grid03_mc._x, grid03_mc._y, true) & & synergy == 1) {}
    violetpod_mc._x = grid03_mc._x;
    violetpod_mc._y = grid03_mc._y;
    violetpod_sprers.euag ();
    violetpod_sprers.eudStop ("frame3");
    Paleos = paleos *-1;
    Andromeda = Andromeda *-1;

    } = function() {}
    redpod_sprers.eurag ();
    Paleos = paleos *-1;
    redpod_sprers.euase = function() {}
    redpod_sprers.euag ();
    } = function() {}
    violetpod_sprers.eurag ();
    synergy synergy = *-1;
    violetpod_sprers.euase = function() {}
    violetpod_sprers.euag ();
    } = function() {}
    bluepod_sprers.eurag ();
    Andromeda = Andromeda *-1;
    bluepod_sprers.euase = function() {}
    bluepod_sprers.euag ();

    It's messy, but I found a solution using a modified mouse listener created by Noct in

  • Action Script 3 registry test of positioning as an object is slipped on another object

    Hi all, I have a problem working this. My question is about Action Script3

    I want to be able to drag a clip on top of the other. While the clips are touch, I want to sign up for a hit test.

    I used touch_begin and touch_end of pick up and drop my movieclip.

    Can someone tell me the service I need to record a success as my object past on an another movieclip?


    You can use hitTestObject in a loop (for example, enterframe) while dragging if you do not need a shape-based placement test.  end the loop when dragging stops.

  • Having some problems! Help, please!

    Hi, I was watching a tutorial until I got stuck in the middle of it and was hopeing if someone could help me. I know that the tutorial is weird but I'm just to learn from him.

    Here is the link to the tutorial: - jammed at

    So I don't know how he did image the same size whenever he placed the png in the area of the model because every time I put the 2nd photo is a different size and the possistioned in a different domain. If someone could help me please I would very much apreciate it. Also please tell me how you hate ponies and others that I'm just trying to learn. If you don't get what I mean please tell me and I'll try to re phrase it.

    Thanks in advance!

    You must go down the basics of EI. "Base" type in the search field in the help inside same EI and you will get these tutorials. Go through 3 or 4 without trying to follow just to get down the basic workflow and techniques.

    Then type 'character animation' or 'puppet ' corner in the same field of research and take a look at these or these resources. One of the best hits will help you get started.

    There are a ton of help out there, but you must have some knowledge base before any tutorial will help you make more that follow a recipe.

  • Making a button work in Flash CS3, CS4 or CS5 with ActionScript &#; it&#;s not too bad

    You People are using AS3 in a really primitive way specially for the use of multiple buttons writting function after function after function and the same with event handlers that’s to much work guys why not use the power of Arrays and Loops to assign one function to all your buttons?

    let me explain

    first off create all your buttons and there functionality I prefer to use MovieClips to make my buttons for the flexibility.

    Give them simple names for example you can name them the same as the sections of let’s say a website like (home, aboutUs, contactUs) you will be surprised how much easier this makes things later when you can use the names of your buttons to do a lot of other things using AS3&#;s classes

    Now create an Array with all your buttons names in it like so;

    var btnArray:Array = new Array(home, aboutUs, contactUs);

    We will loop through the array later using a (for Loop) to access the buttons by the index number of the array.

    Then write your on click, over and out functions and issue the instruction to the event target button instead of a particular button, this makes your function reusable and that is one of the biggest advantages of OOP languages like AS3. If this doesn&#;t make sense keep reading

    Leave them blank for now!

    function onMouseClick (event:MouseEvent):void { } function onMouseOver (evt:MouseEvent):void { } function onMouseOut (evt:MouseEvent):void { }

    now the For Loop this is where the magic happens !!!

    Let me explain!

    write a loop that uses a variable give it the name of a single letter I will use the letter (i) make it an integer and give it the value of 0, then compare that variable with the array&#;s length property by setting it less then the property of the array class, and finally increase the variable by one by using the ++ method of AS3.

    inside the loop we add the button functionality by assessing the button through the arrays index by using our loop variable to access it like so &#;btnArray[i]&#;,

    and if you use MovieClips for your buttons 2 little bits of code to make them work like true buttons the buttonMode and the mouseChildren property’s of the MovieClip class they both get a Boolean value so there really easy to set.

    for (var i: int = 0; i <; i++){ btnArray[i].addEventListener(, onMouseClick); btnArray[i].addEventListener(sprers.eu_OVER, onMouseOver); btnArray[i].addEventListener(sprers.eu_OUT, onMouseOut); btnArray[i].buttonMode = true; btnArray[i].mouseChildren = true; }

    now add your functionality to your functions if the buttons are going to do totally different things the use if and else if statements to assign the functionality if they are for navigation to a url then use the navigateToUrl property of the class and if it is for navigation in the flash file then go back to your flash file and at the beginning of each section put a frame label with the same name as the button that will navigate to that section then use the property to go there like so;

    function onMouseClick (event:MouseEvent):void { sprers.eudStop(home); navigateToUrl(new URLRequest("")) } function onMouseOver (event:MouseEvent):void { sprers.eudPlay(over) } function onMouseOut (event:MouseEvent):void { sprers.eudPlay(out) }

    I hope that was clear enough for the smart ones lol any how the complete code is a lot more clean and short the writing ten functions and ten event listeners here it is

    var btnArray:Array = new Array(home, aboutUs, contactUs); function onMouseClick (event:MouseEvent):void { sprers.eudStop(home); navigateToUrl(new URLRequest("")) } function onMouseOver (event:MouseEvent):void { sprers.eudPlay(over) } function onMouseOut (event:MouseEvent):void { sprers.eudPlay(out) } for (var i: int = 0; i <; i++){ btnArray[i].addEventListener(, onMouseClick); btnArray[i].addEventListener(sprers.eu_OVER, onMouseOver); btnArray[i].addEventListener(sprers.eu_OUT, onMouseOut); btnArray[i].buttonMode = true; btnArray[i].mouseChildren = true; }

    FlexMonkey Deep Dive

    This article provides a brief introduction to FlexMonkey and then walks through debugging issues that can be encountered when testing with FlexMonkey.

    What is FlexMonkey?

    FlexMonkey is an open source tool from Gorilla Logic for testing Flex and AIR applications.  The project includes an AIR based console that allows users to quickly create and run user interface tests by providing the ability to record, playback, and verify on Flex visual components.  FlexMonkey also allows users to generate ActionScript versions of the tests for easy integration with continuous integration environments.

    You can find the FlexMonkey project at:

    Goals / Motivations

      Related Sponsored Content

    FlexMonkey and the underlying automation framework generally work well, especially for the stock Flex components.  However, at times, you may bump into problems with record and playback due to custom component extensions, bugs in FlexMonkey, or bugs in the Flex automation framework.  This article aims to help you understand how to quickly work through these types of issues. 

    In showing you how to address FlexMonkey issues, we are going to walk through a typical debugging session, where we automate the testing of a custom component.  For the exercise, we will use Justin Shacklette’s Flex 4 Terrific Tab Bar Component.  Justin is an engineer at Gorilla Logic who has worked extensively with Flex 4 and has many useful custom components on his blog.  The Terrific Tab Bar component adds a close button to the standard Spark TabBar component.

    As you will see in this article, it does take some work to deal with the custom TabBar, but it is not as daunting as it may seem on a first look.  As with any technology, the better that you understand how it works, the easier it is to solve problems when they come up.

    While it can takesome effort to deal with the automation framework, it is well worth the investment, as FlexMonkey allows you to create comprehensive “developer tests” that would be difficult to create by only using unit testing tools.  At Gorilla Logic, we’ve moved away from describing user interface testing tasks at a tools level, preferring to avoid terms like “unit testing” and “functional testing”, instead choosing to identify our testing activity by the role completing the work, using descriptions like “developer testing” and QA testing.”  By breaking it down this way we can focus on making sure we achieve our different testing goals, but not limiting our developers to a pure unit testing paradigm, when there is such and obvious mismatch between pure unit testing and user interface development. 

    Even though we believe that developer testing of user interfaces is fundamentally different than other parts of the system, we don’t think that FlexMonkey replaces traditional unit testing tools, like FlexUnit.  There are parts of the code base that lend well to traditional unit tests (e.g. business logic, etc).  Using both tools provides a killer combination for developers to create a robust developer test suite. 

    Setting Up

    If you want to get follow along at home, you can get started by downloading and importing the Terrific Tab Bar archive file into Flash Builder.  Next, setup the project to work with FlexMonkey.  The FlexMonkey console will walk you through this setup in the “Project > Properties > Setup Guide” window of the AIR console, as seen in Figure 1.  Basically there are two steps: 1) Add the to the Flash Builder project, 2) Update the compile arguments to include the FlexMonkey and Automation libraries.    Once you complete these steps, you should be able to launch the Terrific Tab Bar application and the FlexMonkey console.  You should see the green connection light on – meaning FlexMonkey and the application are communicating, so it is ready to go.


    Figure 1 : FlexMonkey Setup Guide

    Debugging Session

    In order to do automated testing on the Terrific Tab Bar component some kinks need to be worked out.  Here we walk through a chronology of the attempts and fixes to use FlexMonkey to automate the custom component.  So, follow along and hopefully when we are done you will understand how to fix your own FlexMonkey issues by using the debugging methods you see here.

    If you are new to FlexMonkey, you may want to first read our recent post that gives an Overview on How FlexMonkey Works for background.

    Try #1

    First, it’s time to do some recording against the Terrific Tab Bar application.  I begin by attempting a click on one of the tab labels and see the FlexMonkey console successfully recorded a “select” event.  This shows us that FlexMonkey is setup correctly and able to record on standard parts of the Spark TabBar.  Next, I click on the close button with less success, as the error in Figure 2 is thrown:

    TypeError: Error # Cannot access a property or method of a null object reference. At sprers.eution::AutomationManager/isObjectChildOfSystemManagerProxy()[C:\work\flex\dmv_automation\projects\automation_agent\src\mx\automation\] at sprers.eution::AutomationManager/recordAutomatableEvent()[C:\work\flex\dmv_automation\projects\automation_agent\src\mx\automation\] at[E:\SVN\4.x\frameworks\projects\automation\src\mx\automation\delegates\core\] at sprers.eutClasses::SparkButtonBaseAutomationImpl/clickHandler()[E:\dev\4.x\frameworks\projects\automation_spark\src\spark\automation\delegates\components\supportClasses\]

    Figure 2 : Type Error From AutomationManager

    Fix #1: Implement Automation Children Methods

    One of the hardest parts of dealing with errors like this from the automation framework is that Adobe does not publish the source code for the AutomationManager class.  So, there is not an easy way to see the root cause of this recording issue.  When “automation land” seems confused, I typically begin by validating that FlexMonkey and the automation framework are seeing the component tree correctly.

    In the latest release of FlexMonkey, it is easy to view the component tree in the FlexMonkey console.  With the application connected, all you have to do is open the “Project > View Application Tree” window.  This window shows the component tree for the application under test according to “automation land.”  As you can see in Figure 3, the close buttons on the tabs do not appear in the tree.

    Figure 3 : Application Tree Before Changes

    Flex provides three methods for telling the automation framework about the component tree: getAutomationChildern(), getAutomationChildAt(index:int), and numAutomationChildren().  Implementations of these methods are provided on the Flex components, but in some cases it does not see the tree properly.  On the TerrificTabBar component, overriding them with the code in Figure 4 causes Flex to see the component’s tree correctly.

    override public function getAutomationChildren():Array { return [_sprers.euutton]; } override public function getAutomationChildAt(index:int):IAutomationObject { return getAutomationChildren()[index]; } override public function get numAutomationChildren():int { return 1; }

    Figure 4 : Implementation of Automation Children Methods

    Note: There are two options for where the automation children code can live.  It can be added directly to the TerrificTabBarButton class, as it is a UIComponent.  Alternatively, it can be implemented on an automation delegate class that we configure to work with the TerrificTabBarButton class.   This code logically fits best on the delegate, but sometimes it is easiest to just add it directly to the UIComponent class when it is the only change that is in necessary.  The delegate class is the obvious choice for this logic to live when you cannot or do not want to modify the component class source code.

    It is time to implement a custom delegate for the TerrificTabBarButton.  To do so, I create a TerrificTabBarButtonDelegate class that extends SparkToggleButtonAutomationImpl in a “delegates” package with the contents in Figure 5.

    package delegates { import sprers.euicTabBarButton; import sprers.euyObject; import sprers.euvent; import sprers.eution; import sprers.euationObject; import sprers.euoggleButtonAutomationImpl; import; [Mixin] public class TerrificTabBarButtonDelegate extends SparkToggleButtonAutomationImpl { public static function init(root:DisplayObject):void { sprers.euerDelegateClass(TerrificTabBarButton, TerrificTabBarButtonDelegate); } private var _tabButton:TerrificTabBarButton; public function TerrificTabBarButtonDelegate(obj:TerrificTabBarButton) { super(obj); _tabButton = obj; } // // implement automation methods so that Flex knows about about the close button // override public function getAutomationChildren():Array { return [_sprers.euutton]; } override public function getAutomationChildAt(index:int):IAutomationObject { return getAutomationChildren()[index]; } override public function get numAutomationChildren():int { return 1; } } }

    Figure 5 : Custom Delegate Implementation

    To get this code to compile into the application, I need to tell the Flex compiler about the class because it is not referenced anywhere in the code.  This is done by adding the following flag to the compiler arguments in the “Project > Properties > Flex Compiler” screen of Flash Builder:

    -includes sprers.euicTabBarButtonDelegate

    The three automation children methods tell the automation framework that the TerrificTabBarButton actually does have a child, unlike the standard TabBarButton.  The standard TabBar button does not have a child, and thus returns a null Array for the getAutomationChildren() method.  With this change, the Flex automation framework should be able to see the close button as a child of the custom TabBar button.

    Try #2

    Now, that the code is updated, I reload the application and the “Project > View Application Tree” window of FlexMonkey with much better results.  Figure 6 shows that FlexMonkey is now showing the component tree correctly, as there is a close button for each tab.

    Figure 6 : Application Component Tree After Updating Automation Children Methods

    Next, I attempt to record on the close button again.  Unfortunately, the error from Figure 1 is still thrown from inside the AutomationManager class.  

    Even though overriding the automation children methods did not do anything to solve the problem with the custom TabBar, it still is an important part of the automation / FlexMonkey puzzle to understand.  Many automation problems are resolved by working with these methods.  It is also worth noting that it is not always about telling the automation manager about components it cannot find.  At times it can be just as fruitful to hide components from the automation manager by overriding these methods.  It is really just something you have to deal with on a case-by-case basis.  With the new FlexMonkey “Application Automation Tree” interface, it is easy to see what the automation framework sees.  In most cases it should be apparent what direction you want to try taking things.

    Fix #2: Hide Event From Automation Manager

    At this point, I take a closer look at the stack trace.  The source code for the AutomationManager class is unavailable, but Adobe does provide source code for the delegate classes.  So, debugging on their source code can give a better idea of why recording is failing. 

    To add the source code, click on the “Edit Source Lookup Path…” button that is displayed in the file window that opens when clicking on the delegate class in the stack trace.  The delegate source code can be found in “[SDK HOME]/frameworks/projects” directory.  There are multiple projects in that directory.  For the delegates in this stack trace, I added the following directories: “automation/src” and “automation_spark.”

    In hopes of understanding what is happening, I debug into the “clickHandler” method of the SparkButtonBaseAutomationImpl and inspect the event as seen in Figure 7.  The event looks as expected, but I do note that it has a “target” of “,” which is what I expect as the close button is of that type.

    Figure 7 : Debugging Into Delegate Class

    If I debug into this method again, but click on the label portion of the tab instead of the close button, the “target” for the event is a Label instead of a Button.  Rather than fighting with “automation land” when I do not have the information to do so (i.e. the AutomationManager source code), I settle on suppressing the event causing the error from the making it into “automation land.”  I do this by overriding the “clickHandler” method in the TerrificTabBarButtonDelegate class we created in Fix #1 by adding the code in Figure 8 to the delegate class.

    override protected function clickHandler( event:MouseEvent):void { if(sprers.eutionName != "closeButton") sprers.euandler(event); } }

    Figure 8 : Override clickHandler to Suppress Event

    The “clickHandler” override checks the event target and only calls the super classes implementation if it is not for the close button.

    Try #3

    I refresh and try recording on the close button again.  Finally, some real success!  The error is no longer thrown.  However, FlexMonkey is recording a “Select” event when we click on the close button, which if we playback will only select the tab, not close it as should happen.

    Fix #3: Suppress Extra Select Event in the TabBar Component

    At this point, while things are not yet working, the code is in pretty good shape because the mysterious error has been removed from the mix.  Now that it is possible to plot a course, I plan to create another delegate class.  This delegate will be for the custom TabBar.  Similar to the TerrificTabBarButtonDelegate implementation, I am going to suppress the event that is causing the “Select” action to be recorded when clicking on the close button.  Then, in Fix #4, it is time to actually automate the custom TerrificTabBarEvent for recording and playback, which will be the final piece to getting the component setup for working with FlexMonkey.

    Repeating the same steps followed in Fix #1, I create another custom delegate class called TerrificTabBarDelegate.   The code for the new delegate can be seen in Figure 9.  As you can see, this code is very similar to the first delegate for suppressing the event.

    override protected function clickHandler( event:MouseEvent):void { if(sprers.eutionName != "closeButton") sprers.euandler(event); } }

    Figure 9 : TabBar Custom Delegate 

    If you are following along at home, do not forget to add the compile argument to include in the new delegate class, as the Flex compiler only includes classes that are referenced elsewhere in the code:

    -includes sprers.euicTabBarDelegate

    Try #4

    As I hoped, now when recording a click on the close button, nothing happens.   So, we now have delegate classes in place and nothing unintended is happening during recording.  I can now move on to the easy part, automating the custom event that will actually allow me to record and playback on the custom TabBar.

    Fix #4: Instrument Custom Close Event

    It is not always “normal” to have to deal with suppressing events as I have done in this article. However, it is a fairly normal activity to have to instrument custom components to work properly with FlexMonkey, and it is actually much easier than it sounds.  Basically, I am going to add an event handler for the custom event in the delegate, and then tell the delegate to record and playback whenever it happens.  The only other piece of work is that the custom event has to be described in the environment file. 

    To begin, I am going to create a custom version of the TerrificTabBarEvent to use for record and playback.  I need to do this because the TerrificTabBarEvent class has a constructor with custom required arguments.  An alternative to the custom event I am creating next would be to give the “index” property a default value in the constructor and make it writeable with a setter.  However, I want to show here how this can be automated without modifying the code being tested. 

    Using the contents of Figure 10 I create the custom event class AutomationTerrificTabBarEvent in the “” package.  This event allows FlexMonkey to instantiate an event with just the “type” value and then set the “index” as property outside of the constructor.  The “index” property is a custom event property that tells the TerrificTabBar component which tab to close.

    package { import; public class AutomationTerrificTabBarEvent extends Event { public var index:int; public function AutomationTerrificTabBarEvent(type:String, index:int=-1, bubbles:Boolean=false, cancelable:Boolean=false) { super(type, bubbles, cancelable); = index; } override public function clone():Event { return new AutomationTerrificTabBarEvent(type,index,bubbles,cancelable); } } }

    Figure 10 : Update Event Class

    Next, we are going to modify the FlexMonkey environment file to tell it about this event. Another utility window that was added in the latest release of FlexMonkey is the “Project > View Environment File” option, which shows the current file contents in use as seen in Figure 11.  This can be useful for confirming that any custom edits are being picked up and for accessing the current file contents for editing.  To create my own custom file, I copy the contents from that screen and paste them into a file called in the same directory as my MXML application source file.  This causes Flash Builder to copy it out to the same “bin” directory as my SWF file, where FlexMonkey can load it and use it instead of the default version of the file. 

    Figure FlexMonkey Environment File Window

    Once the file is created, I add the snippet from Figure 12.  This is needed to tell the automation framework about the custom AutomationTerrificTabBarEvent and its properties. 

    <!-- Terrific Tab Bar --> <ClassInfo Name="TerrificTabBar" Extends="SparkListBase"> <Implementation Class="components::TerrificTabBar"/> <Events> <Event Name="CloseTab"> <Implementation Class="sprers.eutionTerrificTabBarEvent" Type="closeTab"/> <Property Name="index"> <PropertyType Type="int"/> </Property> </Event> </Events> </ClassInfo>

     Figure Environment File Updates

    Looking at the environment file can be a bit misleading, as it initially appears that you need an entry for any custom delegates you add.  But, as you may have noted, I have not had to edit this file previously.  This is because this file describes a hierarchy of the components, so an entry is only necessary for things that cannot be found on the parent class descriptions.  The best example for understanding this is to look at the entry for the FlexDisplayObject, which describes the “Click” event.  Since all Flex components extend UIComponent (the class for this entry), the automation library has a description for click events that don’t need repeated on each entry.  

    The next step is to add logic to the delegate class for recording and playing back on the event.  In the constructor, we add event listener to DisplayObject that is passed in (an instance of TerrificTabBaButton).  In code for Figure 13, I update the delegate constructor to add an event listener for the “closeTab” event and keep a private reference to the TabBar component.  The event handler priority is set to default plus one so that “automation land” sees the event before standard handlers.

    private var _tabBar:TerrificTabBar; public function TerrificTabBarDelegate(obj:TerrificTabBar) { super(obj); _tabBar = obj; sprers.euntListener(sprers.eu_TAB, closeHandler, false, sprers.euT+1, true); }

    Figure Add Delegate Event Handler

    Next, I implement the handler as seen in Figure 14.  This tells FlexMonkey to record the event using the custom AutomationTerrificTabBarEvent I created previously. 

    protected function closeHandler( event:TerrificTabBarEvent):void { recordAutomatableEvent(new AutomationTerrificTabBarEvent(sprers.eu_TAB,; }

    Figure Delegate Event Handler

    After setting up the delegate for recording, the next step is to add the code in Figure 15 which tells the delegate how to playback the event, which dispatches the TerrificTabBarEvent on the proper component to get the desired playback results.

    override public function replayAutomatableEvent(event:Event):Boolean { if(event is AutomationTerrificTabBarEvent) { return _sprers.euchEvent(new TerrificTabBarEvent(sprers.eu_TAB, (event as AutomationTerrificTabBarEvent).index)); } else { return sprers.euAutomatableEvent(event); } }

     Figure Delegate Playback Logic

    Try #5

    At last, I can now successfully record and playback on the close clicks custom TabBar!


    With the record and playback finally working, it’s time to review the solutions implemented.  In the end, I have only a handful of changes with two delegate classes, a custom event class, and some minor modifications to the FlexMonkey environment file.  Here is the recap of what I did:

    1. Overrode the automation children methods so that FlexMonkey and the automation framework could see the close button on each of the tabs.
    2. Prevented the close button click event being dispatched on ButtonBarButton from FlexMonkey / automation framework because it was causing an error in the AutomationManager class.
    3. Prevented the close button click event being dispatched on TabBar from FlexMonkey / automation framework because it was being recorded as a “Select” event, which was not appropriate for this case.
    4. Automated the custom TerrificTabBarEvent in the TerrificTabBarEventDelegate so that FlexMonkey would be able to record and playback on the component. 


    About the Author

    Jon Rose is an enterprise software consultant and Flex Practice Director at Gorilla Logic, Inc. ( located in Boulder, Colorado. He is an editor and contributor to, an enterprise software community. He is the co-host of, a videocast for those who like booze and bits. He has worked with clients large and small in both the private sector and government. His love of solving problems drives him to build quality software. You can read his blog at:

    This content is in the Microsoft topic

    Related Topics:

    Cannot access a property or method of a null object reference at #74

    Main problem - this exception appears quite randomly (several seconds to several minutes from the start if it appears, no matter what you do). So it is hard to understand what is causing it.

    Because i have no idea where is our problem i'll just give details:

    Error Message:

    Our project specifics:
    We are using citrus+starling+nape (as3).
    Nape space contains destructible terrain (based on nape's sample "DestructibleTerrain" with marching squares), static terrain, another static body as some sort of "lava", several body compounds as "tanks".
    Also there is a second nape space but it does nothing when error occurs (no "" calls for it are ever done).

    • Destructible terrain - + static bodies - no internal collisions and no collisions with other static bodies (through interactionFilter)
    • Static terrain and "lava" - no collisions with Destructible terrain and each other, so technically they touch nothing at the start
    • "Tanks" - some sort of box with several wheels attached by joints (2 per each wheel), sensors and kinematic bodies as additional tank parts positioned on tank by code in every "update". All parts of one tank are in one compound.

    Libraries info
    citrus engine v.
    nape v. (Development build). Tried in and Release/Debug builds - still happens with the same error message.


    API Changes

    Experimental APIs

    Internal API

    Those APIs are not intended to be used by clients, and will be hidden or removed with PMD You can identify them with the annotation. You’ll also get a deprecation warning.

    • The protected or public member of the Java rule are deprecated and considered to be internal API. They will be removed with PMD 7.

    External Contributions


    • 43 commits
    • 21 closed tickets & PRs
    • Days since last release: 27

    January -

    The PMD team is pleased to announce PMD

    This is a minor release.

    Table Of Contents

    New and noteworthy

    SARIF Format

    PMD now supports the Static Analysis Results Interchange Format (SARIF) as an additional report format. Just use the command line parameter to select it. SARIF is an OASIS standard format for static analysis tools. PMD creates SARIF JSON files in SARIF version An example report can be found in the documentation in Report formats for PMD.


    • The C++ module now supports the new option , which can be used to avoid detection of some uninteresting clones. This options has been introduced with PMD for C# and is now available for C++ as well. See #

    New Rules

    • The new Apex rule brings the well known Java rule to Apex. In Apex the same principle applies: and should always be overridden together to ensure collection classes such as Maps and Sets work as expected.