Enable Advanced Telemetry on Flex or old SWFs with SWF Scout Enabler

Posted on December 12, 2012 | 57 comments

UPDATES:
v1.0.7 – Added SWF Scout Disabler mode to allow you to remove SWF telemetry tag from SWFs. SWF Scout Enabler title is the toggle, see below.
v1.0.5 – Added command line feature provided by Daniel Bunte.

Adobe Scout allows developers to profile SWFs like never before. The telemetry data sent by the release Flash Player to Adobe Scout is by default only set to send basic telemetry data. To be able to see data for the AS3 sampler, Stage3D rendering, and DisplayList rendering you have to enable the SWF (password is optional).

This is done by using the newer asc2 compiler that comes in Flash Builder 4.7 or in the AIR sdk found in the Gaming SDK from Creative Cloud. Currently asc2 only works with ActionScript projects and implements a new flag called -advanced-telemetry or a check box in Flash Builder 4.7 ActionScript project properties.

To enable SWFs that don’t use asc2, mainly Flex apps or legacy SWFs, you need to use a script to write a specific SWF tag into the SWF file. This doesn’t change the SWF abc code but just adds a SWF tag that Flash Player will use to start sending telemetry data. There is a python script written to help with writing this tag. But the python script requires python and I wanted something a bit easier to use so I created SWF Scout Enabler.

To use the application all you need to do is drag your SWF into the application and it will create a new SWF (or override if you give it a “” suffix) that is enabled for advanced telemetry.

The application will also save the last suffix and password used. It also has the ability to re-process the last processed file by clicking on the top right box image.

There is a new feature (as v1.0.7) in SWF Scout Enabler now. You can turn it into SWF Scout Disabler, meaning it can be used to remove the SWF telemetry tag as well. By clicking on the title label “SWF Scout Enabler” it will toggle back and forth between the two features. Here is what it looks like when in SWF Scout Disabler mode.

Last but not least, the full source of the application can be found on github.

Download the SWF Scout Enabler AIR application.

I need to thank Joseph Labrecque for testing out the app.

