I’ve made a little alteration to the dPanel class.
- dPanel.trace() now works with non-String values
- dPanel.trace() now works with undefined or null variables (null variables will trace as undefined)
- The dPanel should now stay on top of your other Flash content (you may have to execute the moving in/out transitions to move the dPanel back on top after other content has been added to the stage)
I've also updated the ZIP file so that it includes the dPanel class file.
While the Alert class is useful for debugging applications, there are instances where another solution is needed. For example, you may want to log activity in your application without always seeing it displayed in a dialog which you have to close manually. For this reason I have taken inspiration from Senocular's Output Panel class and created my own class which attempts to improve on that class and mimic the Flash IDE's output panel.
I've created this class to enable developers to easily debug their applications in and out of the Flash/Flex IDE.
Click here to launch the dPanel example.
I recommend at least reading the 'Simple Usage' before playing with the example. The 'Advanced Usage' will explain what all of the options do and you will see why I chose to have this example housed in a separate Window instead of embedded in this page.
There are four functions publically available:
init() - you call this method once to initialize the class
trace() - this prints text in the dPanel
clear() - clears the text from the dPanel
text - you can get the text currently in the dPanel by accessing this property
Simple Usage
Using the dPanel is very simple. All you have to do is call dPanel.init(), passing to it a reference to the stage. This creates the dPanel and adds it to the display list.
Once this is done you can then call dPanel.trace() from anywhere in your project and the specified text will be added to the dPanel.
You'll immediately notice however that the dPanel is not actually visible. This is because it is positioned off stage. To show the dPanel you need to press the grave accent key (this is below the ESC key on Windows and to the left of the letter Z on the Mac). You press it again when you want to hide the dPanel.
For most purposes, that is all there is to it!
Now to move on the more advanced usage so we can find out what all of the extra options are for...
As stated in a previous post, I was due to release a small useful class to help with debugging quite a few weeks ago. Unfortunately I simply haven't had the time. University commitments mean that all of my time is spent on completing projects and writing essays. I'm going to be absent at least until May, at which time I'll definitely be able to start blogging again.
Until then!
I've finally decided to name my (currently non-functioning) company Fatal Exception Studios. It was initially to be Fatal Exception Software but I decided I did not want to be limited to producing software.
Also, to update, these are the projects (along with academic work) which I am currently working on, in the order that they will be completed:
- A class to mimic the Output panel to help with debugging AS3 projects
- A much improved version of my Flash CS3 Alert class
- A Mickey Mousing Flash movie called Fatal Incursion
- A side-scrolling shoot-em-up game - Mercury is its working name
- Another shoot em up game (completely different to the first one - I cant divulge any more details...)
Those who have made the switch from XP to Vista wlll find that the actionscript editor is quite slow (e.g. it sometimes takes a while for typed text to appear and the editor lags when selecting blocks of text). It took me a while to find out the solution, during which time my productivity was greatly reduced.
Anyway, to get the editor to run at normal speed all you need to do is this:
- Right-click your Flash CS3 EXE file (or the shortcut) and select Properties
- In the Compatibility tab, turn on compatibility mode for Windows XP
The next time your run CS3, you should be able to code as normal.
I'm set in the next week to make available a new class to help with debugging applications and was working on a bespoke scroll bar that I built for it. As with all scroll bars you need the ability to drag the thumb up and down (or left and right in some cases) and for that I used startDrag() and stopDrag() which work well when applied to the MOUSE_DOWN and MOUSE_UP events.
However there are times when this does not work right. For example, the user might press down on the thumb, then move the mouse out of the bounds of the thumb and release the mouse button. In this case the thumb would not know the mouse had been released and would continue to be 'dragged' when the user moved the mouse back over the thumb.
Below is an example which demonstrates this. Here, there is a simple button to play with - try pressing down on the button and releasing it outside the button. You will find that you have to press down and release again to restore the button's original state.
Cannot display SWF
So how do you catch for when the mouse is released outside of the target area? In AS2 there was the onReleaseOutside event but this has been removed for AS3. So how do we catch the release outside event?
