I'm trying to use a variation of the Flash Badge to install an AIR application. Here's what needs to happen:
User clicks "download"
Send a request using URLRequest/URLLoader to my web service to retrieve some information
Pass that information into the AIR app using the install/launch arguments
The problem I'm having is getting the airSWF to do anything after URLLoader is done. Since airSWF.installApplication() must be called within the handler of a user-generated event, it doesn't do anything when it's inside the URLLoader Complete event, and the fact that the original event was user generated doesn't seem to pass through the chain of events.
Is there anything I can do so that the above flow will work?
I've solved this by requesting the necessary data from the server (step 2) right away at the application start.
Not that elegant, since there is no guarantee that the user will click on the download button, and i store the just-in-case data anyway, but it works.
So when the user decides to click on the download button, I check air status, and if it's installed on the machine, i just use the already stored values, and download-->install or launch the application.
Related
I want to transfer information from my website to my electron program by using a link that has some data in it (like myprogram://data). But can't seem to find any info on the internet about this. Any help would be gladly appreciated.
Thanks!
You need to register your app as a protocol handler using app.setAsDefaultProtocolClient
app.setAsDefaultProtocolClient("myprogram")
On Windows, when the "myprogram://data" link is clicked, a new instance of your application will be launched and the arguments will be included in process.argv
Use app.requestSingleInstanceLock if you don't want multiple instances of your app to be running
On macOS, you can get the arguments using the open-url event
I want to unload all used modules when a user logs out of the webside to reset the application. When a new logs into the backendserver with the same running application all lazy loaded modules are still there.
I did some research and seems to me like it isn't possible by now.
Does somebody know a solution or a githublink to the ticket?
I guess unloading my modules was the wrong direction.
Once the chunks are loaded they shouldn't be constructed again.
I register the services in another service. Now when I Logout I call a function which iterates through all the services and calls a function for every service which empties all data by the previous User.
----------EDIT---------
Seeing that this question still get views here is a solution I used for some Apps:
Kudos to user benh80
Resetting the complete App and reloading it:
Resetting Angular 2 App
the whole point of using lazy loading is to load the relevant modules for a component. Once you log out the application it actually loads the modules which need for that component. Hence there is nothing to unload
I have an http handler built and running on my website server. Code in flex generates a http request then navigates to the handler, which generates and streams back file information for the user to download.
Basically the request sends image data and the return result is a pptx stream with the image data in a powerpoint slide.
This worked fantastically this morning until about an hour ago. I have no idea what changed, but every swf I am building which attempts to access this handler is now giving me:
* Security Sandbox Violation *
Connection to https://g1.localhost/Turm/BounceBack.aspx halted - not permitted from https://g1.localhost/Turm/FlashApps/ImageAndExporting.swf?debug=true
I even fully qualified the BounceBack.aspx name (it was a relative url until just now) in case something was confusing the flash player, but as you can see, the url request and the swf are loaded from exactly the same domain (even the same virtual app in the web domain).
I have even added the physical filepath as a 'trusted folder' in my flash player security settings.
What gives? Anyone have any suggestions?
Using the Apache 4.9.1 SDK and latest version of flashplayer.
As mentioned, this worked all day yesterday and this morning. I cannot figure out what has changed, but am having no luck resolving the issue, source code has not changed.
Finally figured out what changed. I move the navigation to my ASPX handler into a seperate method that delays invoation till after a UI update. Becuase I use the same ui components for printing as well as exporting, I tested the updates with the print feature and that worked without error. About an our later, I noticed the handlers were failing. Since the url request is not handled inside a UI interaction event (Like MouseEvent.CLICK) the flash player was preventing the call. Once I moved the navigation back into the event handler, the sandbox violation went away.
If you ask me, not a very good error message due to the actual problem encountered, but ... you learn something every day.
I am currently working in Flex 3.0 I am getting an error(screen shot is given below). I am using Flash Player Version 10.0
Currently I am calling the HTTPService and in the resultHandler of that HTTPService i am getting an error in method filereference.save() . because this method is called only when the MouseEvent or Keyboard event is occured.
Is there any solution to overcome this situation or in other words calling the filereference.save method in ResultHandler.
The reason for this is that you are no longer allowed to automatically trigger the display of file saving popups, except in the event of the user actually requesting this, via an event generated by the user. Here is some more info on the subject: http://www.bogdanmanate.com/2010/05/12/flex-error-2176-when-using-filereference/
I got around this problem using the solution described in the post, namely by using a Yes/No alert, to indicate to the user that the file has finished loading and it is ready for download and finally by asking him to confirm that he wants to save it locally. You might consider thins user-unfriendly, but it's really about security. And once you know how to trigger the event, you can figure out ways of bypassing this UI issue.
Have a great day!
You cannot. You need a click button of the user to get it done. Dispatching a MouseEvent is useless. Romi approach coud help you. But you need for security reasons to made it for a button click.
What I did.. was in the result retrive the file location and open it like an html page. Then you can download it. I see no other solution than forcing the user to click a button like Romi said.
var u:URLRequest = new URLRequest(event.result);
navigateToURL(u, "_blank");
An alternative solution might be to send the file to the server, then have the server send it back to the client which should trigger the browser's save/open dialog box. But if the file is created by flex then this is not ideal bandwidth-wise.
WHat is the standard method for say a server to update an already loaded SWF on the client browser, i.e. something analogous to how an html page is partially updated via ajax (though I don't know a lot about ajax yet either.) Would the mechanism be the same if user-initiated.
I assume the .SWF should have public functions that can be invoked, then you'll use javascript to access the swf from the html page its in, then invoke a public function of that swf.
Just the specific terms or functions I need to search for to get a primer on this would be great.
ALso, How would one go about testing the public functions of an swf that is already loaded in a browser (wihtout having a full Adobe devleopment suite for example).
This is quite a vast subject actually. This is the whole RIA concept. Flash can look after itself in terms of communicating with a server , you don't necessarily need Javascript. You only need a server side language to communicate with.
Since it all can happen within the swf , public functions don't really come into it. A User initiates an action in the movie that triggers a call to a remoting service which in turn sends a response which consequently updates the movie.
A few areas you can look into, in no particular order:
Flash PHP communication
Zend Amf Server ( Zend Framework )
http://framework.zend.com/
For testing purposes , try MonsterDebugger
http://gotoandlearn.com/play.php?id=109
Edit:
Flash can use PHP to retrieve a XML , then parse the XML & change the data inside the SWF according to the data retrieved in the XML
http://gotoandlearn.com/play.php?id=90
In case of a link, the concept is a bit different, because depending on the type of link this may cause a page refresh. The approach in the above tutorial could be user initiated by clicking on a swf element, entering text in a text input box etc... this is what I meant by the RIA concept. It's quite standard now in Flash that user interaction will introduce changes in your SWF by making calls to the server.