Note: This app has been tested on a bunch of SWFs but if it is not working let me know. There seems to be a bug with Adobe Scout on AS2 SWFs older than version 8. Adobe Scout will never do ActionScript sampling on AS2 SWFs but it will do basic telemetry.

  • http://bitstrips.com dk1

    Awesome, thanks!

  • http://www.facebook.com/people/Sergey-Shwyrev/100000158423739 Sergey Shwyrev

    It’s wonderful!!! Thank you, thank you so much!!!

  • http://www.facebook.com/gilamran Gil Amran

    How do we test AIR apps?

    • renaun

      Just double click on the AIR application and it will install like a normal application.

  • Pingback: TelemetryEASY – Advanced Telemetry Utility for Adobe Scout | In Flagrante Delicto!

  • Peter

    Great job~ Renaun~

  • Pingback: Make your SWF profilable with Scout - ByteArray.org

  • http://twitter.com/abiyasasuhardi I. Abiyasa Suhardi

    Great, thanks for the tools :-)

    On my windows7 machine, I found out that the underscore character is not displayed correctly on the textinput. It’s not a big deal ;-)

    • renaun

      Thanks for the comment, the bitmap font didn’t have that glyph in it. Will update that.

  • renaun

    The SWF in the apk needs to be enabled before packaging.

    Then you will want to look at the Adobe Scout companion application to configure the application’s options:

    For iOS: https://itunes.apple.com/us/app/adobe-scout/id562450748?mt=8

    For Android: https://play.google.com/store/apps/details?id=com.adobe.monocle.compan ion

  • Phillip Kerman

    this helps–but, because I’m lazy and hate to break things working–can you provide a step-by-step to replace the compiler and add the extra flag to, say, flash builder 4.6?

  • marzsman

    Would be great if we could use this from the command line.

    • renaun

      AIR still requires a window so do you want command line on a linux headless box? if so use the python script.
      If not, i’ll think about adding the invoke event and allowing for command line air invocation.

      • marzsman

        I was thinking about adding this step to the Run/Debug configuration in Intellij IDEA

      • marzsman

        Ok, got it working with the python script in Intellij IDEA, thx anyway!

      • http://www.facebook.com/DuncanConroy Daniel Bunte

        I just sent you a pull-request for my cmd-line addition.
        I also used the python script before, but it’s really really slow (takes up to 20-30 seconds).

        • renaun

          Cool I’ll take a look

  • Jim

    Thank you! BTW, is there a way to test ipa on iOS device which was published by Flash Builder 4.6?

    • renaun

      You would have to fix the SWF and then do the compile with the command line. You might try turning off the properties -> builders -> flex, then enable swf, the package through FB. Turning off builders flex that keep it from compiling and just do the air builder step.
      Also look for the Adobe Scout companion app.

  • Pingback: @renaun posts: Using Adobe Scout on Mobile without the Scout Companion App

  • numberonesuperguy

    This works great with a small demo app built within Flash Builder 4.0, but I have a problem with the SWFs we create with our Ant build, using Flex 3.5.

    The SWFScoutEnabler doesnt complain… any ideas why Scout still claims it doesnt have the flag set?
    I also pass a supporting SWF (localisation) to SWFScoutEnabler.

    (would Scout complain about dynamically loaded SWFs that dont have the flag set?)

    • renaun

      All SWFs need the flag so yeah dynamically loaded SWFs would need it too.
      Does the the first Flex 3.5 SWF show up with advanced telemetry set?

      • numberonesuperguy

        The first SWF is the main app, and I get no telemetry at all (just the line advising to recompile with it on).

        The SWF is built and packaged into an EAR by Ant and Flex 3.5, and unpackaged by a running JBoss app server (v4 or 5 I think). I find the unpacked SWF and confirm its the newly built one by the modified time. I drag and drop it to SWFscoutEnabler, I can see the modified time is updated, but when I start the web application Scout tracks it but says there’s no telemetry.

        If I’m the only one with no success with Flex 3.5, perhaps I need to see if JBoss has another temporary file store somewhere else.

        Ps Thanks to Scout I’ve optimised the hell out of AmCharts (3rd party charting library) in the time it took to redraw 1,000 items it now does 20,000. Awesome!

        • renaun

          What Flash Player are you running the SWF in? It needs to be 11.5+

          • numberonesuperguy

            It was 11.4-debug, tried again with 11.5-debug, and searched for all SWFs from high up in my heirarchy, and restarted JBoss (to avoid possible memory caches).

            Still no telemetry in Scout!

            Its not a publicly available app, so is there a useful hex view I could look at or could possibly pass the SWFs securely to you?

          • renaun

            email me at renaun at adobe dot com

          • numberonesuperguy

            Many thanks – I can confirm Scout and SWFScoutEnabler work perfectly fine for Flex 3.5 built projects.
            (my issue was probably down to my build process)

  • mark goldin

    I have enabled a SWF file using your enabler but get no telemetry in Scout. Any idea?

    • renaun

      Need to check password or port, I assume you are using 11.4+ runtime and the swf version is > 13.

      • mark goldin

        Well, I am getting some profiling data. That means a port is fine, right? I am using FP 11.6. But what is “swf version is > 13.”?

        • renaun

          If you are using a newer compiler (mxmlc or asc2) you will be compiled with swf version > 13.

          If you can send me a link to SWFs (before and after) I can do a quick check to see if there is anything obvious. Or you can email at renaun at adobe dot com.

          • mark goldin

            I think the problem is that I am not using actionscript projects but regular Flex projects.

          • renaun

            Flex SWF can be enabled just fine, thats what this tool is meant to help with.

          • mark goldin

            Yes, Scout is showing my SWF file and some data. But No Actionscript is shown.

          • renaun

            I need to take a look at the SWF

  • http://twitter.com/Ultima2876 Dave Fleming

    Just wanted to say thanks for this. It’s great :)

  • renaun

    Not from the command line, but my SWFScoutEnabler should work fine.

  • abeltan.09

    =)

  • Adam

    awesome!!!! Thanks!

  • Ivan Maran

    Hi! There is a problem packaging swf processed with SWF Scout Enabler tool. I build my Flex Mobile project, then enable anvanced telemetry in resulting swf file with your tool. And If I then test it locally (run in FB with Scout working) everything just works fine. I can see action script methods calls in Scout etc. But after packaging (using “Export release build”) to ipa file and loading it to the device, I cant see advanced telemetry output in Scout (while basic telemetry is going OK). So, somehow this advanced telemetry flag previously set up by Scout Enabler is removed by packaging tool. Do you have any idea whats going wrong?
    Thanks..

    • renaun

      Export for release will compile a new SWF them ipa. Which doesn’t allow you to add the telemetry SWF tag.
      Sent from a device

      • Ivan Maran

        Does any workaround for this exist?

        • renaun

          Maybe the the command line

          Sent from a device

          • Ivan Maran

            Thanks for your reply!

          • Ivan Maran

            Well, I’m happy to tell that the command line approach really helps. I created my release quality swf using “Inermediate AIRI package that must be manually signed later” option (Export Release Build window). Then applied Scout Enabler and used adt tool like this:
            adt -package -target ipa-ad-hoc -sampler -storetype pkcs12 -keystore [cert ificate path] -storepass [pass] -provisioning-profile [profile path] My.ipa My-app.xml My.swf
            (note the -sampler param)
            ..install ipa on device
            …and it works! Shows ActionScript calls and all advanced telemetry staff in Flex Mobile project.

            But you dont really need to lauch adt from command line. You may use FB Instead, just define ‘sampler’ param in your Customize Launch Parameters window.
            Apply Scout Enabler to swf when release swf is ready (normally after you press Next on first “Export Release Build” screen) and let FB launch adt for you. That’s it!

          • renaun

            Cool thanks for sharing

            Sent from a device

  • István

    Hi, the Scout shows nothing for me. I use Maven with FlexMojo 3.9, with Flex SDK 4.5.1.21328. The player is Adobe Flash Player Debuger 11.7 r700.224. Minimum flash version: 13. ActionScript Version 3. After I use the SWF Scout Enabler, the Scout shows on the Session Info panel that the Advanced Telemetry is enabled, but shows nothing. Can you help me? I can send the swf file. Thank you!

    • renaun

      You might need to set a swf-version as well. What OS /browser are u using?
      Sent from a device

      • István

        The 4. byte of the swf is #14 = 20, so the swf version is ok, I think. Windows 7 64bit with Windows Flash Player 11.7 Projector content debugger. Not in browser. There is same effect in browser.

        • renaun

          Send me the SWF file and I’ll try it it out, send to renaun at adobe dot com

          • István

            Thank you very much, I sent it.

          • renaun

            Looks like your swf had frames where no memory was being allocated. Please select enough frames to have data show up.

  • Torbjørn Caspersen

    I’m having problems after updating from the first prerelease of Scout to the Adobe Scout CC version. After updating, my swf enabled with scoutEnabler will hang shortly after loading. If Scout is not running, the swf runs fine. This is on OS X/Safari.
    This most probably is a bug in Scout, not the enabler, but still worth mentioning. Any one else with the same problem?

    • Mihai Pricope

      Had the same problem but I found these 2 workarounds:
      - upgrade to AIR 3.7
      or
      - disable Memory Allocation Tracker

      • Ivan Maran

        To note

        you should update to the latest AIR 3.7 SDK release build available, otherwise Scout CC may crash your app when Memory Allocation Tracking is turned on.

  • Ti nk

    Any chance I can get the SWC with CModule, ram and flascc_compressLZMA in it?

    I can’t install you app, as I don’t have Admin rights, so have rebuilt it added the ability to select a directory instead of a file so that it updates every SWF in the directory, but I also can’t install flasCC and therefore can’t compile the SWC for these 3 class.

    • renaun
      • Ti nk

        Bugger, couldn’t see the wood for the trees. Thanks!

        • renaun

          Np, and do share the code if you make it more useful I could always integrated it in the next version :)

          • Ti nk

            We have around 450 SWF’s in our project so I just wanted something that would add/remove the flag from them all. Not sure how easy it is to share code on these comments but here goes.

            On the Event.Select of the FileReference I just build up a list of all the SWF’s in the directory and sub directories, and display them in a List control.

            var paths:Array = new Array();
            processDir( 0, _file, paths );
            _paths = new ArrayList( paths );
            list.dataProvider = _paths;

            private function processDir( depth:uint, file:File, paths:Array ) : void
            {
            var files:Array = file.getDirectoryListing();
            var f:File;
            for ( var i:uint = 0; i < files.length; i++ )
            {
            f = files[i] as File;
            if ( f )
            {
            if ( f.extension == "swf" )
            {
            paths.push( { label: StringUtil.repeat( " ", depth * 2 ) + f.nativePath, file: f } );
            }
            else if ( f.isDirectory )
            {
            processDir( depth + 1, f, paths );
            }
            }
            }
            }

            When u click a button I check whether you have selected any items in the list. If you have it's only those that are processed. If there is no selection all are processed.

            protected function button2_clickHandler(event:MouseEvent) : void
            {
            if ( list.selectedItems && list.selectedItems.length )
            {
            _listToProcess = list.selectedItems.concat();

            }
            else
            {
            _listToProcess = Vector.( _paths.source );
            }
            _count = 0;
            _total = _listToProcess.length;
            if ( _total > 0 )
            {
            enabled = false;
            addEventListener( Event.ENTER_FRAME, onEnterFrame, false, 0, true );
            }
            }

            and then I run the process over a number of frames to stop the app freezing up.

            private function onEnterFrame( event:Event ) : void
            {
            var swfTagHelper:SWFTagHelper;
            const numItems:int = 20;
            for ( var i:int = 0; i < numItems; i++ )
            {
            if ( _count < _total )
            {
            swfTagHelper = new SWFTagHelper( File( _listToProcess[ i ].file ), addOrRemove.selected );
            swfTagHelper.addEventListener(ErrorEvent.ERROR, errorHandler);
            var success:String = swfTagHelper.process( "", "" );
            if ( success != "" )
            {
            // errorText.text = "Success: " + success;
            }
            swfTagHelper.removeEventListener(ErrorEvent.ERROR, errorHandler);
            }
            else
            {
            enabled = true;
            removeEventListener( Event.ENTER_FRAME, onEnterFrame, false );
            break;
            }
            _count++;
            }
            }