1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    35
    Vote Rating
    0
    I3D is on a distinguished road

      0  

    Default Orientation Change?

    Orientation Change?


    Hi Guys

    Im trying to implement an orientation script. however I am facing a problem. The script work on the start of the scene, but not during the slide.

    The way i have it setup is like this, I have a script on the start of the scene, which checks for orientation. Now if i load the slide, then it will be activated, but if i change the orientation midway, nothing happens!!! how can i keep this persistent all the time?

    Best.

  2. #2
    Sencha User arnebech's Avatar
    Join Date
    Jun 2010
    Posts
    498
    Vote Rating
    10
    arnebech will become famous soon enough

      0  

    Default


    You could probably add an event listener?

    I am attaching a sample project. The sample project has a square that changes color when orientation changes. I have only tested it in the iOS simulator.

    Here is the main code for it as well:
    Code:
    //create a global variable/namespace for use if we don't have already
    if (typeof(myData) === "undefined") {
        myData = {};
    }
    
    
    //helper function to get a rounded value between 0-255
    function getRandomColorComponent() {
        return Math.round(Math.random() * 255);
    }
    
    
    //get element on stage that has a cssid of 'box'
    var element = document.querySelector('#box');
    
    
    //if we haven't attached the listener allready lets do that
    //Remeber: sometimes scenes are played multiple times
    if (!myData.hasOrientationListener) {
    
    
        //attach orientation listener
        window.addEventListener('orientationchange', function () {
            
            var r = getRandomColorComponent(),
                g = getRandomColorComponent(),
                b = getRandomColorComponent();
        
            element.style.backgroundColor = "rgb("+r+","+g+","+b+")";
        
        });
        
        //set flag so we know we attached listenr
        myData.hasOrientationListener = true;
        
    }
    OrientationChange.animproj.zip

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    35
    Vote Rating
    0
    I3D is on a distinguished road

      0  

    Default


    Thanks Arne

    I'll have a look at this now.

    Cheers

  4. #4
    Sencha User
    Join Date
    Oct 2011
    Posts
    35
    Vote Rating
    0
    I3D is on a distinguished road

      0  

    Default


    Hi Arne

    The code worked, made a few tweaks to it but everything is working fine now

    I will gather all the workflow steps i gathered doing this project and make a PDF out of it, post it to the community

    Cheers

  5. #5
    Sencha User arnebech's Avatar
    Join Date
    Jun 2010
    Posts
    498
    Vote Rating
    10
    arnebech will become famous soon enough

      0  

    Default


    Great! Looking forward to reading it.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi