SapphireSteel Software: The Blog
the blog

Amethyst 2 Launches - visual Flash and Flex

by SapphireSteel Software
Plus many new tools!
Tuesday 21 May 2013.

SapphireSteel Software has today released Amethyst 2 Ultimate, the only truly ‘visual’ IDE for Flex, Flash and ActionScript developers.

Visually design Flash, Flex and AIR applications using the Amethyst Designer. The new ’Flash Forms’ (Flash without Flex) Designer is shown above.

When Adobe removed the visual designer from Flash Builder 4.7, Flex developers who needed a visual design tool were left stranded. Whereas Flash Builder has removed its Flex visual Designer, Amethyst 2 has actually extended its visual design support. It now not only has a drag-and-drop Designer for Flex; it also has a ‘pure Flash’ Designer to support form-based design (with similar capabilities to Windows Forms in C#) for Flash applications that don’t use Flex.

Amethyst 2 Ultimate – also includes numerous other innovative tools for ActionScript and Flash developers. These include:

- a unique ‘bubble-based’ debugger that lets developers step through code in the form of linked call-graphs with each called function shown in a separate popup ‘bubble’
- a Graphical profiler that analyses the efficiency of a running program and displays a memory map.
- the Developer Scratchpad – a docked panel to store code snippets or even selected methods in popup ‘bubbles’
- SWF obfuscator – no need to buy a separate tool to protect your code; Amethyst has one built in.

Amethyst 2 Ultimate includes a revolutionary ’bubble-based’ debugger (above) which allows you to step through a linked network of debug bubbles as you trace function calls while debugging.

Amethyst 2 Ultimate builds upon the existing features of Amethyst 1. It has the most extensive editing and debugging features available for Flash and Flex developers. The multi-window editor has code collapsing, extensive refactoring, 76 code colour options and fast IntelliSense. It can be used to design, debug and deploy applications for the web, the desktop or mobile devices.

For more information see the Amethyst 2 Product Page and the Amethyst 2 Feature List.

Pricing and Availability

Amethyst 2 Ultimate sells for $299 USD. A free 30-day Trial is available. At the end of the Trial period, the software degrades to Amethyst Personal (a free, limited feature version of the software) unless a licence is purchased. Registered users of Amethyst 1 Professional may upgrade for $99.

Bookmark and Share   Keywords:  Amethyst 2  news
Comments:0

The Amethyst 2 Profiler

by Dermot Hogan
New product, new tools
Monday 13 May 2013.

Profiling a Flash application allows you to see which functions are consuming most CPU and, in addition, detect memory leaks. Memory leaks can be quite insidious in Flash as it’s quite easy to allocate, say, an event handler and forget about it

In Amethyst 2, we’ve added a powerful profiling tool that not only allows you to see the amount of memory being used but to track down memory leaks easily. So, to demonstrate this, I’ve created some code that clearly has a memory leak. In the code below, every time a new C4 object is created, a 4MB chunk of memory is allocated and never freed.

Every time a button is clicked a new C4 object is created:

To demonstrate this, I just start the profiler from the Visual Studio Amethyst menu:

The project is built (if required) and launched. After clicking the button a few times, the CPU table looks this this:

And you can see that the C4 constructor and the writeInt method are high on the list. Next, let’s have a look at the Objects table. This gives a view of how many objects of a given class were allocated and how much memory was allocated. Here, you can see that the ByteArray class is the main culprit.

After a few dozen clicks, you can clearly see that we’ve got a problem as shown by the Memory Graph:

But to track this down, we need another tool – the Data Snapshot. A ‘snapshot’ grabs data on all the objects allocated in the Player at a given time. And I do mean all – which makes a snapshot by itself difficult to work with. There’s simply too much data. You can filter out some of the data using the Amethyst profiler ‘filter’ (of which more later). But a much better way to track down memory leaks is to take another snapshot and difference them after some action, such as clicking a button.

Here’s the result of taking another snapshot after two button clicks, and then differencing the two snapshots. You can see the two objects that are new in the second snapshot in the Delta snapshot. Clicking on one of these objects in the tree displays the call stack, and this can then be used to navigate to the source code via a context menu as show here.

The data can be controlled by using a set of ‘filters’. Using these, you can include, for example, all objects starting with flash.utils and exclude everything starting with spark. If you update a filter, it is immediately applied to the incoming data from the target SWF being profiled – you don’t need to restart the profiler.

The filters and other Profiler parameters, such as the memory sampling interval for the graph are accessed and set via a standard Visual Studio property page. These are persisted in the project file for use next time.


This is a preview of the forthcoming version of Amethyst 2 – our ActionScript/Flash IDE for Visual Studio 2012 and 2010. If you buy Amethyst 1.0 for Visual Studio 2010 now you will be entitled to a free update to Amethyst 2 when it is released. See the Amethyst 2012 announcement for more information.

Bookmark and Share   Keywords:  Amethyst 2  development
Comments:0

Amethyst 2 - Conditional Compilation for ActionScript

by Dermot Hogan
Now more like C#
Friday 12 April 2013.

One of the nice things about C# is that is has good conditional compilation support. ActionScript does support conditional compilation but the syntax isn’t great. In Amethyst 2 we have implemented a C# like syntax for conditional compilation.

Conditional compilation gives you the ability to exclude or include chunks of code at compile time. So in C#, you could say

if (x) {
// do something
} else {
// do something else
}

This is executed at run time and the code inside the if statement will be run or not depending on whether x is true.

But you can also do this

#if X
// do something
#else
// do something else
#endif

Here, the ‘do something’ code will only be compiled if the X symbol is defined. Otherwise the ‘do something else’ code will be compiled in. In other words, it’s done at compile time not run time.

ActionScript does allow conditional compilation, but the syntax is peculiar to say the least. For example,

CONFIG::debugging {
// debugging code here.
}

and you define the constant in the compiler’s arguments like this

-define=CONFIG::debugging,true

In Amethyst 2, we’ve implemented a scheme similar to C#, but using just #if, #else and #endif and with no arithmetic – just ’is the symbol defined’ or not.

The text not included is greyed out in the Editor:

You set the symbols to be ‘defined’ in the compilation options

Note that the options are configuration dependent, so that you can have code included or excluded for, say, Release or Debug configurations.

Clearly, the #if, etc., syntax isn’t ActionScript and so if you export it to another IDE or use just the basic Adobe compilers you will have problems. However, even allowing for that we still think that it’s much nicer to have the #if syntax rather than something like //#if - and that’s what we’ve used.


This is a preview of the forthcoming version of Amethyst 2 – our ActionScript/Flash IDE for Visual Studio 2012 and 2010. If you buy Amethyst 1.0 for Visual Studio 2010 now you will be entitled to a free update to Amethyst 2 when it is released. See the Amethyst 2012 announcement for more information.

Bookmark and Share   Keywords:  Amethyst 2
Comments:0

Amethyst 2 and iOS

by Dermot Hogan
going mobile
Wednesday 10 April 2013.

Unlike Android where you can get an Android emulator to run on a PC, you must have a Mac of some sort to run the iOS emulator on. Development can be done either on a PC or on the Mac itself – Parallels works very well in this respect.

Setting up an iOS project is very similar to an Android project. Both are contained within the same Visual Studio project and you can just select which one you want to use. However, because we are developing on a PC and deploying to a Mac, we need to do some extra work.

The main thing is that we need some way of copying and executing commands on the Mac from a PC. There are probably a couple of ways of doing this, but the simplest way we’ve found is to use the PuTTy SSH (secure shell) distribution (http://www.chiark.greenend.org.uk/ ...). To use this, a couple of parameters need to be set so that files can be copied to the Mac and run there:

Fisrt of all, the Mac’s IP address must be defined along with a user name and password. For example,

SHH IP Address: 192.168.1.11

SSH User Name: huw

SSH Password: huw

The location of PuTTy must also be set (this is where plink.exe and pscp.exe are to be found)

SSH Program Folder: C:\Program Files (x86)\PuTTY

A ’remote folder’ also needs to be specified. This is just a working folder on the Mac where files can be copied into from the PC

SSH Remote Folder: airtest

Lastly, the Adobe ADT tool on the Mac needs to be given (this is used to package the SWF and load it into the iOS emulator, phone or tablet)

SSH ADT Command: /AdobeAIRSDK/bin/adt

In the project properties, we also need to set the location of the iOS SDK on the Mac

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk

Here’s the iOS emulator displaying the ActionScript program

And here’s the corresponding Visual Studio breakpoint

Lastly, there’s one other very important thing to do - allow the Mac through your firewall! This took me some time to track down in Visual Studio 2012, the problem being that it all worked in Visual Studio 2010 (because I had done it a few months earlier), but Visual Studio 2012 being a different program, it has to be done again. Initially, I assumed that there was a bug in the Visual Studio 2012 code and spent some time trying to track this ’bug’ down. Eventually, the penny dropped and set the firewall. There’s nothing quite so difficult to fix as a bug that isn’t there!


This is a preview of the forthcoming version of Amethyst 2 – our ActionScript/Flash IDE for Visual Studio 2012 and 2010. If you buy Amethyst 1.0 for Visual Studio 2010 now you will be entitled to a free update to Amethyst 2 when it is released. See the Amethyst 2 announcement for more information.

Bookmark and Share   Keywords:  Amethyst 2  iOS
Comments:0

Amethyst 2 and Android

by Dermot Hogan
Going mobile
Wednesday 9 January 2013.

Amethyst 2 supports Android mobile and tablet devices. The Visual Studio platform deployment mechanism works well with both emulators and real devices.

First, create a new mobile project

Next select the device platform

Here, you can select the Android SDK path and key store files to use in the project. You can also save these as defaults.

Next drag a button from the Toolbox onto the design surface

and double click it to generate an event. Add some code and set a breakpoint

If you now look at the Configuration Manager, you’ll see that the Android ’platform’ has been selected by default (you can change this if you wish) and in addition to the usual Build checkbox, there’s now a Deploy checkbox. If Deploy is checked, the application will be copied into the Android device by the Visual Studio build mechanism.

Selecting Deploy from the Build menu will now build and deploy the application into the Android device (here an emulator)

And here’s the result ... when the button is clicked, the Visual Studio debugger fires and halts at the breakpoint


This is a preview of the forthcoming version of Amethyst 2 – our ActionScript/Flash IDE for Visual Studio 2012 and 2010. If you buy Amethyst 1.0 for Visual Studio 2010 now you will be entitled to a free update to Amethyst 2 when it is released. See the Amethyst 2012 announcement for more information.

Bookmark and Share   Keywords:  Amethyst 2  android
Comments:0

Semantic error detection in Amethyst 2

by Dermot Hogan
Locate problems before they happen
Wednesday 2 January 2013.

Typically, there are two classes of errors in code. The first are ’syntax’ errors, such as leaving a ’{’ out. These are easily detected and fixed. But the second type – ’semantic’ errors’ – where the syntax is correct but the meaning is nonsensical or incorrect can be a good bit harder to spot. We’ve added a number of semantic error checks in the forthcoming version 2 of our Amethyst IDE.

The classic example in C like languages of a semantic errors is the statement

if (x = 2) y = 5;

What is usually meant is

if (x == 2) y = 5;

This peculiar use of ‘=’ and ‘==’ goes right back to the earliest days of C and I think this must be responsible for more accidental errors than any other language construct in existence. Apparently, Ken Thompson (one of the authors of C) was a firm believer in minimising any typing. C was derived from a previous language, BCPL, via an intermediate language, B (and you can already see Thompson’s desire to eliminate any ’excess’ characters in the name of the language!). Thompson reckoned that = being one character shorter than the BCPL assignment operator := was much superior and used that (see http://cm.bell-labs.com/cm/cs/who/d...). Anyway, semantic error checking detects errors in meaning such as this example and flags them using, in Amethyst’s case, green ‘squigglies’.

You can turn on semantic error checking via an editor option:

We’ve included six semantic error checks:

1) Not all code paths return a value

2) A variable having the same name as a parameter

3) A variable being declared but not used

4) Use of an unassigned local variable

