Once your game is running, to access the console press the default hot key, which is the Tilde (~) / Grave (`) key.
As of this post, the latest revision of the PushButton Engine is revision 702. In this version there are some commands registered by default:
help – List known commands.
clear – Clears the console history.
listDisplayObjects – Outputs the display list.
showFps – Show an FPS/Memory usage indicator.
verbose – Set verbosity level of console output.
version – Echo PushButton Engine version information.
Quick Tricks
The console supports a few shortcuts to make your life easier:
The console is not case-sensitive, so don’t worry if you put showFps or shOwFPS, the same command will execute.
You can use the up and down arrows to move through your command history.
By pressing enter on an empty command line, you can add new lines. This is helpful for adding space between commands to make it easier to read.
You can use the “name” property on a DisplayObject to make meaningful names show up in the listDisplayObjects command.
Different Log Levels are colored by default, to change the colors edit com.pblabs.engine.debug.LogColor.
Creating custom commands for the console
The PBE console also supports the ability for the developer to add their own commands.
package
{import com.pblabs.engine.PBE;
import com.pblabs.engine.debug.Console;
import com.pblabs.engine.debug.Logger;
import flash.display.Sprite;
publicclass ConsoleCommand extends Sprite
{publicfunction ConsoleCommand(){
PBE.startup(this);
Console.registerCommand("test", onTestCommand, "This is a test command.");
Console.registerCommand("testStrict", onTestStrict, "Test strict parameters.");
}
protected function onTestCommand(... args):void{
Logger.print(this, "onTestCommand: "+args);
}
protected function onTestStrict(str:String, num:Number):void{
Logger.print(this, "You passed in the string: "+str);
Logger.print(this, "You passed in the number: "+num);
}}}
Parameters are passed in sequence using spaces. So to run the test command, I would open the console, and then type “test a b c 1 2 3″. This would then call the onTestCommand method and pass in an array with 6 elements.
Below is an example of what using custom commands in the console looks like.
Changing the Console HotKey
Some of our good friends over in the Netherlands use different keyboard layouts, so they requested the ability to change the hot key binding to another key.
WARNING!!! When changing the hot key to another key, the input textfield doesn’t escape the new key binding. So you must remove focus from the input field to use the hot key to close the console.
More information on this can be found in issue 98.
What’s coming?
I do have plans on adding either tab-complete or a drop-down auto complete list into the console which will match avaliable commands.
Another thing that I’m currently working on is code-named Tumbler. It’s and Adobe AIR version of the console which has additional features to assist in debugging and troubleshooting your games.
It’s a proof-of-concept at the moment… but if there is enough interest in it… I may spend more time on it.
Using Amazon’s Mechanical Turk in combination with outsourcing your design task to Elance, you can get great designs and user feedback very quickly, easily and for very little money.
Step 1: Post your job “design a logo” on Elance (elance.com). Be sure to include instructions including other designs that inspire you and a description of your product vision and intended audience.
Step 2: After selecting a designer, ask them to create 3 to 5 draft design mocks
Step 3: Using mechanical turk (mturk.com), submit each design option to mechanical turk as a survey (e.g. “which design do you like best”). You can choose any number of people to answer your survey. Estimated cost: 100 people at $0.10 each = $10
Step 4: Review results.
I’ve found that using this technique that for about $10 I can get around 100 people to tell me which design they prefer and offer suggestions. Also, I usually ask for the age, country and background of the participant so I can filter down to an audience that matches my purposes.
This tip was provided by Joe H. Excellent tip Joe!
So for the most part… up to this point I haven’t really needed to use extensive Flash animations within Flex. I mean like most people, I’ve embedded swf assets into my Flex application by using the [Embed] metadata tag. However, using the Embed metadata tag, in my opinion, is for static assets or simple animations… you know… images, animation only swfs, fonts, etc…
Today I found a cool button that I wanted to use in my Flex application.
The button (roll your mouse over me):
The thing about this button is that it has complex roll over and roll out animations. Of course we could create the same thing within Flex using an ActionScript tween class… but some things are better left to the Flash timeline.
So how do we get our button into Flex, with all of its animation and interactivity intact? The answer, my friends, is to use Adobe’s Flex Component Kit.
Doing some research online, it’s not really clear where to get it, or how to use it. According to labs, it’s released within Flex 3… but I don’t have a clue where. So we’re going to do this my way…
Step 1 : Install Adobe Extension Manager 2.1
Obviously, you can skip this step if you already have Extension Manager 2.1 installed.
If you didn’t install the Adobe Extension Manager when you installed your copy of CS4, you can download it here —> Download Adobe Extension Manager
If you already had Adobe Extension Manager installed… just be sure it has been updated to version 2.1.
All the way at the bottom you’ll find the extension we’re looking for… Flex Component Kit for Flash CS3 Professional (I know it says CS3 and we’re working in CS4, don’t worry)
Once downloaded, unzip and double-click FlexComponentKit.mxp
Read this whole agreement and only if you agree the terms click “Accept”
…how many of you read that?
Okay, you should see this now.
Documentation for this component can be found here —> FCK Docs
Onward!
Step 3 : The Flash Side
Let’s take our button and load it into Flash. We’re going to name it “MyButton”.
Create an AS3 class to handle all of the button interactions we need
Make sure you have MyButton selected in the Library, and then use Commands > Convert Symbol to Flex Component.
Your output panel will let you know the command worked properly.
Test the movie by pressing ⌘ + enter (ctrl + enter on the PC).
Publish the movie, which creates both a SWF and a SWC file.
Now that we have our SWC file, we’re ready to move into Flex Builder.
Step 4 : The Flex Side
Copy our newly create SWC file into our libs directory.
With the SWC in our libs directory, it will automatically be included in the classpath of our Flex application (see this tip for more information on the libs directory).
The SWC file includes the MyButton class, so we can now write our code:
<?xmlversion="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:local="*"
layout="absolute"backgroundColor="0x000000" backgroundGradientAlphas="[0,0]"
creationComplete="onReady()"><mx:Script><![CDATA[privatefunction onReady():void{// How to use the custom button in ActionScript /*
var button:MyButton = new MyButton();
button.x = 35;
button.y = -10;
addChild(button);
*/// And just for fun
makeGrid();
}privatefunction makeGrid():void{var pad:int = 35;
var gridWidth:int = 10;
var gridHeight:int = 10;
var yOffset:int = -45;
var xOffset:int = -25;
for(var h:int=1; h<=gridHeight; h++){for(var w:int=1; w<=gridWidth; w++){varbutton:MyButton = new MyButton();
button.x = w*pad+xOffset;
button.y = h*pad+yOffset;
myPanel.addChild(button);
}}}]]></mx:Script><mx:Panel id="myPanel"
layout="absolute"left="10"right="10" top="10" bottom="10"backgroundColor="#1D1D1D" title="Hey look, I'm a Flex Panel"/><!-- How to use the custom buttonin MXML --><!--<local:MyButton x="-5" y="-10"/>--></mx:Application>
And here’s what it looks like:
Weeeeee…. that’s fun, you can download the source here.
The source there is an Archived Flex project, all you need to do is Import it into Flex Builder and you’re good to go.
That was a long tip, any questions please post them.
Today I was going to post about using flashvars and widget development. However, as I started to document the process, it became too much information for a single tip. So I’m going to do a separate post walking you through my widget development process. Now on to today’s tip!
To be honest with you guys, I’ve never really been a huge fan of Fireworks. I’m a Photoshop guy, and I have been since version 5.5 (hooray ImageReady). However, at our last SeaFlex meeting Marty gave a quick introduction into Flex skinning using Fireworks. My eyes were opened! So here is the basic run down of creating Flex skins using Fireworks CS4.
Within Fireworks go to Commands > Flex Skinning > New Flex Skin
Select the components you want to skin.
Skin to your heart’s desire.
When you’re finished, go to Commands > Flex Skinning > Export Flex Skin
I created a new folder called testSkin and saved to that.
Now in Flex Builder. File > Import > Skin Artwork
Browse to the folder we just exported our assets to.
Make sure the image to component mappings are correct.
And…. you’re done.
Amazing.
:: UPDATE ::
Marty just posted a PC (and more in depth version) of the skinning your Flex applications with Fireworks. Read it here!