TheMiner and FlashDevelop

This tutorial assumes you’re familiar with both TheMiner (awesome Flash profiler) and FlashDevelop (best and free Action Script / haXe code writing IDE) and wish to use them in conjunction with each other.

There are two common ways using TheMiner in the FlashDevelop:

– Using TheMiner as SWC, like any other external library.
– Adding TheMiner’s swf to the FlashDevelop profilers list.

Why always not to use only one way? Because both have their pros and cons.
So, let’s try out both ways step-by-step. Please, start the FlashDevelop and create or open the as3 project to proceed further.

TheMiner as external SWC

1. First of all, purchase TheMiner or download a free version for the non-commercial usage.

2. Unpack given archive, go into the “SWCs” folder and select desired SWC with translation you prefer, as example, select the TheMiner_en.swc

If you’re familiar with SWC using in FlashDevelop, skip next two paragraphs of this tutorial and go right to the par. 5.

3. Copy-paste selected swc in the “lib” folder of your project (or in any other location in your project or even PC you prefer to store external libraries).

4. Add pasted SWC to the project’s library using “Add To Library” context menu item.

5. To run TheMiner, you should add its panel to the DisplayList first. Choose the wise place in your project where to add it (it could be a place where you’re set up the stage) and write there a few lines of code.

// first, we should import TheMiner class, so add this line to the imports:
import com.sociodox.theminer.TheMiner;

//after you're free to add TheMiner's panel
//please note if you're using 1.3.10 or earlier,
//you should pass "true" to the constructor
stage.addChild(new TheMiner());

Whole sample working code could be like this:

package
{
	import com.sociodox.theminer.TheMiner;
	import flash.display.Sprite;
	import flash.events.Event;

	/**
	 * ...
	 * @author focus
	 */
	public class Main extends Sprite
	{

		public function Main():void
		{
			if (stage) init();
			else this.addEventListener(Event.ADDED_TO_STAGE, init);
		}

		private function init(e:Event = null):void
		{
			this.removeEventListener(Event.ADDED_TO_STAGE, init);
			//please note if you're using 1.3.10 or earlier,
			//you should pass "true" to the constructor
			this.addChild(new TheMiner());
		}
	}
}

Hey, that’s all about using TheMiner as SWC! As you can see, it’s pretty simple and easy to set up TheMiner right in your SWF using the SWC approach.
Compile your project, run it in the debug Flash Player (by default in FlashDevelop) and you’ll see TheMiner in action!

So, in what cases should we prefer TheMiner as SWC over TheMiner as FlashDevelop profiler?
– if we wish to be able to run TheMiner anywhere our SWF is run under debug Flash Player or debug AIR, including the mobile devices
– if we wish to have an additional control on when to show TheMiner
– if we wish to be able to interact with TheMiner for more flexible and efficient profiling

TheMiner as FlashDevelop profiler

1. First of all, purchase TheMiner or download a free version for the non-commercial usage.

2. Unpack given archive, go into the “SWFs” folder and select desired SWF with translation you prefer, as example, select the TheMiner_en.swf

3. Place that SWF anywhere on your PC, and remember the path for it. For example, path will be “D:\Programming\Flash\Tools\TheMiner.swf”.

4. Open the “Tools->Program Settings” menu item in the FlashDevelop.

5. Go to the AS3Context plugin settings and look there for the Custom Profilers item.

6. Press the “…” button at the right from the Custom Profilers item and paste path to the TheMiner swf in the opened window as new line and press OK.

(sorry for Russian texts)

7. Close the Settings window and press on the “SWF Profiler” button on the toolbar (or to the “View” menu subitem with the same name).

8. Press and hold the “Active Profiler” button at the opened “Profiler” window left side and select “TheMiner” item in the dropped menu.

9. Press the “Auto-start Profiler” button if it’s red now to make it green and to enable TheMiner auto starting with compiled SWF.

That’s all – now you could compile your project and see TheMiner running!

This way of TheMiner using in the FlashDevelop may seem not so fast to set up as using TheMiner SWC, but you should make all this steps only once! Next time you’ll need to add TheMiner in your project all you need is just to ensure Auto-start profiler is enabled and compile your project!

So, in what cases should we prefer TheMiner as FlashDevelop profiler over TheMiner as SWC?
– if we don’t need TheMiner to be included in our SWF / app after publishing / leaving FlashDevelop
– if we wish to have very easy set up after first time without adding anything to the project code and keep the project clean from additional SWCs

PS: Today new TheMiner version is out with lot of bugfixes and some really nice additions.

Found a typo? Please, highlight it and press Shift + Enter or click here to inform me!

Share Button

Comments

TheMiner and FlashDevelop — 2 Comments

  1. You could use this construction to add profiler:
    CONFIG::debug
    {
    if (Capabilities.isDebugger)
    {
    addChild(new TheMiner());
    }
    }
    i think it very convenient.

    • You could use any suitable conditions for adding it, yeah. But in you example CONFIG::debug is not really necessary – TheMiner works fine with release mode compiled SWFs. Only Debug Flash Player version needed to start.