5) Assignment in test (that is, the example above)

6) Unreachable code

We’ve also implemented ’coercion’ checks – assigning a Boolean to an integer, for example. However, using Booleans and integers seems to be relatively common in the ActionScript code that I’ve come across. It’s pretty poor programming practise in my view. If you can to do something like that, use a cast to make it explicit. You can see this in the ’assignment in test’ example above where the expression

a =1

yields an integer, but strictly speaking, an ‘if’ expression requires a Boolean value.


This is a preview of the forthcoming version of Amethyst 2 – our ActionScript/Flash IDE for Visual Studio 2012 and 2010. If you buy Amethyst 1.0 for Visual Studio 2010 now you will be entitled to a free update to Amethyst 2 when it is released. See the Amethyst 2012 announcement for more information.

Bookmark and Share   Keywords:  Amethyst 2  development
Comments:0

The Amethyst 2 Outliner

by Dermot Hogan
ActionScript navigation enhanced
Sunday 30 December 2012.

An outliner (or document outliner) is useful in navigating a complex document or piece of code. But it can also be used to restructure a code file, sorting the various types of code fragments – private methods, properties and so on – to provide a more maintainable code base. Here I want to give you some information in the new outliner we’ve created for the forthcoming release of Amethyst 2.

The first thing you need to do is display the Document Outline tool window. This isn’t too obvious: you have to select View, Other Windows, Document Outline in order to create the outliner, though it is persisted in the .suo file when you close Visual Studio, so it will be there when you start Visual Studio up again.

