navigateToURL AS3 does nothing on Google Chrome only in my computer - macos

I'm facing a strange behavior of flash Player, on my iMac, running OSX 10.9.2, and Chrome 33.0.1750.146 with Flash Player 12.0.0.70.
I use the following function, to open a page and post to it some jpg data. It worked bofore on my iMac. I can't remember when it stopped working. It is working well on Safari.
On other computers I have, including a Macbook, that runs same chrome and same flash player version, it is also working as expected. So, it sounds crazy.
private function SharePicture(evt:MouseEvent):void
{
var bit:BitmapData = new BitmapData(cena.width, cena.height);
var shiftOrigin:Matrix = new Matrix();
shiftOrigin.translate(-cena.x,-cena.y);
bit.draw(stage, shiftOrigin);
var jpgEncoder:JPGEncoder = new JPGEncoder(95);
var jpgStream:ByteArray = jpgEncoder.encode(bit);
var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream");
var jpgURLRequest:URLRequest = new URLRequest("some-page.php");
jpgURLRequest.requestHeaders.push(header);
//percentLoaded_txt.visible=true;
//percentLoaded_txt.text = processando;
jpgURLRequest.method = URLRequestMethod.POST;
jpgURLRequest.data = jpgStream;
navigateToURL(jpgURLRequest, "");
}
I already completely removed Google Chrome and reinstalled again, and no way, to make this code work.
You can try it by yourself, by accessing the following page:
http://www.scrapee.net/en/photo-wall-collage.htm - Just access it, and blick "Save Photo" button on the bottom.
Have anyone an ideal about what is causing this?
Thanks.

navigateToURL takes 2 parameters. The second one, in your case empty string, is the target, where this new window will be open. Possible values are: "_blank"(new window/tab), "_self" (same window/tab) and two others if you work with frames(not flash frames): "_top" and "_parent". For more info:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/package.html
If you don't pass anything as argument, default behavior is _blank, but in your case, you're passing a string, an empty string, and this could be the problem ...

Related

Make new dlg windows mouse position or somewhere specific

I'm a beginner, I'm trying to match the new created dlg windows to match the position of my mouse or at least somewhere specific, can anyone help?
var dlg = new Window("dialog",[100,495,300,540]);
Tried but look like this is not working.
If you are after a window that's 220 x 45 then I think you want:
var dialog = new Window("dialog");
dialog.text = "Dialog";
dialog.preferredSize.width = 200;
dialog.preferredSize.height = 45;
dialog.show();
Position the window - I'm not so sure about that. A few versions ago any dialog or windows were default to the top left. And you had to use var win = new Window(dlg,'My dialog window'); win.center(); to put them in the centre. It may be possible to position them at exact cooridinates.
However...
Two things that will make your life much easier is the Photoshop scriptUI guide
and Joonas Pääkkö's ScriptUI Dialog Builder. The latter will do a lot of teh heavy lifting for you. You're welcome.

NSOpenPanel won't close properly during Swift function

I'm a newcomer to Swift (2.2) and am having a problem with a simple app using Xcode 7.3 and OS X 10.11. In this app, the user clicks a button and selects a file through NSOpenPanel. The code uses the URL selected to get the file's data and name, then processes the data and saves the result somewhere else. With large files, the processing can take several seconds. When processing large files, once the file is selected, the space where the Open File window had been remains blank, covering the app view and everything else, and stays there until the operation is complete. Also, the app's outlets are frozen until the operation finishes. It appears NSOpenPanel isn't handing window control back to the app and the system.
The code goes like this:
#IBAction func processFile(sender: AnyObject) {
var chosenURL: NSURL?
let openPanel = NSOpenPanel()
openPanel.title = "Choose a file"
openPanel.canChooseDirectories = false
openPanel.allowsMultipleSelection = false
if openPanel.runModal() == NSFileHandlingPanelOKButton {
chosenURL = openPanel.URL
}
let dataBytes = NSData(contentsOfURL: chosenURL!)
let fileName = chosenURL!.lastPathCompnent!
// Remaining code processes dataBytes and fileName
I've tried a few variations but get the same result. Searching for "NSOpenPanel won't close" on the 'net usually just brings up examples in Objective-C, which I know nothing of. Any suggestions of how to make NSOpenPanel shut off and have view and control return to the app window?
Following on from Eric D's suggestion, I looked into Grand Central Dispatch and background processes. My first approach was:
dispatch_async(dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0)) {
dataBytes = NSData(contentsOfURL: chosenURL!)
}
That didn't change anything. I found I had to put the whole remaining process (everything from 'let dataBytes…' onwards) within the dispatch closure, with 'dispatch_async(dispatch_get_main_queue())' statements around UI updates. This stopped the window from freezing and blanking, and returned control to the app. Thanks again, Eric.

