I think the issue here is a matter of semantics. So.. A substack is by definition a sub of the main stack, IE part of the stack. There is an option in standalone preferences to break out substacks into their own separate stack files (In which case they are no longer substacks they're mainstacks in their own right.. if I understand this correctly) and yes if you make a splashstack that a) copies the stack you want to be able to save from engine to the documents folder then yes it should be able to open it and save it as you are talking using the splashstack. But its not a substack at that point.
I don't let the engine split stacks for me, I just make the splash and then setup separate stacks by hand and add them with the copy files pane.
Did a test, created a splashstack (that I don't leave up long enough to notice) added a stackfile to the copy files pane, put in an openstack handler (might work with preopenstack) and it works ok. So yes if you want to store data in a stack file it works.
Of course flat files and databases work equally as well.
The script I use to flip to the second stack is this:
on openstack
if there is not a file (specialfolderpath("documents") & "/mystack.dat") then
--you would probably want to create a folder and place the stack file in there instead of the document root like I did. DOH
put URL ("binfile:" & specialfolderpath("engine") & "/mystack.dat") into URL ("binfile:" & specialfolderpath("documents") & "/mystack.dat")
end if
open stack (specialfolderpath("documents") & "/mystack.dat")
send "closeme" to this stack in 50 milliseconds
end openstack
command closeme
close this stack
end closeme
For testing I just put a field with a "textchanged" handler in it so that every time the text is modified the stack saves itself. Works like a charm.
If you do things this way make sure you force the inclusion of all externals that are needed for your app in the splashstack.
Also note, if you're planning on doing something like this for IOS too i'm not sure what apple would have to say about it or if its allowed.
Also,
townsend wrote:Thanks for the correction Mark-- Klaus--
Just trying to be helpful. Now I've learned something important.
Only desktop deployments can save and retrieve sub-stacks.