The outline is created from the parsed ActionScript code and remains in sync as you edit or type into the code window:

When you click on an element in the outline, the corresponding code is made visible (scrolled into view if it isn’t already visible) and a margin marker is created to indicate clearly where the corresponding code is.

Right clicking on an outline element displays a context menu. You can do useful things like find references, display the call hierarchy for methods, and create a method ‘bubble’ ( a mini editor that just contains a method’s code). But more interestingly, you can restructure the code. On the context menu, you can see three menu items: Comment Item, Surround with Region and Restructure.

The first, Comment Item, simply comments out the selected item in the code window:

The second, Surround with Region, puts the tags //region //endregion around the item.

The most interesting one, though is the last one, Restructure. Using this, you can group all private methods say, after public methods and additionally ensure that the constructor is the first method in the class. Very useful for code maintenance!


This is a preview of the forthcoming version of Amethyst 2 – our ActionScript/Flash IDE for Visual Studio 2012 and 2010. If you buy Amethyst 1.0 for Visual Studio 2010 now you will be entitled to a free update to Amethyst 2 when it is released. See the Amethyst 2012 announcement for more information.

Bookmark and Share   Keywords:  Amethyst 2  development
Comments:0

Find ALL References in Amethyst 2

by Dermot Hogan
Yes, I really mean ALL References!
Thursday 20 December 2012.

