Usnul
16.06.2004, 04:44
вот простенький код окошек со скинами, разберайте =)
/*
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++
}
/*
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++
}