Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import flash.net.navigateToURL;
- import flash.net.URLRequest;
- import flash.events.MouseEvent;
- import fl.motion.Color;
- import flash.display.MovieClip;
- import flash.events.KeyboardEvent;
- import flash.text.TextField;
- import flash.ui.Keyboard;
- import flash.events.Event;
- import flash.display.SimpleButton;
- import flash.ui.MouseCursor;
- import flashx.textLayout.formats.BackgroundColor;
- import flash.text.TextFormat;
- var chappre="Something in the Way";
- var chapters = new Array("Unnerved", "About mana", "The first Mannikin","To adventure!","A nice hat","special");
- var pages = new Array(14,17,19,11,22,3);
- var page=0;
- var chapter=0;
- var def=true;
- var kugelset=true;
- var stageset=true;
- var listeners : Dictionary = new Dictionary();
- function addevent(obj:Object,ev:String,fu:Function){
- var key : Object = {obj:obj, ev:ev};
- if(listeners[key]) {
- obj.removeEventListener( ev, listeners[ key ]);
- listeners[ key ] = null;
- }
- listeners[ key ] = fu;
- if(!obj.hasEventListener(ev))obj.addEventListener(ev,fu);
- }
- var clickobjects=new Array(kugelg,startimg,namelink,weaverlink);
- for(x=0;x<clickobjects.length;x++){
- if(!clickobjects[x])continue;
- addevent(clickobjects[x],MouseEvent.ROLL_OVER,function(){Mouse.cursor=MouseCursor.BUTTON;});
- addevent(clickobjects[x],MouseEvent.ROLL_OUT,function(){Mouse.cursor=MouseCursor.AUTO;});
- }
- addevent(stage,KeyboardEvent.KEY_DOWN,function(event:KeyboardEvent){
- if(forward&&event.keyCode==Keyboard.RIGHT){forward.dispatchEvent(new MouseEvent(MouseEvent.CLICK,true));}
- if(startimg&&event.keyCode==Keyboard.RIGHT){startimg.dispatchEvent(new MouseEvent(MouseEvent.CLICK,true));}
- if(back&&event.keyCode==Keyboard.LEFT){back.dispatchEvent(new MouseEvent(MouseEvent.CLICK,true));}
- if(comment&&event.keyCode==Keyboard.ENTER){kugel.dispatchEvent(new MouseEvent(MouseEvent.CLICK,true));}
- });
- if(namelink&&kugelg&&startimg){
- addevent(kugelg,MouseEvent.MOUSE_OVER,function(){orbbesch.visible=true;});
- addevent(kugelg,MouseEvent.MOUSE_OUT,function(){orbbesch.visible=false;});
- addevent(namelink,MouseEvent.MOUSE_OVER,function(){namelink.namelinktext.textColor="0x00FF0000";});
- addevent(namelink,MouseEvent.MOUSE_OUT,function(){namelink.namelinktext.textColor="0x00FFFFFF";});
- addevent(namelink,MouseEvent.CLICK,function(){navigateToURL(new URLRequest("http://dediggefedde.deviantart.com"),"_blank");});
- addevent(startimg,MouseEvent.MOUSE_OVER,function(){
- startimg.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 255, 0, 0, 0);
- startimg.starttext.textColor="0xff0000";});
- addevent(startimg,MouseEvent.MOUSE_OUT,function(){if(startimg){
- startimg.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
- startimg.starttext.textColor="0xffffff";}});
- addevent(startimg,MouseEvent.CLICK,function(){
- nextFrame();
- if(!chname)return true;
- page=1;
- commentenable();
- chname.text=chappre+" - "+chapters[chapter]+" - pg"+page;
- Mouse.cursor=MouseCursor.AUTO;
- });
- }
- if(TOC.numChildren==2){
- var ind=0;
- for(i=0;i<chapters.length;i++){
- var myFont:Font = new Schriftart1();
- var myFormat:TextFormat = new TextFormat();
- myFormat.font = myFont.fontName;
- myFormat.size = 24;
- if(i==0)ind=2;else ind+=pages[i-1];
- var tx:TextField=new TextField();
- tx.text=chapters[i];
- tx.setTextFormat(myFormat);
- tx.x=40;
- tx.y=50+25*i;
- tx.width=170;
- tx.height=35;
- tx.selectable = false;
- TOC.addChild(tx);
- var tx2:TextField=new TextField();
- tx2.text="page "+(ind-1);
- tx2.setTextFormat(myFormat);
- tx2.x=220;
- tx2.y=50+25*i;
- tx2.width=100;
- tx2.height=35;
- tx2.selectable = false;
- TOC.addChild(tx2);
- addevent(tx,MouseEvent.CLICK,(function(i,chap){return function(){gotoAndStop(i);TOC.visible=false;chname.visible=false;page=1;chapter=chap;chname.text=chappre+" - "+chapters[chapter]+" - pg"+page;commentenable();};})(ind,i));
- addevent(tx,MouseEvent.ROLL_OVER,function(e){Mouse.cursor=MouseCursor.BUTTON;e.currentTarget.textColor="0xff0000"});
- addevent(tx,MouseEvent.ROLL_OUT,function(e){Mouse.cursor=MouseCursor.AUTO;e.currentTarget.textColor="0x000000";});
- }
- }
- var i:int;
- function commentenable(){
- if(page==pages[chapter]&&chapter>=chapters.length-2){forward.visible=false;}else{forward.visible=true;}
- if(page==0&&chapter==0){if(back)back.visible=false;if(forward)forward.visible=false;}else{if(back)back.visible=true;}
- if(comment){
- comment.visible=false;
- if(kugel)kugel.visible=true;
- }else{if(kugel)kugel.visible=false;}
- if(monsterslide){
- rewind.visible=true;
- }else{rewind.visible=false;}
- }
- if (forward)
- {
- clickobjects=new Array(forward,back,kugel,chname,rewind);
- for(x=0;x<clickobjects.length;x++){
- addevent(clickobjects[x],MouseEvent.ROLL_OVER,function(){Mouse.cursor=MouseCursor.BUTTON;});
- addevent(clickobjects[x],MouseEvent.ROLL_OUT,function(){Mouse.cursor=MouseCursor.AUTO;});
- }
- addevent(rewind,MouseEvent.CLICK, function (event:MouseEvent){
- if(monsterslide){monsterslide.gotoAndPlay(1);}
- });
- addevent(rewind,MouseEvent.ROLL_OVER, function(){rewind.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 0, 0, 255, 0); rewind.textColor="0x0000ff";});
- addevent(rewind,MouseEvent.ROLL_OUT, function(){rewind.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0); rewind.textColor="0xffffff";});
- addevent(kugel,MouseEvent.CLICK,function(event:MouseEvent){
- if(comment)comment.visible=!comment.visible;
- });
- addevent(kugel,MouseEvent.MOUSE_OVER,function(){
- if(kugel)kugel.transform.colorTransform = new ColorTransform(1.3, 1.3, 1.4, 1, 0, 0, 0, 0);
- });
- addevent(kugel,MouseEvent.MOUSE_OUT,function(){
- if(kugel)kugel.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
- });
- addevent(chapvisib,MouseEvent.MOUSE_OVER,function(event:MouseEvent){
- if(chname)chname.visible=true;
- });
- addevent(chname,MouseEvent.MOUSE_OUT,function(event:MouseEvent){
- if(chname)chname.visible=false;
- });
- addevent(chname,MouseEvent.CLICK,function(event:MouseEvent){
- if(TOC)TOC.visible=!TOC.visible;
- if(chname)chname.visible=true;
- });
- if(movieClip_2)addevent(movieClip_2,MouseEvent.MOUSE_OVER,function(event:MouseEvent){
- if(TOC)TOC.visible=false;
- if(chname)chname.visible=false;
- });
- addevent(TOC,MouseEvent.MOUSE_OVER,function(event:MouseEvent){
- if(chname)chname.visible=true;
- });
- addevent(forward,MouseEvent.MOUSE_OVER,function(){
- if(forward)forward.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 255, 0, 0, 0);
- });
- addevent(back,MouseEvent.MOUSE_OVER,function(){
- if(back)back.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 255, 0, 0, 0);
- });
- addevent(forward,MouseEvent.MOUSE_OUT,function(){
- if(forward)forward.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
- });
- addevent(back,MouseEvent.MOUSE_OUT,function(){
- if(back)back.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
- });
- addevent(forward,MouseEvent.CLICK,function(){
- if(chapter==chapters.length-1&&page==pages[chapter])return false;
- page++;
- nextFrame();
- if(!chname)return true;
- if(page==pages[chapter]+1){
- if(chapter!=chapters.length-1){chapter++;page=1;}
- }
- chname.text=chappre+" - "+chapters[chapter]+" - pg"+page;
- commentenable();
- });
- addevent(back,MouseEvent.CLICK,function(){
- if(page==0)return;
- page--;
- prevFrame();
- if(!chname)return true;
- if(page==0&&chapter>0){chapter--;page=pages[chapter];}
- chname.text=chappre+" - "+chapters[chapter]+" - pg"+page;
- forward.visible=true;
- commentenable();
- });
- }
- chname.visible=false;
- TOC.visible=false;
- orbbesch.visible=false;
- commentenable();
- this.stop();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement