Junk Byte Code for Kicks


Faster Console graphing

New graphing panel seems to run 30 graph lines at 60fps (at least on my machine).
Try it here:
(The actual graph does not mean much to the sound)

Filed under: Console 5 Comments

ASDOC inside SWC

Just learned how to include asdoc inside swc so that it shows up in IDE
(tested with FlashBuilder).

Thanks to http://forums.adobe.com/thread/444791

Added a new console download: Console2.6+asdoc.swc



Console command prompt addon demo

Finally got time to do a simple demo of "CommandPrompt" addon.

I used this addon for a utility AIR app at my work.
The app is a simple command line where you choose what you want to do and it does stuff according to your choices.

Here is a simple greetings demo:
(your selections do not get recorded :)

Filed under: Console Continue reading

Console 2.6

Version 2.6 final is out for download.

* Addons are now included in Console.swc
* DisplayMap addon, Allows inspecting of display tree
* CommandLine auto focus addon, auto focus command line textfield when it becomes visible
* Removed Cc.remotingPassword. use Cc.config.remotingPassword (must be set before starting remote)
* Basic timestamp display support. Use Cc.config.showTimestamp = true;
* Line number display support. Use Cc.config.showLineNumber = true;
* Key binds allow for key down or key up state
* Multi line top menu
* Support for delete operation in commandLine
* Fixed Issue 90. UTF8 chars failing to send to remote

Download at: http://code.google.com/p/flash-console/downloads/list

Tagged as: 1 Comment

Flash String weirdness

A long time ago...

I had this bug report in Console that FPS and memory graph is leaking memory.
Issue: http://code.google.com/p/flash-console/issues/detail?id=89
I was not able to find the exact cause of this other than the fact that if I don't update texts in graph, it doesn't show any memory problems.
I suspected back then that Strings were strange but was not able to pin point what's strange about it.

Fast forward to today

I recently learned that flash keeps 'master string' of strings when they get passed around.
See http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/sampler/package.html#getMasterString()

For example, if you call String.substr(), the returned string will often actually be implemented as just a pointer into the original string, for the sake of efficiency. In normal usage, this is an implementation detail which is not visible to the user; however, it can be confusing when using a profiler to analyze your program's memory consumption, because the string may be shown as taking less memory than would be needed for the string's value. In addition, a string might be retained in memory solely because it is the master for other strings. getMasterString() allows profilers to show the user an accurate graph of string dependencies.

It sounds good, it is obviously saving memory by not copying the strings and reusing via referencing to original string where possible.

  • What if you only need to keep a tiny part of the string (say downloaded from an external file), will it know to discard the big string?
  • What if you chain a lot of strings together, will it keep references to all its parts?
  • Could it cause memory leaks?

Console 3.0 vs 2.x

This is weird. Still a lot of work left for Console 3.0 and a lot of feature ideas keeps popping up.

Wait till 3.0 or add additional 2.x versions, or addons...

I may go with add-ons for now.

Filed under: Console, Flash No Comments

Heroes VI clone units bug / cheat

Heroes 6, great game.
Was hooked in this game till I found this bug.

It is on "resurrect units" town UI.

Basically, if you don't have a hero garrisoned to the town, hero unit slots are normally invisible on other tabs.
But they have forgotten to hide it for resurrection panel.


  • You need to have some units to clone in town without hero garrisoned.
  • Town must have unit resurrection building  ("Altar of Eternal Servitude" on Undead side)
  • There must be at least 2 free unit slots left in town.


  • Go to resurrection panel of town UI.
  • Drag unit to one of hero units' slot.
  • Click on the unit portrait, randomly you'll notice it spawned a cloned unit stack.
  • Can't remember the exact sequence here, I need to play the game again :)
    But in short you can clone unit stacks this way.
  • Make sure there is only 5 units stacks at any times (don't go over or it will crash)
This have spoiled the game for me.
Because I can make tons of units so easily and enemies get crushed like bugs.
I may have spoiled my own enjoyment here.

This was possible on Heroes VI bought on Steam. Last update, end of Dec 2011.
Not tested on multiplayer matches. I HOPE it doesn't work!

Tagged as: , , No Comments

Terraria item clone cheat

I am sure there is already a full info about this cheat,  but I'd like to write from my exploration point of view anyway.

Quite like the game. I was hooked in the game the whole weekend.

I was first curious how big the world save files are so I found the files here:

(Win 7)

C:\Users\<user>\Documents\My Games\Terraria\Worlds

Then I realised, its just named world1.wld.
So I thought ok, what if I copy the world, will I be able to clone it in game?

The answer is yes.

So here is how to clone items.

  • Put stuff in a chest (or tons of chests in my case) in single player world.
  • Save and Exit world (don't need to exit game)
  • Clone the world file by copying and renaming to world2.wld, world3.wld, world4, world5.
  • Go into 2, 3, 4, 5 worlds and collect the items in chest.
  • Go back to world 1 and deposit the items in chest.
  • If you want to clone even more, repeat from step 2.

I usually keep the original world (world1) as deposit only world now.

And pick up items/gear from its clones only, this way my stock won't run dry.

Cloned stuff can be carried to multiplayer server too.

It was a pain to copy and rename world files. so I made a bat file and place it in the same folder as world files.


COPY world1.wld world2.wld
COPY world1.wld world3.wld
COPY world1.wld world4.wld
COPY world1.wld world5.wld

This assumes you only have 1 world file and it will overwrite worlds 2/3/4/5.
Don't come blame me if you lost your files!

Perhaps, I feel comfortable cheating because I discovered it my self and I felt deserved to use it.
Then again, its not like I am playing PVP and taking advantage over other players. Now that would be unfair.

Cheater out.

Tagged as: , No Comments


Finding quite interesting stuff from flash.sampler.



May be adding some cool console addons which use those API.
I do not plan to compete with Flash Builder's profiler nor other profilers.
It will probably just add a few extra niche features others do not support.

Strange thing I find:

If a method has try catch statement, it generates 'NewObjectSample' with "[activation-object]" tag in the stack.
This is also why when using Flash Builder's profiler running an app with Flash Console, it traces many cumulative instances of 'Remoting' and 'Graphing'. Annoying.

Filed under: Console, Flash 6 Comments