aaa.txt

(4 KB) Pobierz
<html>
	<head>
        
        <link href="sample.css" rel="stylesheet" type="text/css"/>
        <script type="text/javascript" src="lib/air/AIRAliases.js"></script>
        <script type="text/javascript">
            // AIR-related functions created by the developer
            
            // reads the content of a local text file
            function readLocalFile(){
                var f = air.File.applicationDirectory.resolvePath("LocalFile.txt");
				
                var fs = new air.FileStream();
                fs.open(f, air.FileMode.READ);
                var content = fs.readUTFBytes(fs.bytesAvailable);
                fs.close();
                
                return content;
            }
            
            // loads the content of a remote URL
            function doRequest(url) {
               var req = new XMLHttpRequest();
               req.onreadystatechange = function() { 
                    if (req.readyState == 4) {
                        var str = req.responseText;
                        if (str.length > 400) {
                            str = str.substring(0, 399);
                            str += "..";
                        }
                        alert('readystate: ' + req.readyState + '\n' +
                            'status/statusText: ' + req.status + '/' + 
                             req.statusText + '\n' +
                            'responseText (400 chars): '  + "\n\n" + str);
                    }
                };
                req.open('GET', url, true);
                req.send(null);                
            }
			
			function makeNativeWindow() {
				var options = new air.NativeWindowInitOptions();
				
				var rect = new air.Rectangle(50, 50, 200, 200);
				
				var popup = air.HTMLLoader.createRootWindow(true, options, false, rect);
				
				var page = air.File.applicationDirectory.resolvePath('Test.html');
				popup.load(new air.URLRequest(page.url));
			}
			
		
			
			function makehtmlWindow(){
		var widnow = window.open('strona.html', 'tytu?', 'w?a?ciwo??1=warto??1, w?a?ciwo??2=warto??2');
			}
			
			function zmienTytul(tytul){
				var currentWindow = window.nativeWindow;
				currentWindow.title= tytul;
			}
			
			function zmienSzerokosc(szerokosc){
				
				var currentWindow = window.nativeWindow;
				currentWindow.width = parseInt(szerokosc);
			}
			
			
			function openInBrowser(url) {
				air.navigateToURL( new air.URLRequest(url)); 
			}
            
			function fullscreen(){
				var win = window.nativeWindow;
				win.stage.displayState = runtime.flash.display.StageDisplayState.FULL_SCREEN
			}
			
			function menu(){
				var rootMenu = new air.NativeMenu();
				var submenu = new air.NativeMenu();
				var item = new air.NativeMenuItem("Fullscreen");
				var item2 = new air.NativeMenuItem("Zako?cz");
				
				submenu.addItem(item);
				submenu.addItem(item2);
				rootMenu.addSubmenu(submenu,"Opcje");
				window.nativeWindow.menu = rootMenu;
				item.addEventListener(air.Event.SELECT, fullscreen);
				item2.addEventListener(air.Event.SELECT, wyjdz);
			}
			
			function wyjdz(){
				var win = window.nativeWindow;
				win.close();;
			}
			
			function min(){
				var win = window.nativeWindow;
				win.minimize();;
			}
			
			function max(){
				var win = window.nativeWindow;
				win.maximize();
			}
			
			function rusz(){
				var win = window.nativeWindow;
				win.startMove();
			}
			
			function aaa(){
				var win = window.nativeWindow;
				win.startResize(air.NativeWindowResize.BOTTOM_RIGHT);
			}
			
			function zdarzenie(){
				var conf = confirm('Czy chcesz zmaksymalizowa??');
				if (conf) fullscreen();
				
			}
			
        </script>
	</head>

    <body onLoad="menu()">
		<button onclick="makeNativeWindow()">  Okno natywne</button> <br>
	<button onclick="makehtmlWindow()">Okno html</button> <br>
	<input type="text" id="tytul" onchange="zmienTytul(this.value)"> Tytul <br>
	<input type="text" id="szerokosc" onchange="zmienSzerokosc(this.value)"> Szerokosc <br>
	<button onclick="zdarzenie()">Fullscreen</button> <br>	
	<button onclick="wyjdz()">Wyjdz</button> <br>	
	<button onclick="min()">Zminimalizuj</button> <br>	
	<button onclick="max()">Zmaksymalizuj</button> <br>
	
	<button onMouseDown="rusz()">Ruszaj</button> <br>
	<button onMouseDown="aaa()">Rozmiar</button> <br>
	
        
    </body>
</html>
Zgłoś jeśli naruszono regulamin