How to disable snapview in WINJS? - winjs

I am creating an app in which snapview should be disabled.I have tried using:
window.addEventListener("resize", onViewStateChanged);
function onViewStateChanged(eventArgs) {
var viewStates = Windows.UI.ViewManagement.ApplicationViewState;
var newViewState = Windows.UI.ViewManagement.ApplicationView.value;
if (newViewState === 2 || newViewState===3) {
showMenu('snapped');
}
}
function showMenu(event) {
//Detect View State
if (event === 'snapped') {
var msg = new Windows.UI.Popups.MessageDialog(
"Resizing Window");
msg.showAsync();
window.innerWidth=screen.width
}
But this doesn't seem to work.Is there anything that i might have missed to disable the snapview.
Thanks

Because you're talking about snapped view, I assume that you're targeting Windows 8.0 and not Windows 8.1. In the latter, the snapped view state was removed in favor of variable-sized views, and in the app manifest you can indicate a minimum width of 500px (the default) or 320px (the former snapped view). Leaving it to 500px will prevent the narrow snapped view altogether.
If you are yet targeting Windows 8.0, there is unfortunately no means to disable snapped view (which is, by the way, why the change happened for 8.1). Apps that cannot effectively operate in the 320px view just display a message to that effect, suggesting to the user that they resize the view to use the app.

Related

Awesome WM - Chatty (Java application) bypass dimension properties from rc.lua

Chatty is a java application to chat in Twitch (streaming platform) from the desktop.
What I'm trying to accomplish is that Chatty always starts with specifics X, Y, width and height properties.
{ rule = { class = "chatty-Chatty" },
properties = {
width = 267,
height = 223,
x = 1575,
y = 774
},
},
The X and Y properties work just fine, wherever I move the window if I closed and open it again it appears in my desired position. However for some reason I fail to acknowledge Chatty doesn't care about the width and height properties, it always opens with the last geometry.
Chatty itself have a config file but there isn't anything related to width and height dimensions.
I'm on Arch, and the only WM I have is Awesome.
PD: One weird thing is that every time I'm changing the window size it also moves, always in a bottom right direction. This is annoying but not a problem, I'm mentioning this just in case it is related to the possible issue.
This is probably because they client resize itself after the rules are executed (which would be a bug in your app or Java). In any case, you can do:
client.disconnect_signal("request::geometry", awful.ewmh.client_geometry_requests)
to turn off the client ability to resize themselves.
In AwesomeWM git-master version, you can use the permission API to deny the "client" -> "geometry" -> "ewmh" permission per client.

Getting a sound trigger to work

I don't understand why my sound trigger is not working. I have created a GameObject and added an Audio Source to it (on Audio Source I have the Play On Wake and Loop checked. Then I added a Sphere Collider (I have the Is Trigger checked). Finally I added my script and added the sound clips into the inspector. Unity also says that: "There are 2 audio listeners in the scene." I have pretty much unchecked all the audio listeners and it still says it, what am I doing wrong?
Here is a look at my code:
#pragma strict
var WalkAudio:AudioClip;
var OutCry:AudioClip;
function Update (){
var Audio= gameObject.GetComponent(AudioSource);
if(Input.GetButton("Horizontal") || Input.GetButton("Vertical"))
{
Audio.Play();
}
else
{
Audio.Pause();
}
}
function OnControllerColliderHit (hit : ControllerColliderHit)
{
var Audio= gameObject.GetComponent(AudioSource);
if (hit.gameObject.tag == "templeFloor")
{
var groundType = 1;
print("Temple");
Audio.clip=OutCry;
}
else{
Audio.clip=WalkAudio;
}
}
As you said:
I have pretty much unchecked all the audio listeners
The component AudioListener attached to the Main Camera must be enabled. Probably you have used LoadLevelAdditive so you have two camera and two AudioListener components, one on each of them. Please make sure this additive camera and any other gameObject should have this component disabled.
Also at runtime, you can search which component(s) have AudioListener component attached using this in the Hierarchy window search bar.
t:AudioListener
This should help you out. Also double check using Debug.Log that OnControllerColliderHit function calls and Audio.clip is not null after assignment. Also is it necessary to play sound in Update ?
Also, you should move this line from Update to Start function instead, due to performance cost:
var Audio= gameObject.GetComponent(AudioSource);
and use this Audio variable throughout your script.

ExtJS Card Layout

I used the card layout to switch between two created panels:
var config = {
layout: 'card',
region : 'center',
activeItem: 0,
defaults : {
//height : 160
},
items : [this.ePanel, this.dPanel]
};
Ext.apply(this, config);
The switching takes place based on criteria:
if(params.exchange==='ABCD'){
l.setActiveItem(this.ePanel.id);
} else {
l.setActiveItem(this.dPanel.id);
}
As I switch between panels one of the panel contents get distorted. Are there any solutions to the problem? I am using ExtJS 2.2.
I've never used Ext2, but I've encountered similar difficulties with Ext3. Here are two ideas you can try...
Setting deferredRender to true.
Calling doLayout after setActiveItem, possibly after a small delay (because rendering is often deferred in Ext):
l.setActiveItem(this.ePanel.id);
setTimeout(function() {
l.doLayout();
}, 100); // more may be needed, one need to inspect Ext's code to know the precise value
doLayout is often the solution to layout issues, but it also generally requires a serious amount of debugging in order to have it applied. In effect, layouts are cached (at least in Ext3), so your call can be ignored if Ext consider internally that nothing has changed. Furthermore, as I've already said, rendering is often deferred, so if you don't delay it enough, your doLayout call may be executed before the child elements have been rendered...

Photoswipe rotation issue when in ios4 UIWebView

I am using photoswipe 3.0.5 in my ios application. Everything is working correctly in the simulator (ios 6.1), but when i run the app on my real device (ios4.3) and i rotate from portrait to landscape and viceversa the uiwebview correctly rotates but the image doesn't.
It seems like a common issue, infact photoswipe's github page(https://github.com/codecomputerlove/PhotoSwipe) says:
Work around for issue #141 now officially added - when rotating an app with PhotoSwipe displayed in a UIWebView, PhotoSwipe does not rotate. This seems to be an issue with UIWebView not PhotoSwipe. To enable this work around, set "enableUIWebViewRepositionTimeout = true" when creating your PhotoSwipe instance. You can also specify the frequency of this timeout by setting "uiWebViewResetPositionDelay" (default 500ms) - Please Note This is not needed for PhoneGap apps, nor web apps added to your homescreen.
But i don't know where to add that line of code. Can anyone give me hand?
Would this 'work around' really do the trick? I'm asking this question because everything is working correctly on the simulator.
I just found the answer. All you need to do is add 'enableUIWebViewRepositionTimeout: true' to the 'options' var:
(function(window, PhotoSwipe){
document.addEventListener('DOMContentLoaded', function(){
var
options = {
enableUIWebViewRepositionTimeout: true,
preventHide: true,
getImageSource: function(obj){
return obj.url;
},
getImageCaption: function(obj){
return obj.caption;
}
},
instance = PhotoSwipe.attach(
[
...
],
options
);
instance.show(0);
}, false);
}(window, window.Code.PhotoSwipe));

Flash trace output in firefox, linux

I'm developing an applications which I've got running on a server on my linux desktop. Due to the shortcomings of Flash on Linux (read: too hard) I'm developing the (small) flash portion of the app in Windows, which means there's a lot of frustrating back and forth. Now I'm trying to capture the output of the flash portion using flash tracer and that is proving very difficult also. Is there any other way I could monitor the output of trace on linux? Thanks...
Hope this helps too (for the sake of google search i came from):
In order to do trace, you need the debugger version of Flash Player from
http://www.adobe.com/support/flashplayer/downloads.html (look for "debugger" version specifically - they are hard to spot on first look)
Then an mm.cfg file in your home containing
ErrorReportingEnable=1 TraceOutputFileEnable=1 MaxWarnings=50
And then you are good to go - restart the browser. When traces start to fill in, you will find the log file in
~/.macromedia/Flash_Player/Logs/flashlog.txt
Something like
tail ~/.macromedia/Flash_Player/Logs/flashlog.txt -f
Should suffice to follow the trace.
A different and mind-bogglingly simple workaround that I've used for years is to simply create an output module directly within the swf. All this means is a keyboard shortcut that attaches a MovieClip with a textfield. All my traces go to this textfield instead of (or in addition to) the output window. Over the years I've refined it of course, making the window draggable, resizable, etc. But I've never needed any other approach for simple logging, and it's 100% reliable and reusable across all platforms.
[EDIT - response to comment]
There's no alert quite like javascript's alert() function. But using an internal textfield is just this simple:
ACTIONSCRIPT 1 VERSION
(See notes at bottom)
/* import ExternalInterface package */
import flash.external.*;
/* Create a movieclip for the alert. Set an arbitrary (but very high) number for the depth
* since we want the alert in front of everything else.
*/
var alert = this.createEmptyMovieClip("alert", 32000);
/* Create the alert textfield */
var output_txt = alert.createTextField("output_txt", 1, 0, 0, 300, 200);
output_txt.background = true;
output_txt.backgroundColor = 0xEFEFEF;
output_txt.selectable = false;
/* Set up drag behaviour */
alert.onPress = function()
{
this.startDrag();
}
alert.onMouseUp = function()
{
stopDrag();
}
/* I was using a button to text EI. You don't need to. */
testEI_btn.onPress = function()
{
output_txt.text = (ExternalInterface.available);
}
Notes: This works fine for AS1, and will translate well into AS2 (best to use strong data-typing if doing so, but not strictly required). It should work in Flash Players 8-10. ExternalInterface was added in Flash 8, so it won't work in previous player versions.
ACTIONSCRIPT 3 VERSION
var output_txt:TextField = new TextField();
addChild(output_txt);
output_txt.text = (String(ExternalInterface.available));
If you want to beef it out a bit:
var alert:Sprite = new Sprite();
var output_txt:TextField = new TextField();
output_txt.background = true;
output_txt.backgroundColor = 0xEFEFEF;
output_txt.selectable = false;
output_txt.width = 300;
output_txt.height = 300;
alert.addChild(output_txt);
addChild(alert);
alert.addEventListener(MouseEvent.MOUSE_DOWN, drag);
alert.addEventListener(MouseEvent.MOUSE_UP, stopdrag);
output_txt.text = (String(ExternalInterface.available));
function drag(e:MouseEvent):void
{
var alert:Sprite = e.currentTarget as Sprite;
alert.startDrag();
}
function stopdrag(e:MouseEvent):void
{
var alert:Sprite = e.currentTarget as Sprite;
alert.stopDrag();
}
[/EDIT]
If you only need the trace output at runtime, you can use Firebug in Firefox and then use Flash.external.ExternalInterface to call the console.log() Javascript method provided by Firebug.
I've used that strategy multiple times to a large degree of success.
Thunderbolt is a great logging framework with built-in firebug support.
I use the flex compiler on linux to build actionscript files, [embed(source="file")] for all my assets including images and fonts, I find actionscript development on linux very developer friendly.
Then again, I'm most interested in that flash has become Unix Friendly as aposed to the other way around :)
To implement FlashTracer, head to the following address and be sure you have the latest file. http://www.sephiroth.it/firefox/flashtracer/ . Install it and restart the browser.
Head over to adobe and get the latest flash debugger. Download and install the firefox version as FlashTracer is a firefox addition.
Now that firefox has the latest flash debugger and flash tracer we need to locate mm.cfg
Location on PC: C:\Documents and Settings\username
Inside of mm.cfg should be:
ErrorReportingEnable=1
TraceOutputFileEnable=1
MaxWarnings=100 //Change to your own liking.
Once that is saved, open firefox, head to the flash tracer window by heading to tools > flash tracer. In the panel that pops up there is two icons in the bottom right corner, click the wrench and make sure the path is set to where your log file is being saved. Also check to see that flash tracer is turned on, there is a play/pause button at the bottom.
I currently use this implementation and hope that it works for you. Flash Tracer is a little old, but works with the newest versions of FireFox. I am using it with FireFox 3.0.10.

Resources