I’ve used Visual Studio for many years now, and over several versions it’s always seemed to me that the Find All References tool could be improved – but it never really has been. So in Amethyst 2, we’ve implemented our own improved version.

There are three aspects that I don’t like to the standard Find All References tool:

- If I’m investigating a problem, I often go down a search ‘trail’. I search for one thing, say a ‘foo’ then I find that I need to search for a ‘bar’. Then a ‘snafu’ and so on. But possibly the problem is somewhere in the ‘foo’ searches – but I’ve lost that and the only search I’ve got visible is the last ‘snafu’ search.

- When I navigate to a search reference in C#, say, I cannot easily see where the reference is in the code. The code is visible all right, but there’s no clear marker indicating exactly where it is.

- I can’t filter the searches by assignment. I often want to see just the places where the variable is assigned to – not the places where it is referenced. This isn’t a problem is you have a handful of references, but it’s a PITA when there are hundreds of the things.

So the first thing we’ve done is keep a history of the searches you’ve made - and you can navigate between them using either a drop-down combo or backward/forward navigation buttons.

The searches are also stored in the Amethyst ScratchPad: clicking on the search will re-execute the search, so that you can quickly locate and run a previous search.

When you navigate to a search location by double-clicking on the search entry in the Find All References tool window, note the arrow in the left margin of the code window. It makes the location of the search item much clearer.

To filter by assignment, just set the Filter assigns combo to ‘yes’:

Since you can’t have too much of a good thing – you can have as many independent Find All References tool windows as you want! Just click the Copy Results button and you have an independent duplicate of the Find All References tool window.


