- This topic has 4 replies, 2 voices, and was last updated 11 years, 4 months ago by SKnoxmn.
-
AuthorPosts
-
SKnoxmnMemberfunction findOrientation()
{
window.addEventListener(“deviceorientation”, handleOrientation, true);
}// Orientationfunction handleOrientation(event)
{
var absolute = event.absolute;
var alpha = event.alpha;
var beta = event.beta;
var gamma = event.gamma;
} // Do stuff with the new orientation datafunction deviceorientation()
{
$(‘#m1-Learning-textField4’).val(event.beta);
$(‘#m1-Learning-textField5’).val(event.alpha);
}Form Button Event = OnClick return findOrientation();
SKnox
BrandonMemberOff the top of my head without testing I see you are declaring the variables inside the function. That will limit them to the scope of that function and not available outside. Try this:
function findOrientation()
{
window.addEventListener(“deviceorientation”, handleOrientation, true);
}// Orientationvar absolute;
var alpha;
var beta;
var gamma;function handleOrientation(event)
{
absolute = event.absolute;
alpha = event.alpha;
beta = event.beta;
gamma = event.gamma;
} // Do stuff with the new orientation datafunction deviceorientation()
{
$(‘#m1-Learning-textField4’).val(event.beta);
$(‘#m1-Learning-textField5’).val(event.alpha);
}Form Button Event = OnClick return findOrientation();
SKnoxmnMemberI appreciate that speedy reply to this one. Still not getting it to populate to the text fields.
I do have it working for getting the lat lon and alt. Just can’t get this last piece, so I figure its me learning things as I go.
all the examples seem to want to post this info to a canvas to turn pictures around. I’m just trying to get it into a field.
SKnox
SKnoxmnMemberwhat we need on here is an online java chat for these individual “Topic / Rooms” I think that would be cool.
SKnoxmnMemberwindow.addEventListener(‘deviceorientation’, function(eventData) {
var LR = eventData.gamma;
var FB = eventData.beta;
var DIR = eventData.alpha;
deviceOrientationHandler(LR, FB, DIR);I think this is a piece of it. any thoughts?
SKnox
-
AuthorPosts