Help lowering swf filesize
Hiya, I have a flex app which is literally just a tree control, but its coming out as half a megabyte big. Can anyone help me make it smaller?
I think it has something to do with font embedding, but the resources I've found haven't helped too much, as I am a complete flex idiot.
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initVars()" height="400" width="150" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#D4F5FB, #D4F5FB]" themeColor="#FFFFFF" borderStyle="none" borderColor="#FFFFFF">
<mx:Script>
<![CDATA[
//treeXML.send();
[Bindable]
public var userid:String;
[Bindable]
public var userURL:String;
//userid
private function initVars():void
{
userid = Application.application.parameters.userid;
//userURL = "http://url/tree/xml.php?userid=" + 2;
userURL = "http://url/tree/xml.php?userid=" + userid;
workloop();
treeXML.send();
}
private var loopcnt:int = 0;
private function workloop():void
{
if( loopcnt++ > 1)
expandTree();
else
{
// do some work here, call work functions etc
loopcnt++
setTimeout( workloop, 1000); // call this function again after 1 sec until loopcnt = 10
}
//
}
private function expandTree():void
{
for (var i:int = 0; i < mytree.dataProvider.length; i ++)
{
mytree.expandChildrenOf(mytree.dataProvider[i], true)
}
}
[Bindable]
[Embed("../assets/fclose.png")]
private var myFolderClosedIcon:Class;
[Bindable]
[Embed("../assets/fopen.png")]
private var myFolderOpenIcon:Class;
[Bindable]
[Embed("../assets/fclose.png")]
private var myDefaultLeafIcon:Class;
[Bindable]
public var selectedNode:XML;
// Event handler for the Tree control change event.
public function treeChanged(event:Event):void {
selectedNode=Tree(event.target).selectedItem as XML;
var url:String = selectedNode.@nodeURL;
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, '_self'); // second argument is target
} catch (e:Error) {
trace("Error occurred!");
}
}
]]>
</mx:Script>
<mx:HTTPService id="treeXML" url="{userURL}" resultFormat="e4x" />
<mx:Tree
horizontalScrollPolicy="on"
id="mytree"
dataProvider="{treeXML.lastResult.dir}"
labelField="@name"
change="treeChanged(event)"
top="0"
left="0"
right="0"
bottom="0"
borderStyle="none" backgroundColor="#D4F5FB"
defaultLeafIcon="{myDefaultLeafIcon}"
folderOpenIcon="{myFolderOpenIcon}"
folderClosedIcon="{myFolderClosedIcon}"
creationComplete="expandTree()"
dragEnabled="true"
dropEnabled="true"
showRoot="true"
/>
</mx:Application>
Thanks for any help/advice,
Dave