Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript (http://www.flasher.ru/forum/forumdisplay.php?f=5)
-   -   Windows forever (http://www.flasher.ru/forum/showthread.php?t=59422)

Usnul 16.06.2004 04:44

Windows forever
 
вот простенький код окошек со скинами, разберайте =)
Код:

/* 
        Windows module Version 0.1 Usnul 06/2004 copyright (c)
        writen by Alex Goldring (Usnul) specially for mySQL,php,Flash forum in 2004 with refference to "Flash Windowed Intersace" version 8.1 and earlier versions by Usnul
*/
/*        Following code must be included in project for the module usage
        #include "windows.as"
        _root.skinpath="skins/default/window.swf"
*/
_root.skinpath="skins/default/window.swf";
_root.createEmptyMovieClip("WindowsModule",100); //Please do not forget to change the depth value
_root.WindowsModule.counter=1;
_root.WindowsModule.creWindow=function(name){
        _root.WindowsModule.createEmptyMovieClip("Window"+_root.WindowsModule.counter,_root.WindowsModule.counter);
        _root.WindowsModule["Window"+_root.WindowsModule.counter].createEmptyMovieClip("Interface",1);
        _root.WindowsModule["Window"+_root.WindowsModule.counter].createEmptyMovieClip("Content",2);
        _root.WindowsModule["Window"+_root.WindowsModule.counter].Interface.loadMovie(_root.skinpath);
        _root.WindowsModule["Window"+_root.WindowsModule.counter].name=name;
        _root.WindowsModule["Window"+_root.WindowsModule.counter].onEnterFrame=function(){
                if(this.Interface.getBytesLoaded()==this.Interface.getBytesTotal()){
                        if(this.Content._width>0){this.w=this.Content._width}else{this.w=150}
                        if(this.Content._height>0){this.h=this.Content._height}else{this.h=100}
                        this.Interface.ltc._x=this.Interface.ltc._y=0;
                        this.Interface.tb._x=this.Interface.bb._x=this.Interface.t._x=this.Interface.ltc._width;
                        this.Interface.tb._y=0;
                        this.Interface.tb._width=this.Interface.bb._width=this.w;
                        this.Interface.rtc._x=this.Interface.rb._x=this.Interface.rbc._x=this.Interface.tb._x+this.Interface.tb._width;
                        this.Interface.rtc._y=0;
                        this.Interface.lb._x=this.Interface.lbc._x=0;
                        this.Interface.lb._y=this.Interface.rb._y=this.Interface.ltc._height;
                        this.Interface.lb._height=this.Interface.rb._height=this.h;
                        this.Interface.lbc._y=this.Interface.rbc._y=this.Interface.bb._y=this.Interface.lb._y+this.Interface.lb._height;
                        this.Interface.cb._x=this.Interface.rtc._x-this.Interface.cb._width;
                        this.Interface.cb._y=(this.Interface.tb._height-this.Interface.cb._height)/2;
                        this.Interface.t._y=(this.Interface.tb.height-this.Interface.t._height)/2;
                        this.Interface.name=this.name;
                }
                if(Key.isDown(1)){
                        if(this.Interface.tb.hitTest(_root._xmouse,_root._ymouse,true)){
                                this.startDrag();
                                this.swapDepths(_root.WindowsModule.counter);
                                _root.WindowsModule.counter++
                                if(this.Interface.cb.hitTest(_root._xmouse,_root._ymouse,true)){
                                        this.removeMovieClip();
                                }
                        }
                }
                else{
                        this.stopDrag();
                }
        }
        _root.WindowsModule.counter++
}


Usnul 16.06.2004 08:45

поправил маленько:
Код:

/* 
        Windows module Version 0.1 Usnul 06/2004 copyright (c)
        writen by Alex Goldring (Usnul) specially for mySQL,php,Flash forum in 2004 with refference to "Flash Windowed Intersace" version 8.1 and earlier versions by Usnul
*/
/*        Following code must be included in project for the module usage
        #include "windows.as"
        _root.skinpath="skins/default/window.swf"
*/
_root.createEmptyMovieClip("skin",20);
_root.skin.loadVariables("skins/default/settings.txt");
_root.skinpath="skins/default/";
_root.createEmptyMovieClip("WindowsModule",100); //Please do not forget to change the depth value
_root.WindowsModule.counter=1;
_root.WindowsModule.creWindow=function(name){
        _root.WindowsModule.createEmptyMovieClip("Window"+_root.WindowsModule.counter,_root.WindowsModule.counter);
        _root.WindowsModule["Window"+_root.WindowsModule.counter].createEmptyMovieClip("Interface",1);
        _root.WindowsModule["Window"+_root.WindowsModule.counter].createEmptyMovieClip("Content",2);
        _root.WindowsModule["Window"+_root.WindowsModule.counter].Interface.loadMovie(_root.skinpath+"window.swf");
        _root.WindowsModule["Window"+_root.WindowsModule.counter].name=name;
        _root.WindowsModule["Window"+_root.WindowsModule.counter].onEnterFrame=function(){
                if(this.Interface.getBytesLoaded()==this.Interface.getBytesTotal()){
                        if(this.Content._width>0){this.w=this.Content._width}else{this.w=150}
                        if(this.Content._height>0){this.h=this.Content._height}else{this.h=100}
                        this.Interface.ltc._x=this.Interface.ltc._y=0;
                        this.Interface.tb._x=this.Interface.bb._x=this.Interface.ltc._width;
                        this.Interface.tb._y=0;
                        this.Interface.tb._width=this.Interface.bb._width=this.w;
                        this.Interface.rtc._x=this.Interface.rb._x=this.Interface.rbc._x=this.Interface.tb._x+this.Interface.tb._width;
                        this.Interface.rtc._y=0;
                        this.Interface.lb._x=this.Interface.lbc._x=0;
                        this.Interface.lb._y=this.Interface.rb._y=this.Interface.ltc._height;
                        this.Interface.lb._height=this.Interface.rb._height=this.h;
                        this.Interface.lbc._y=this.Interface.rbc._y=this.Interface.bb._y=this.Interface.lb._y+this.Interface.lb._height;
                        this.Interface.cb._x=this.Interface.rtc._x-this.Interface.cb._width;
                        this.Interface.cb._y=(this.Interface.tb._height-this.Interface.cb._height)/2;
                        if(this.txt==undefined){
                        this.createTextField("txt",30,this.Interface.bb._x,0,this.Interface.lb._width,this.Interface.tb._height);
                        }
                        this.txt.autoSize=true;
                        this.txt.selectable=false;
                        this.TF=new TextFormat();
                        this.TF.font=_root.skin.WindowTitleFont;
                        this.TF.bold=_root.skin.WindowTitleFontBold;
                        this.TF.italic=_root.skin.WindowTitleFontItalic;
                        this.TF.color=_root.skin.WindowTitleFontColour;
                        this.txt.setNewTextFormat(this.TF);
                        this.txt.text=this.name;
                }
                if(Key.isDown(1)){
                        if(this.Interface.tb.hitTest(_root._xmouse,_root._ymouse,true)){
                                this.startDrag();
                                this.swapDepths(_root.WindowsModule.counter);
                                _root.WindowsModule.counter++
                                if(this.Interface.cb.hitTest(_root._xmouse,_root._ymouse,true)){
                                        this.removeMovieClip();
                                }
                        }
                }
                else{
                        this.stopDrag();
                }
        }
        _root.WindowsModule.counter++
}



Часовой пояс GMT +4, время: 18:02.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.