📄 album2main.xml
字号:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
width="100%"
height="100%"
creationComplete="init();"
backgroundGradientColors="[#000000, #000000]" xmlns:ns1="*" viewSourceURL="srcview/index.html">
<mx:Script>
<![CDATA[
import mx.effects.Resize;
import mx.core.UIComponent;
import flash.text.TextField;
public var nImg:int=18;
private function init():void{
//trace("init" + width);
//trace("init" + height);
loadText(); // load about and help section
var Disp:RotatePics = new RotatePics(width,height,nImg); //create instance of rotate pics
var background:NodeGarden = new NodeGarden(width,height); //create instance of background
//trace("children1"+Application.application.getChildren()); //debug
Application.application.addChildAt(Disp,0); //add rotatepics instance at begining of display list
Application.application.addChildAt(background,0); //add background at begining of display list
//trace("children2"+Application.application.getChildren());
addEventListener(Event.RESIZE,onResize); //check for resize
}
private function onResize(event:Event):void{
//trace("children3"+Application.application.getChildren());
//trace("child" + Application.application.getChildAt(2));
//trace("child" + Application.application.getChildAt(3));
Application.application.removeChild(Application.application.getChildAt(0)); //remove background
Application.application.removeChild(Application.application.getChildAt(0)); //remove rotatepics
//trace("children4"+Application.application.getChildren());
//trace("resize" + application.width);
//trace("resize" + application.height);
init(); // create new rotate pics and background to fit screen
}
private function aboutBox():void{ //show about text box
if(box.visible==true && about.selected==true && help.selected == true){ //check to see if the help text box is open
help.selected=false; //if help text is visible unselect help button
//trace("about text"+box.visible);
}else{
openBox(about); //if help text is not open go to openBox
//trace("openbox1"+box.visible);
}
aboutText.visible=true; //open about text
helpText.visible=false; //close help text
box.title = "about"; //display 'about' in panel label
}
private function helpBox():void{ //show help text box
if(box.visible==true && help.selected==true && about.selected==true){ //check to see if the about text box is open
about.selected = false; //if about text is visible unselect about button
//trace("help text"+box.visible);
}else{
openBox(help); //if about text is not open go to openBox
//trace("openbox2"+box.visible);
}
helpText.visible=true; //open help text
aboutText.visible=false; //close about text
box.title = "help"; //display 'about' in panel label
}
private function openBox(b:Button):void{
if (b.selected==true){ //if button pressed is selected open box
//trace("get kids"+Application.application.getChildren());
box.visible = true;
//trace("openboxfunction"+box.visible);
}else{
box.visible = false; // otherwise close box
}
}
private function loadText():void{
var aboutTextLoader:URLLoader = new URLLoader();
var helpTextLoader:URLLoader = new URLLoader();
aboutTextLoader.addEventListener(Event.COMPLETE, aboutLoaded); //add listener to tell when text is loaded
helpTextLoader.addEventListener(Event.COMPLETE, helpLoaded); //as above
var aboutDataURL:URLRequest = new URLRequest("../text/about.txt"); //destination of file to be loaded
var helpDataURL:URLRequest = new URLRequest("../text/help.txt"); //as above
aboutTextLoader.load(aboutDataURL); //load text
helpTextLoader.load(helpDataURL); //as above
}
private function aboutLoaded(e:Event):void {
aboutText.text = new String(e.target.data); //store data in text member
}
private function helpLoaded(e:Event):void {
helpText.text = new String(e.target.data); //store data in text member
}
]]>
</mx:Script>
<mx:Button x="23" y="20" label="about" fillAlphas="[1.0, 1.0]" fillColors="[#151414, #151414]" color="#ECF3F4" id="about" click="aboutBox()" toggle="true"/>
<mx:Button x="23" y="50" label="help" fillAlphas="[1.0, 1.0]" fillColors="[#151414, #151414]" color="#ECF3F4" id="help" click="helpBox()" toggle="true"/>
<mx:Panel x="150" y="50" width="80%" height="80%" layout="absolute" id="box" visible="false">
<mx:TextArea horizontalScrollPolicy="on" verticalScrollPolicy="on" id="aboutText" x="0" y="0" text="about" width="100%" height="100%" visible="false" fontWeight="bold"/>
<mx:TextArea horizontalScrollPolicy="on" verticalScrollPolicy="on" id="helpText" x="0" y="0" text="help" width="100%" height="100%" visible="false" fontWeight="bold"/>
</mx:Panel>
</mx:Application>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -