le comparto una clase en la libreria de su fla deven de tener los componentes Button y Label ademas de un movieclip con linkage.. = "cuerpo_nota"
y la mandaran llamar de la siguiente manera
Código :
win = new NewWindow(_root,"cuerpo_nota"); win.showWindow();
la clase es la siguiente y deve de estar en el mismo directorio que el archivo fla
Código :
class NewWindow { private var padre:MovieClip; private var yo:MovieClip;//mc que contiene la ventana private var cpo:MovieClip;//contiene el mc de contenido de la ventana private var topBar:MovieClip;//es la barra superioir de la ventana private var cont:String;//el nombre del contenido en la libreria private var cont_mc:MovieClip;//es el mc del contenido //---dimenciones de la ventana function NewWindow(padre_:MovieClip,cont_:String){ padre=padre_; cont=cont_ //yo=padre.createEmptyMovieClip("win"+padre.getNextHighestDepth(),padre.getNextHighestDepth()) yo=padre.createEmptyMovieClip("winx",padre.getNextHighestDepth()) topBar=yo.createEmptyMovieClip("sb",yo.getNextHighestDepth()); cpo= yo.createEmptyMovieClip("cpo",yo.getNextHighestDepth()); cont_mc=cpo.attachMovie(cont,"cont",cpo.getNextHighestDepth()); //yo._visible=false; } function showWindow(w_,h_:Number){ var w,h:Number; //--------------establesco el ancho y alto de la ventana-------------- if (!w_){ //trace("la ventana no tiene valor en width") w=cont_mc._width; }else{w=w_;} if (!h_){ //trace("la ventana no tiene valor en height") h=cont_mc._height; }else{h=h_;} trace(w+","+h); createTopBar(w); createTitle(); createButons(); } function createTopBar(w_){ var bar = topBar.createEmptyMovieClip("tb_bk",topBar.getNextHighestDepth()); var h_=20; var colors = [ 0x000066, 0x0065FD ]; var alphas = [ 100, 80 ]; var ratios = [ 0, 0xFF ]; bar.lineStyle (3,0x0066ff); //matrix = { a:100,b:0,c:0,d:0,e:200,f:0,g:350,h:200,i:1}; //matrix = { a:10,b:1,c:0}; var matrix = { matrixType:"box", x:0, y:0, w:20, h:70, r:(45/180)*Math.PI }; bar.beginGradientFill("linear", colors, alphas, ratios, matrix ); //bar.moveTo (nodeG.l._x,nodeG.l._y); bar.lineTo (bar._x+w_ , bar._y); bar.lineTo (bar._x+w_ ,bar._y+h_); bar.lineTo (bar._x,bar._y+h_); bar.lineTo (bar._x,bar._y); bar.endFill(); cpo._y+=h_; bar.controller=this; bar.onPress=function(){ //trace("me esta presionando"); this.controller.yo.startDrag(); trace(this) } bar.onRelease=function(){ //trace("me solto"); this.controller.yo.stopDrag(); } } function createTitle(){ //trace("creando titulo de ventana") var lb = topBar.attachMovie("Label","l",topBar.getNextHighestDepth()) //trace(lb) lb.autoSize="rigth"; lb.setStyle("color",0x00ffff); lb.setStyle("fontSize",14); lb.setStyle("fontWeight","bold"); lb.setStyle("fontFamily","Arial"); lb.text="12345678901234567890123456789"; } function createButons(){ //trace("creando botones"); createCloseButon(); createMinButon(); } function createMinButon(){ //trace("creando boton de cerrar"); var btn=topBar.attachMovie("Button","minBtn",topBar.getNextHighestDepth()); //trace(btn._width+","+btn._height) var margen =4; var tam=topBar._height-margen; btn.setSize(tam,tam); btn.label="-" btn._x=topBar._width-(margen+tam)*2; btn.onRelease=function(){ trace("Minimizando"); } } function createCloseButon(){ var btn=topBar.attachMovie("Button","closeBtn",topBar.getNextHighestDepth()); //trace(btn._width+","+btn._height) //trace("-->"+topBar._height) var margen =4; var tam=topBar._height-margen; btn.setSize(tam,tam); btn.label="X" btn._x=topBar._width-margen-tam; btn.controller=this; btn.onRelease=function(){ trace(this._parent._parent); //removeMovieClip(this.controller.padre.win); /********************************************problema************************************************************** no puedo hacer un removeMovieClip a toda la ventana que esta referida en yo de esta clase */ // removeMovieClip(this._parent)//esto borra la barra superior de la ventana removeMovieClip(this.controller.yo);//esto no se ejecuta y no borra la ventana completa /*********************************************************************************************************************** */ trace("yo "+this.controller.yo); trace("yo.sb "+this.controller.yo.sb); trace("yo.cpo "+this.controller.yo.cpo); } } }
alguna sugerencia???
Alguien sabe por que no puedo aplicar el removeMovieClip a la ventana completa ???