This is a preview of the forthcoming version of Amethyst 2 – our ActionScript/Flash IDE for Visual Studio 2012 and 2010. If you buy Amethyst 1.0 for Visual Studio 2010 now you will be entitled to a free update to Amethyst 2 when it is released. See the Amethyst 2012 announcement for more information.

Bookmark and Share   Keywords:  Amethyst 2  development
Comments:0

The Amethyst 2 Scratchpad

by Dermot Hogan
Pasteboard area for notes and methods
Monday 17 December 2012.

In a previous blog, I described the ‘bubble’ debug editors which we’ve built into Amethyst 2. We’ve also used this style of lightweight editor (or code window) to encapsulate single methods and items of text – a Note.

To hold all these items, we’ve implemented a type of console – the Amethyst Scratchpad. This has three areas – Notes, Methods and Searches.

A Note is created by selecting some text – it can be anything in a code window – and dragging it to the Notes area of the Scratchpad. This will then create a Note editor bubble with the first line used at the Note’s caption:

If you minimize the Note, it will disappear from the main canvas area, but remain visible in the Notes area of the Scratchpad. But the main use of a Note is really that you can drag it from the ScratchPad into any code editor and it will be pasted into the code. Really, it’s a sort of pasteboard allowing you to construct code quickly from blocks of code or documentation.

The next part of the ScratchPad is used to store Method bubbles. A Method is created by selecting Create Method Bubble from the context menu, and it encapsulates just one method. If you pin the Method bubble, it is display as a button in the Methods section of the ScratchPad. Hovering over the pinned method button displays the text of the method.

and clicking on it will restore the Method bubble editor to the place on the canvas where it was originally displayed:


This is a preview of the forthcoming version of Amethyst 2 – our ActionScript/Flash IDE for Visual Studio 2012 and 2010. If you buy Amethyst 1.0 for Visual Studio 2010 now you will be entitled to a free update to Amethyst 2 when it is released. See the Amethyst 2012 announcement for more information.

Bookmark and Share   Keywords:  Amethyst 2  development
Comments:0

The Amethyst 2.0 Debug Canvas

by Dermot Hogan
Unique bubble-based debugging
Tuesday 11 December 2012.

When you’ve got a bug (and I have been known to come across the occasional home grown specimen), there’s often no one technique that will help you track it down. It’s important to have a good array of debugging tools at your disposal. Remember, if all you have is a hammer, then every problem looks like a nail.

One of the problems I find is that the debugging ‘stack trace’ often gives a rather one dimensional, linear view of the problem. It does indeed show how you got to the breakpoint or exception that the debugger is currently halted at. But with the standard Visual Studio debugger, all you can see is the place where you are at the moment.

If you want to see where you’ve been - the code that ran in order to get to the breakpoint - you have to use the Call Stack window to navigate around, and you lose the original view as you do so.

In Amethyst 2, we’ve built a new debugger interface that allows a different view of the code in the stack frames, using ‘bubbles’:

Here, you can see all of the relevant code in the stack frame. Each code bubble contains just the method that is involved in the stack frame with links showing which method was called. You can also move, stack, cascade and minimize the bubbles using either the mouse or a context menu:

If there are a lot of calls in the stack frame, you can minimise all the bubbles that are of little interest and the layout will be recalled next time you hit the breakpoint.

You can also create independent ‘method’ bubbles by clicking on a method header and selecting Create Method Bubble, so that with a complicated piece of code, you can create your own personalized view into the code text:

The bubbles are interactive mini-editors – you can type and edit text. We don’t implement IntelliSense or outlining in bubbles as I would expect most people to do serious editing in the main code window. However, debug tooltips are available,


This is a preview of the forthcoming version of Amethyst 2 – our ActionScript/Flash IDE for Visual Studio 2012 and 2010. If you buy Amethyst 1.0 for Visual Studio 2010 now you will be entitled to a free update to Amethyst 2 when it is released. See the Amethyst 2012 announcement for more information.

Bookmark and Share   Keywords:  Amethyst 2  debugger  development
Comments:0

More Blog Posts...

0 | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 |...

 

© SapphireSteel Software 2014