A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: AIR: Opening your file type?

  1. #1
    Senior Member
    Join Date
    May 2009
    Posts
    280

    AIR: Opening your file type?

    I've got this app that processes what I call "packs". (which are essentially just zip files).

    Course, im going to give them the extension .sfxpack or something. Anyway, what im trying to get at is this. Is there any way to have my app open those types of files by default and run a certain function when it is opened?

  2. #2
    Senior Member
    Join Date
    Dec 2010
    Posts
    121
    You are looking at ByteArray here. It's possible and loads of people have done it, it's just very hard though. You are going to have to write decoders and encoders for your file type. Have a look at http://developer.longtailvideo.com/t...oder.as?rev=88 to see the how Adobe put together their JPG encoder.

    Look at these resources to get started with ByteArray:
    1. http://www.bytearray.org/?p=711
    2. http://tv.adobe.com/watch/fitc/bytea...for-beginners/ (watch this first)
    3. http://help.adobe.com/en_US/FlashPla...ByteArray.html

    If you have background in C/C++/C# then you would have heard of byte array and have worked with them before. SFXPACK seems to be a sound effect formats. If you want your pack to be able to be opened by other programs as well, you will have to look into their file format structure.

  3. #3
    Senior Member
    Join Date
    May 2009
    Posts
    280
    Quote Originally Posted by flashmed View Post
    You are looking at ByteArray here. It's possible and loads of people have done it, it's just very hard though. You are going to have to write decoders and encoders for your file type. Have a look at http://developer.longtailvideo.com/t...oder.as?rev=88 to see the how Adobe put together their JPG encoder.

    Look at these resources to get started with ByteArray:
    1. http://www.bytearray.org/?p=711
    2. http://tv.adobe.com/watch/fitc/bytea...for-beginners/ (watch this first)
    3. http://help.adobe.com/en_US/FlashPla...ByteArray.html

    If you have background in C/C++/C# then you would have heard of byte array and have worked with them before. SFXPACK seems to be a sound effect formats. If you want your pack to be able to be opened by other programs as well, you will have to look into their file format structure.
    Well, since its a zip file i'm just going to use fzip to parse it and any necessarily files that are in it (the xml with all the detail along with any image previews in the _image folder). All I want to be able to do is have my air app launch when a user double clicks on a anyFileName.sfxpack file and run a function to handle the file (install it or preview it)

    Also its not sound its just my username lol.

  4. #4
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    In your air config file (eg. sfx-app.xml) look for the <fileTypes> tag near the bottom. Uncomment that and you can declare specific file extensions that will register with your app. Yours should look something like this:

    PHP Code:
    <fileTypes>
        <
    fileType>
            <
    name>SFX Pack</name>
            <
    extension>sfxpack</extension>
            <
    contentType>application/octet-stream</contentType>
            <
    icon>
                <
    image32x32>sfxIcon32.png</image32x32>
                <
    image128x128>sfxIcon128.png</image128x128>
            </
    icon>            
        </
    fileType>
    </
    fileTypes
    Also - I believe this only takes effect when you install a release build via the air installer so don't be surprised if this is hinky in the debugger.
    Please use [php] or [code] tags, and mark your threads resolved 8)

  5. #5
    Senior Member
    Join Date
    May 2009
    Posts
    280
    Quote Originally Posted by neznein9 View Post
    In your air config file (eg. sfx-app.xml) look for the <fileTypes> tag near the bottom. Uncomment that and you can declare specific file extensions that will register with your app. Yours should look something like this:

    PHP Code:
    <fileTypes>
        <
    fileType>
            <
    name>SFX Pack</name>
            <
    extension>sfxpack</extension>
            <
    contentType>application/octet-stream</contentType>
            <
    icon>
                <
    image32x32>sfxIcon32.png</image32x32>
                <
    image128x128>sfxIcon128.png</image128x128>
            </
    icon>            
        </
    fileType>
    </
    fileTypes
    Also - I believe this only takes effect when you install a release build via the air installer so don't be surprised if this is hinky in the debugger.
    Alright. How exactly does it handle it though? Do I get to tell my app what to do with it?

  6. #6
    Senior Member
    Join Date
    May 2009
    Posts
    280
    help?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center