facebook

What am I missing here?

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #341793 Reply

    SKnoxmn
    Member

    function findOrientation()
    {
    window.addEventListener(“deviceorientation”, handleOrientation, true);
    }// Orientation

    function handleOrientation(event)
    {
    var absolute = event.absolute;
    var alpha = event.alpha;
    var beta = event.beta;
    var gamma = event.gamma;
    } // Do stuff with the new orientation data

    function deviceorientation()
    {
    $(‘#m1-Learning-textField4’).val(event.beta);
    $(‘#m1-Learning-textField5’).val(event.alpha);
    }

    Form Button Event = OnClick return findOrientation();

    SKnox

    #341794 Reply

    Brandon
    Member

    Off 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);
    }// Orientation

    var 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 data

    function deviceorientation()
    {
    $(‘#m1-Learning-textField4’).val(event.beta);
    $(‘#m1-Learning-textField5’).val(event.alpha);
    }

    Form Button Event = OnClick return findOrientation();

    #341795 Reply

    SKnoxmn
    Member

    I 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

    #341796 Reply

    SKnoxmn
    Member

    what we need on here is an online java chat for these individual “Topic / Rooms” I think that would be cool.

    #341800 Reply

    SKnoxmn
    Member

    window.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

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: What am I missing here?

You must be logged in to post in the forum log in