I need somehow to merge flash site into one executable.
Site consists of: index.html images sounds pdfs etc.
After clicking on a merged file, index.html is needed to be opened.
Is this possible?
=================开发者_如何转开发====================
Adobe AIR might be useful for this, but I can only create setup executable, maybe it is possible to create just executable?
You can pack any number of files into AIR app (although export time may rise substantially). You can't create 'just' executable, because AIR apps need to be installed and HTMLLoader will need separate files for pages and pictures anyway. Basically, all you need to do is:
- create AIR with mx:HTML as main content
- point mx:HTML to app:/index.html
- make sure your site files are embedded en masse into installer (put them into src dir)
For pdf files to work in the browser, user need Acrobat installed. Flash content should work inside mx:HTML.
Update:
Hide all files from user is harder. I did something similar though, not entire site, but application with embedded pages and links.
All your content can be packed into some zip file (not in exe, even native AIR application cannot customize its exe wrapper.) You can even encrypt each file if you wish. The problem is links and files (pictures, styles and scripts.)
I solved pictures problem with data URI scheme (see my question - self-answered - about this.) I think other files can be embedded this way too.
To make links working, you need to listen to Event.LOCATION_CHANGE. New location will tell where HTML control wants to go (it will not be able to find page), unzip corresponding page and set it as htmlText.
So, if you really wish to embed everything, that's what I would do:
- Pack all your files into one zip file for later unzipping using some library with non-sequential zip access (I used coltware's airxzip)
- Make page serving system. This includes unpacking page, scanning it for used files (css, js, pictures), unpacking files, converting them into base64 and embedding into page with data:URI scheme. If your files aren't (or rarely) shared between pages, you can embed them before packing and use as is. I don't know if Webkit supports JavaScript via this protocol, even if not, you can convert it to text based script.
On OS X you can compile it into an .app, which is a special folder behaving like a single executable. I guess this is going to be different on each platform, maybe the best solution is to look for some cross-platform framework which can also bundle a WebKit based browser view so you don't have to deal with different browsers and how they access external files on each platform.
Having wrote this, AIR might be able to bundle files and it has a StageWebView
control which can display HTML content (not sure about displaying Flash inside).
精彩评论