I have an adobe desktop AIR app. When I send some data with a local connection, I want the app in front of all the other windows with focus on it.
I tested on a brand new air app with just this code:
import flash.display.NativeWindow;
var window:NativeWindow = stage.nativeWindow;
var aspa = setInterval (activateWin,8000);
function activateWin (){
trace("Activate window");
window.activate();
clearInterval(aspa);
}
And nothing happens. While if I write:
window.alwaysInFront=true;
window.alwaysInFront=false;
It brings the app to the front, but this command gives no focus to the window.
If I add
NativeApplication.nativeApplication.activate(stage.nativeWindow);
This makes the status bar icon blink, but still no focus or front action.
Reading this page, it seems it should work.
Am I missing something?
I've just use
window.activate();
window.alwaysInFront = true;
window.alwaysInFront = false;
and it's works fine on windows and mac os
Related
I have tried giving dialUp dial Up
This works fine in android phones but doesnot work in Windows.
Any work around for this. I tried onclick.
Even That doesnt work
There is no embedded "Call Button" in Windows Phones. If you mean to trigger Phone Call task, which will call a number/person, here's how:
PhoneCallTask phoneCallTask = new PhoneCallTask();
phoneCallTask.PhoneNumber = "123456789";
phoneCallTask.DisplayName = "TestNumber";
phoneCallTask.Show();
I'm having a problem getting bing.com to load in a WebBrowser control on Windows Phone 8. It seems that doing that will launch the WP8 Search App (same as pressing the Search button on the phone). The problem is, once you click a result in that search app, it doesn't take you back to your original app - it goes to IE to show the result. This isn't going to work for me and seems to be a massive flaw (IMO) in the WebBrowser behavior.
There does seem to be a few apps out there that have succeeded in being able to show bing.com without launching the phone's search app - for example Image Downloader Free. There was another one, but I can't remember what it was...
After some research, I've found that the WebBrowser_Navigating event gets fired 3 times when going to bing.com: first request to the user-entered URL (www.bing.com), it then gets redirected to http://wp.m.bing.com/?mid=10006, then it redirects to bing://home/?mid=10006.
Preventing it from forwarding to the Bing search app is quite simple, just add this to the Navigating event:
e.Cancel = (e.Uri.Scheme == "bing");
The problem is, it then only shows the Bing search page place holder which says "Bing Search" and has a link that says "Back to Bing search" which does nothing (it would typically relaunch the Bing Search app).
I have a few thoughts, but I'm not sure how feasible they are.
In the WP8 WebBrowser control, is it possible to fake the User Agent?
Can one of the items in the WebBrowser.Uri.Flags property be removed or added to affect the way Bing.com handles the request?
If none of those work, I can simply create a dummy page on my web server, redirect all bing.com requests to it, and have it grab the m.bing.com front page with a card-coded user-agent. I really would like to avoid having to do this option though. From an End-User perspective, they would never know, but I just added a whole new layer of overhead, maintenance and resource-wise.
If you're interested, attached are the diff's for the EventArgs object between the 3 requests that occur in the WebBrowser.Navigating event:
Request 1 (bing.com) -> Request 2 (forwarded to wp.m.bing.com/?mid=10006)
Request 2 (forwarded to wp.m.bing.com/?mid=10006) -> Request 3 (forwarded to bing://home/?mid=10006)
tl;dr Does anyone know of a way to prevent www.bing.com from causing the search app to launch in the WebBrowser control in my application?
Thank you!
I don't know if there's a better way to handle this, but I found a solution. I haven't gotten it to work perfectly when the back button is clicked, so I will update my answer if/when I found a more solid solution. I still think this is a big flaw in the WebBrowser control in WP8.
Here is the code:
private bool _customHeaderRequest = false;
private void MainBrowser_Navigating(object sender, NavigatingEventArgs e)
{
string host = e.Uri.Host.ToLowerInvariant().Trim();
if ((host == "bing.com" || host.EndsWith(".bing.com")) && !_customHeaderRequest)
{
e.Cancel = true;
Dispatcher.BeginInvoke(() =>
MainBrowser.Navigate(e.Uri, null,
"User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; NOKIA; Lumia 710)\r\n"));
_customHeaderRequest = true;
return;
}
_customHeaderRequest = false;
}
private void MainBrowser_Navigated(object sender, NavigationEventArgs e)
{
_customHeaderRequest = false;
}
I don't have access to my emulator, but I tried it on my phone, and:
The redirect doesn't happen when you "Prefer desktop version" and open m.bing.com. Warning: The mobile version isn't very pretty.
Try disabling scripts on your WebBrowser, that could stop the redirect from happening.
Any chance you could just use Google?
First of all I am a total noob so I apologize if this is a dumb question. I am building a Flash site that is designed to be used offline, on a private network. I have successfully linked PDF files, which Safari opens in the browser. This is fine because the file can still be saved from there. However, now I am trying to link .zip files and .mp4/.mov files and am encountering some issues.
Firefox and Safari both try to play the movie files in the browser, but I would prefer for the Open/Save dialog box to appear. As far as .zip files, Firefox prompts the dialog box, which is what I want; in Safari, a new window appears yet nothing happens. The activity window says "Frame Load Interrupted." I have researched this issue and tried tinkering with Safari settings but nothing has worked, nor am I sure it's solely a Safari issue, or if there is something I can do with the Actionscript to prompt the download dialog box. I have seen some different code options for file downloads but wasn't sure how to implement them correctly, or if that was even necessary in my case. Right now I am most familiar with URLRequest and have successfully used the two following configurations:
1)
var zipURL:URLRequest = new URLRequest("../Folder/Folder/Folder/Folder/Archive.zip");
function launchdownload(event:MouseEvent):void
{
navigateToURL(zipURL, "_blank");
}
btn_name.addEventListener(MouseEvent.CLICK,launchdownload);
2)
var request:URLRequest;
var localRef:FileReference;
btn_name.addEventListener(MouseEvent.CLICK,downloadFile);
function downloadFile (evtObj:Event):void
{
var Location:URLRequest = new URLRequest
("../Folder/Folder/Folder/Folder/Archive.zip");
navigateToURL (Location, "_new");
}
If anyone can help me to get around the Frame Load Interrupted issue and/or show me how to properly code my download button such that I can force the Open/Save dialog in all browsers, I would greatly appreciate it! Thank you so much!
You could also let ActionScript do the downloading.
If you add the following code you get a dialog box that lets you select a location to download your file and downloads it.
btn_name.addEventListener(MouseEvent.CLICK,downloadFile);
function downloadFile (evtObj:Event):void
{
var Location:URLRequest = new URLRequest();
Location.url = "http://www.example.com/image.jpg";
var fr:FileReference = new FileReference();
fr.download(request);
}
I want to create an AIR application in which i need to show the notification that when AIR application is minimize then at some interval of time message shows from the system tray similar like giving information.
I have visited this LINK, its a nice component but tutorial is not that much good as component. I need to create a component like that or source is available from this site so modification in this component will also be acceptable. so please help me.
EG: When you minimize the Yahoo Messenger and some one is sign-out or sign-in then it gives notification i want component similar like that...
Thanks in Advance
First Step, We have created a Custom Popup control for Notifications display.
In the second step, we have controlled the display of that popup using the following code
if(!this.stage.nativeWindow.visible || this.stage.nativeWindow.displayState == NativeWindowDisplayState.MINIMIZED)
{
stage.nativeWindow.alwaysInFront = true;
fadeTimer = new Timer(5000,1);
fadeTimer.start();
fadeTimer.addEventListener(TimerEvent.TIMER_COMPLETE, fadePopUp);
popUpWindow = new PopUpWindow();
popUpWindow.isAlerts = true;
popUpWindow.Message = "<b>You have "+event.numNewMessages+" new notification messages<b>";
popUpWindow.type = NativeWindowType.LIGHTWEIGHT;
popUpWindow.open(true);
popUpWindow.fadeInEffect.play();
popUpWindow.nativeWindow.x = Capabilities.screenResolutionX - popUpWindow.width - 10;
popUpWindow.nativeWindow.y = Capabilities.screenResolutionY - popUpWindow.height - 35;
}
The condition used above is what we have used to find out, whether our application window is minimized to System Tray or not. Even though it is not a perfect fix, It didn't fail me yet. It's quiet stable for my app.
I have a textField on my stage named 'adBuy', which when clicked I want to open up my browser with the defined in URL request. However when I click on the 'adBuy' textField on my SWF it opens Coda, the piece of software I'm using to write this small piece of code?
I am puzzled. Here is my code:
adBuy.defaultTextFormat = adFormat;
adBuy.textColor = 0xFF65CB;
adBuy.x = 640;
adBuy.y = 455;
adBuy.text = "Buy Now";
parent.addChild(adBuy);
adBuy.addEventListener(MouseEvent.CLICK, buyAdvert);
var request:URLRequest = new URLRequest("http://www.google.co.uk");
function buyAdvert(event:MouseEvent):void {
navigateToURL(request, "_blank");
trace("link clicked");
}
Is there an error in my code, or is this a common problem for which there is an answer?
Sorry, I have solved my problem.
It appears the reason it was not opening a web browser with the URL it because I was running the SWF through 'Test Movie' in Flash. This appears to have been stopping the code working.
It did however work fine when I ran it in Flash Player.