Código :
package clases{ import flash.utils.*; import flash.text.*; import flash.events.*; import flash.display.Sprite; import flash.display.Loader; import flash.display.*; import flash.net.*; import flash.display.DisplayObject; public dynamic class column01p extends Sprite{ var tempu:Timer= new Timer(30);var tempo:Timer= new Timer(30);var k:uint; var t:uint;var m:uint;var column:Sprite=new Sprite();var cuadre:Sprite=new Sprite(); var ff:uint;var n:int= new int();var j:uint; var ar01j:Array=new Array('','http://www.soloingenieria.net','http://www.soloingenieria.net/content/view/12/27/', 'http://www.soloingenieria.net/content/view/13/28/', 'http://www.soloingenieria.net/component/option,com_contact/Itemid,55/', 'http://www.soloingenieria.net/content/view/98/50/', 'http://www.soloingenieria.net/content/view/14/29/', 'http://www.soloingenieria.net/content/view/123/133/'); public dynamic function column01p(){ var Contenedorcuadre:Loader = new Loader();var cuadreurl:URLRequest=new URLRequest("./imatges/tira02.jpg"); Contenedorcuadre.load(cuadreurl);cuadre.scaleX=0;cuadre.scaleY=0;cuadre.x=100;cuadre.y=33; cuadre.addChild(Contenedorcuadre);var formato:TextFormat = new TextFormat ();formato.align="center"; formato.size=12;formato.bold=true;formato.color=0xFFFFFF; var ar01:Array=new Array('','Entra com','Usuari','Grup','Empresa','Tutor','Creador','Anònim'); var ar01x:Array=new Array(0,124,130,135,126,133,127,127); var ar01a:Array=new Array(0,0.85,0.85,0.85,0.85,0.85,0.85,0.85); var ar01i:Array=new Array('','','','','','','',''); var formato1:TextFormat = new TextFormat ();formato1.align="justify"; formato1.size=18;formato1.italic=true;formato1.color=0x6882b5; for(k=1;k<=7;k++){ this['bota'+k]=new Sprite;this['imma'+k]=new Sprite;this['cima'+k]=new Loader; this['imag'+k]=new URLRequest("./imatges/tira02.jpg");this['cima'+k].load(this['imag'+k]); this['imma'+k].scaleX=100;this['imma'+k].scaleY=0.29; this['imma'+k].x=100;this['imma'+k].y=30;this['imma'+k].addChild(this['cima'+k]); this['text'+k]=new TextField;this['text'+k].autoSize= TextFieldAutoSize.CENTER; this['text'+k].defaultTextFormat = formato;this['text'+k].text=ar01[k]; this['text'+k].x=ar01x[k];this['text'+k].border=false;this['text'+k].selectable=false; this['text'+k].y=31;this['bota'+k].name='bota'+k;//this['text'+k].name='im'+k; this['text1'+k]=new TextField;this['text1'+k].wordWrap=true;this['text1'+k].width=288; this['text1'+k].autoSize= TextFieldAutoSize.LEFT;this['text1'+k].defaultTextFormat = formato1; this['text1'+k].text=ar01i[k];this['text1'+k].x=ar01x[k];this['text1'+k].border=true; this['text1'+k].borderColor=0xf8f8f8;this['text1'+k].alpha=0.8; this['text1'+k].selectable=false;this['text1'+k].y=52;this['text1'+k].x=510; } for(t=2;t<=7;t++){ this['bota'+t].mouseChildren=false; this['bota'+t].addEventListener(MouseEvent.ROLL_OVER, alpha07v); this['bota'+t].addEventListener(MouseEvent.ROLL_OUT, alpha07u); this['bota'+t].addEventListener(MouseEvent.CLICK,linkopen01); } tempo.addEventListener(TimerEvent.TIMER,centesim); this['bota'+1].addEventListener(MouseEvent.ROLL_OVER, funcio01); tempu.addEventListener(TimerEvent.TIMER,centesimu); column.addEventListener(MouseEvent.ROLL_OUT, funcio01u); cuadre.alpha=0;column.addChild(cuadre); for(m=1;m<=7;m++){ ff=(8-m);ff=(8-m);this['bota'+ff].addChild(this['imma'+ff]);this['bota'+ff].addChild(this['text'+ff]); this['bota'+ff].alpha=0.85;column.addChild(this['bota'+ff]);}addChild(column); } public dynamic function funcio01 (e:Event){cuadre.scaleX=100;cuadre.scaleY=1.87;tempo.start();tempu.reset();} public dynamic function funcio01u (e:Event){cuadre.scaleX=100;cuadre.scaleY=1.87;tempu.start();tempo.reset();} public dynamic function centesim (event:TimerEvent):int{n=this['bota'+1].y;if(this['bota'+1].y<3){this['bota'+1].y+=1;this['bota'+7].y+=8;this['bota'+2].y+=15;this['bota'+3].y+=22;this['bota'+4].y+=29;this['bota'+5].y+=36;this['bota'+6].y+=43;}if(this['bota'+1].y>=3){tempo.stop();tempo.reset();this['bota'+1].y=3;}return n;} public dynamic function centesimu (event:TimerEvent):int{n=this['bota'+1].y;if(this['bota'+1].y>0){this['bota'+1].y-=1;this['bota'+7].y-=8;this['bota'+2].y-=15;this['bota'+3].y-=22;this['bota'+4].y-=29;this['bota'+5].y-=36;this['bota'+6].y-=43;}if(this['bota'+1].y<=0){tempu.stop();tempu.reset();this['bota'+1].y=0;}return n;} public dynamic function alpha07v (e:MouseEvent):void{this['bota'+e.target.name.substr(4)].alpha=1;addChild(this['text1'+e.target.name.substr(4)]);} public dynamic function alpha07u (e:MouseEvent):void{this['bota'+e.target.name.substr(4)].alpha=0.85;removeChild(this['text1'+e.target.name.substr(4)]);} public dynamic function linkopen01 (e:MouseEvent):void {trace (e.target.name.substr(4));}}}
el fichero fla entonces podria ser
Código :
import clases.*; var auk:column01p= new column01p(); addChild(auk);
supongamos que tenemos otro fichero el cual se llama column02 el cual es el mismo excepto que esta 100 pixeles desplazado a la derecha como por ejemplo
Código :
package clases{import flash.utils.*;import flash.text.*;import flash.events.*;import flash.display.Sprite;import flash.display.Loader;import flash.display.*; import flash.net.*;import flash.display.DisplayObject; public dynamic class column02 extends Sprite{var tempu:Timer= new Timer(30);var tempo:Timer= new Timer(30);var k:uint;var t:uint;var m:uint;var column:Sprite=new Sprite();var cuadre:Sprite=new Sprite();var ff:uint;var n:int= new int();var j:uint;var ar01j:Array=new Array('','http://www.soloingenieria.net','http://www.soloingenieria.net/content/view/12/27/','http://www.soloingenieria.net/content/view/13/28/','http://www.soloingenieria.net/component/option,com_contact/Itemid,55/','http://www.soloingenieria.net/content/view/98/50/','http://www.soloingenieria.net/content/view/14/29/','http://www.soloingenieria.net/content/view/123/133/'); public dynamic function column02(){var Contenedorcuadre:Loader = new Loader();var cuadreurl:URLRequest=new URLRequest("./imatges/tira02.jpg");Contenedorcuadre.load(cuadreurl);cuadre.scaleX=0;cuadre.scaleY=0;cuadre.x=200;cuadre.y=33;cuadre.addChild(Contenedorcuadre);var formato:TextFormat = new TextFormat ();formato.align="center";formato.size=12;formato.bold=true;formato.color=0xFFFFFF;var ar01:Array=new Array('','Entra com','Usuari','Grup','Empresa','Tutor','Creador','Anònim');var ar01x:Array=new Array(0,224,230,235,226,233,227,227);var ar01a:Array=new Array(0,0.85,0.85,0.85,0.85,0.85,0.85,0.85);var ar01i:Array=new Array('','','Si vols guardar els avanços per anar formant el teu curriculum, pitja aquí.',"Si formes part d'un grup fora de l'àmbit empresarial i vols crear forums de debat i opinio, pitja aquí.","Si dirigeixes una empresa o formes part de la directiva d'una empresa i vols representar l'empresa i els seus productes pitja aquí.","Si formes part d'un grup d'ensenyament, escola, institut, universitat i vols crear rutes d'ensenyament de forma privada per els teus alumnes o pública pels usuaris a nivell global, pitja aquí.",'Si formes part del grup BLAUSUN pitja aquí.','Si vols entrar de manera anònima, pitja aquí, considera que els avanços que hagis conseguit no quederán grabats.');var formato1:TextFormat = new TextFormat ();formato1.align="justify";formato1.size=18;formato1.italic=true;formato1.color=0x6882b5; for(k=1;k<=7;k++){this['bota'+k]=new Sprite;this['imma'+k]=new Sprite;this['cima'+k]=new Loader;this['imag'+k]=new URLRequest("./imatges/tira02.jpg");this['cima'+k].load(this['imag'+k]);this['imma'+k].scaleX=100;this['imma'+k].scaleY=0.29;this['imma'+k].x=200;this['imma'+k].y=30;this['imma'+k].addChild(this['cima'+k]);this['text'+k]=new TextField;this['text'+k].autoSize= TextFieldAutoSize.CENTER;this['text'+k].defaultTextFormat = formato;this['text'+k].text=ar01[k];this['text'+k].x=ar01x[k];this['text'+k].border=false;this['text'+k].selectable=false;this['text'+k].y=31;this['bota'+k].name='bota'+k;this['text'+k].name='im'+k;this['text1'+k]=new TextField;this['text1'+k].wordWrap=true;this['text1'+k].width=288;this['text1'+k].autoSize= TextFieldAutoSize.LEFT;this['text1'+k].defaultTextFormat = formato1;this['text1'+k].text=ar01i[k];this['text1'+k].x=ar01x[k];this['text1'+k].border=true;this['text1'+k].borderColor=0xf8f8f8;this['text1'+k].alpha=0.8;this['text1'+k].selectable=false;this['text1'+k].y=52;this['text1'+k].x=510;} for(t=2;t<=7;t++){this['bota'+t].addEventListener(MouseEvent.ROLL_OVER, alpha07v);this['bota'+t].addEventListener(MouseEvent.ROLL_OUT, alpha07u);this['bota'+t].addEventListener(MouseEvent.CLICK,linkopen01);} tempo.addEventListener(TimerEvent.TIMER,centesim);this['bota'+1].addEventListener(MouseEvent.ROLL_OVER, funcio01);tempu.addEventListener(TimerEvent.TIMER,centesimu);column.addEventListener(MouseEvent.ROLL_OUT, funcio01u);cuadre.alpha=0;column.addChild(cuadre); for(m=1;m<=7;m++){ff=(8-m);ff=(8-m);this['bota'+ff].addChild(this['imma'+ff]);this['bota'+ff].addChild(this['text'+ff]);this['bota'+ff].alpha=0.85;column.addChild(this['bota'+ff]);}addChild(column);} public dynamic function funcio01 (e:Event){cuadre.scaleX=100;cuadre.scaleY=1.87;tempo.start();tempu.reset();} public dynamic function funcio01u (e:Event){cuadre.scaleX=100;cuadre.scaleY=1.87;tempu.start();tempo.reset();} public dynamic function centesim (event:TimerEvent):int{n=this['bota'+1].y;if(this['bota'+1].y<3){this['bota'+1].y+=1;this['bota'+7].y+=8;this['bota'+2].y+=15;this['bota'+3].y+=22;this['bota'+4].y+=29;this['bota'+5].y+=36;this['bota'+6].y+=43;}if(this['bota'+1].y>=3){tempo.stop();tempo.reset();this['bota'+1].y=3;}return n;} public dynamic function centesimu (event:TimerEvent):int{n=this['bota'+1].y;if(this['bota'+1].y>0){this['bota'+1].y-=1;this['bota'+7].y-=8;this['bota'+2].y-=15;this['bota'+3].y-=22;this['bota'+4].y-=29;this['bota'+5].y-=36;this['bota'+6].y-=43;}if(this['bota'+1].y<=0){tempu.stop();tempu.reset();this['bota'+1].y=0;}return n;} public dynamic function alpha07v (e:MouseEvent):void{this['bota'+e.target.name.substr(4)].alpha=1;addChild(this['text1'+e.target.name.substr(4)]);} public dynamic function alpha07u (e:MouseEvent):void{this['bota'+e.target.name.substr(4)].alpha=0.85;removeChild(this['text1'+e.target.name.substr(4)]);} public dynamic function linkopen01 (e:MouseEvent):void {navigateToURL(new URLRequest(ar01j[e.target.name.substr(2)]));}}}
al ejecutar en el flash me genera unos botones que son los correspondientes a column01p bien mi pregunta es la siguiente, sin poner nada mas que el codigo que habeis visto en el fla puedo hacer que algun boton del column01p que es el unico que aparece, me haga desaparecer la variable auk es decir me haga un removeChild y me lo vuelva a ejecutar ese auk pero como column02, bien podria poner condicionales en el fla y eso se podria hacer, pero la idea seria trabajar siempre desde los .as sin cambiar nada del fla, no se si me explico, de todas formas eso se puede hacer con links de todas formas seria interesante solo trabajar desde ficheros .as ya que estos los puedo crear facilmente en php y hacer que un boton me ejecute un php que me genera un fichero column01p totalmente diferente que me hace cambiar todo en un momento, la idea seria principalmente hacer algo como esto en column01p,
Código :
public dynamic function linkopen01 (e:MouseEvent):void {stage.removeChild(auk);var auk:column02= new column02(); stage.addChild(auk);evidentemente tendria que poner un import clases.column02 en el package de column01, me lo ejecutaria correctamente? mientras tanto pongo la pregunta voy probando, gracias de antemano por leerme.