0 Replies Latest reply on Apr 28, 2011 1:28 PM by Jens Eckervogt

    Problem with browseForOpen() and browserForDirectory()

    Jens Eckervogt Level 1



      How do i open file from browser?


      If i open file than Textinput should to see path and file. How do i know?


      Example: Adobe AIr 2.6 Application.


      I want to develop simple decompiler for Valve Software example bsp2map.


      Code is here:

      <?xml version="1.0" encoding="utf-8"?>
      <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                     import flash.filesystem.*;
                     import flash.net.FileFilter;
                     protected function init():void
                          // Start your Air App :)
                     private var bspFile:File = new File;
                     private var bspFilter:FileFilter = new FileFilter("bsp File", "*.bsp");
                     private var mapFile:File = new File;
                     private var mapFileStream:FileStream = new FileStream;
                              // There are variables for Half-Life ( Gold Source old version ) *.wad, *.mdl, *.spr and more 
                     private var mapFile_textureFile:File = new File;
                     private var mapFile_textureAlginXY:uint = x+y;
                     private var mapFile_textureAlginXZ:uint = x+z;
                     private var mapFile_textureAlginYZ:uint = y+z;
                     private var mapFile_textureRotateX:uint = x;
                     private var mapFile_textureRotateY:uint = y;
                     private var mapFile_textureRotateZ:uint = z;
                     private var mapFile_x:uint = x;
                     private var mapFIle_y:uint = y;
                     private var mapFile_z:uint = z;
                     private var mapFile_entity:String = new String;
                     private var mapFile_bush:Number = new Number;
                     private var mapFile_bush_entity:String;
                     private var mapFile_Specialtexture_CLIP:String = "CLIP";
                     private var mapFile_Speicaltexture_NULL:String = "NULL";
                     private var mapFile_Specialtexture_SKIP:String = "SKIP";
                     private var mapFile_Speicaltexture_HINT:String = "HINT";
                     private var mapFile_Speicaltexture_AAATRIGGER:String = "AAATRIGGER";
                     private var mapFile_Speicaltexture_ORIGIN:String = "ORIGIN";
                     private var mapFile_Speicaltexture_SKY:String = "SKY";
                     private var mapFile_Speicaltexture_BEVEL:String = "BEVEL";
                     private var mapFile_texture:String;
                     private var mapFile_texture_WATER:String = "!" + mapFile_texture;
                     private var mapFile_texture_TRANSPARENT:String = "{" + mapFile_texture;
                     private var mapFile_texture_animate:String = "+" + mapFile_texture;
                     private var mapFile_texture_animate_toogle:String = "-" + mapFile_texture;
                     protected function decompile():void
                          // That is a function for FileStream and File for decompiling function via Map file
                     // Clean your log of decompiled description ...
                     protected function cleanLogClick():void
                          // Remove log from Textarea
                     // Open File from /Steam/steamapps/<username>/half-life/valve/maps/<yourmap>.bsp ...
                     protected function openClick():void
                               bspFile.browseForOpen("Open", [bspFilter]);
                               openBspFile.text = bspFile.nativePath;
                          catch (error:Error)
                               trace("Failed:", error.message);
                     // Choose you to output directory example %userprofile%/myMaps/<yourmap>.map ( decompiled version )
                     protected function chooseClick():void
                          // problem of directory for output *.map
                     // Open about dialog :)
                     protected function aboutClick():void
                          // Open About Dialog
           <s:TextInput left="25" top="30" right="103" id="openBspFile"/>
           <s:Label text="Input for Bsp File:" left="10" top="10"/>
           <s:Button label="Open..." right="25" top="31"/>
           <s:Label text="Output for Map File" left="10" top="65"/>
           <s:TextInput left="25" top="85" right="107"/>
           <s:Button label="Choose..." right="25" top="85" height="22" click="chooseClick()"/>
           <s:Button label="Decompile..." height="22" right="25" top="120" click="decompile()"/>
           <s:Label text="Compile log:" left="10" top="125"/>
           <s:Button label="Clean log" right="123" top="120" height="22" click="cleanLogClick()"/>
           <s:Button label="About..." right="10" bottom="10" height="22" click="aboutClick()"/>
           <s:TextArea left="25" right="25" top="150" bottom="42"/>

      I have been tired. It can not open File?


      Thanks for answer