0
votes

The aim is to debug AS2 outside the Flash CS6 IDE. It's from within a game that uses quite a number of imported classes. My knowledge of AS2 is limited at best, thus it currently appears fruitless engendering simple tasks common in other languages such as writing to a text file or even just displaying the contents of a variable, which is required here. Any easy way around it?

The game is a non-HTML affair and uses some scaleform objects. Say for example a frame is created in a new text object pasted with the text tool. and this in Actions:

var displaytext = _root.attachMovie("coords", "coords" + root.getNextHighestDepth(), _root.getNextHighestDepth());
 displaytext.innerText.text = "hi";

In the class:

class coords extends MovieClip {

    public function coords() {
        // constructor code
    }

private var innerText:TextField;

function SetText(text)
{
        innerText.text = text;
}
}

But nothing shows up in game.

1

1 Answers

2
votes

To debug your swf outside Flash IDE, you can use ExternalInterface.call() to call any javascript function in your HTML page, you can do like this for example :

ExternalInterface.call('console.log', 'your debug text'); 

This will show your text directly in the console log of your browser, of course if your browser didn't support console.log you can use any other method to get your text like this :

AS 2 :

ExternalInterface.call('log', 'your debug text'); 

Javascript :

function log(message){
    document.getElementById('log').innerHTML += '<br>' + message;
}

You can also use the Flash Player log file (flashlog.txt) to get all your trace statements saved into an external text file. For that, you have to enable the debugging for your swf ( from Flash IDE Publish Settings ) and to use a Flash Player debug version ( which you can get from here ) and then you can take a look on my answer of this question to get your flashlog.text.

If you are testing locally, take a look on my answer of this question to avoid some Flash Player security issues.

Hope that can help.