jump to navigation

Display with Actionscript the swf size/name in Flex 3 August 30, 2010

Posted by Tournas Dimitrios in Flex.
trackback

An alternative approach to detect with Actionscript the created swf size/name in Flex is :

<?xml version="1.0" encoding="utf-8"?>
<mx:Application  xmlns:mx="http://www.adobe.com /2006/mxml" layout="vertical" applicationComplete="init()">

    <mx:Script>
        <!--[CDATA[-->
            private function init():void {
   var appInfo:LoaderInfo = Application.application.loaderInfo;
  /* Just grab the filename from the SWF URL. */
  var fileName:String = (appInfo.url).split("/").pop();
  /* Convert bytes to kilobytes. */
   var kbTotal:String = (appInfo.bytesTotal / 1024).toFixed(2);
  info.text ="The file name /size  is :   " + fileName + " (" + kbTotal + "kb)";
/* Or debug Your project to display the information */
trace("The file name of your swf is :   " + fileName + "       and the size is :  " +" (" + kbTotal + "kb)");
            }
        ]]>
    </mx:Script>
<!--
Just embed this image to increase your swf file size
-->
<mx:Image source="@Embed(source='assets/bgoverlay.jpg')" />
  <mx:ApplicationControlBar dock="true">
  <mx:Label id="info" />
    </mx:ApplicationControlBar>

</mx:Application>

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s