How to Use this Actionscript 3.0 code for several frames?
===

I'm completely new to Actionscript, I've searched everywhere for a screen orientation code but couldn't find a proper one. I'm trying to make a book app with several pages (frames) which has both portrait & landscape mode. I found a code written by Adam Khoury but it only works with one frame. Is there any way to use this code with several frames (pages) with different movieclips? Here is a video of him using this code: goo.gl/T24ku. Thanks.

    // AS3.0 Android App View Modes Script For App View Orientation
    // Written by Adam Khoury
    import flash.display.Stage;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    // Create stage instance and manipulate 2 of its properties
    var appStage:Stage = myApp.stage;
    appStage.scaleMode = StageScaleMode.NO_SCALE;
    appStage.align = StageAlign.TOP_LEFT;
    // Function that executes each time a phone or device is rotated
    function orientateMyApp(event:Event):void {
        var device_width:int = appStage.stageWidth;
        var device_height:int = appStage.stageHeight;
        // Condition that allows toggling between view modes
        if(device_width > device_height){
            myApp.gotoAndStop("wide_view");
        } else {
            myApp.gotoAndStop("tall_view");
        }
    }
    // Add an event listener for the resize event of the stage instance
    appStage.addEventListener(Event.RESIZE, orientateMyApp);