Wide Tile Windows Phone 7.1 using MangoPollo

I have a Windows Phone 7.1 app and I want to include a wide iconic tile. I found a library called MangoPollo:
http://mangopollo.codeplex.com/
I found this code within:
var tile = ShellTile.ActiveTiles.FirstOrDefault();
if (tile != null)
{
var tileData = new FlipTileData();
tileData.Title = "Start Debugging";
tileData.BackContent = "switch to windows phone, we've got candy";
tileData.BackgroundImage = new Uri("Assets/tileBackground.png", UriKind.Relative);
tileData.BackBackgroundImage = new Uri("Assets/tileBackBackground.png", UriKind.Relative);
tileData.WideBackContent = "switch to windows phone, we've got candy";
tileData.WideBackgroundImage = new Uri("Assets/wideTileBackground.png", UriKind.Relative);
tileData.WideBackBackgroundImage = new Uri("Assets/wideTileBackBackground.png", UriKind.Relative);
tile.Update(tileData);
}
The problem is there isn't any documentation included on Codeplex for the project so I'm not sure where to insert this code (i.e. which function) to change the tile size from normal to wide.
Another way of creating Wide Tile in Windows Phone 7. Tested it and it works.
Check this out.
http://www.supersmithbros.com/index.php/latest-news/93-how-to-create-a-wp8-wide-tile-in-wp7-xna
You may call it where you want and there is no code to change tile at the user screen, because it's not allowed.
If you look in the source code, in the link to MangoPollo which you supplied, the sample code places the tile code in a button click event. So what I would do in your app, is make an option to set up this new tile (settings page, maybe?) and when the user turns this setting on, you would run the code in that event handler.
This way, the code doesn't unnecessarily execute multiple times (as it would if it were in the constructor of a page or in app.xaml.cs).
Hope this helps!
Edit:
Based on your comment then, maybe you can put it in the constructor of your first page. Maybe, then, to prevent the code from executing more than necessary, you could check the existing tile to see if it already has a WideBackgroundImage, and if it doesn't, then set it and call Update() otherwise just continue.

New popup windows on Google Chrome for Windows are always the full screen width

I have a site http://bizfriend.ly/lesson.html?1 which requires several popups of specific widths. I cannot get the predefined widths to work for Windows versions of Chrome. It works fine in IE, Safari, and Chrome on Mac.
After step two in the instructions, your screen should have two popup windows next to each other.
The following function is called by a jQuery click function. Again it works fine all browsers except Chrome on Windows.
function _instructionsLinkClicked(evt){
var url = 'instructions.html?'+lessonId;
var width = 340;
var height = window.screen.height;
var left = window.screen.width - 340;
instructionOptions = "height="+height+",width="+width+",left="+left;
window.open(url,"instructions",instructionOptions);
}
An interesting clue, when the 'Restore Down' button is clicked, the window reduces to the correct size I want, yet at the wrong location.

get url of all tabs in a firefox window (if posssible all ff windows)

I can retrieve the url of current tab in firefox using
var wm = Components.classes["#mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator);
var mainWindow = wm.getMostRecentWindow("navigator:browser");
var tabbrowser = mainWindow.gBrowser;
var url = tabbrowser.currentURI.spec;
Now i want to do it for all tabs and save it in a string and if possible get it for tabs in the other ff windows as well. How can i do that?
I have this requirement also, happens to find that you just got so close to the answer. Check this example in official document, it has all your needs. The key point is the window enumerator.
https://developer.mozilla.org/En/Code_snippets/Tabbed_browser#Reusing_tabs

Resources