Comunidad de diseño web y desarrollo en internet online

problemas con importar archivos as

Citar            
MensajeEscrito el 04 Feb 2010 11:21 am
Ando como loca para poder importar dos classes as a mi archivo flash. Tengo un archivo flas con cinco botones, y 5 clip de peliculas, el primer clip situado en el fotograma 1, el segundo en el fotograma 2, y asi hasta llegar al fotograma 5. Ahora tengo dos classes, la clase Main (que contiene las funciones de los botones) y la clase FrameInOut (que contien la funcion de los clip de pelicula), el problema que no se como importar esas dos classes a mi archivo flash, he provado varias cosas pero me da error. Agradecería vuestra ayuda, muchas gracias, Maite
CLASE MAIN
[as]package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
//
public class Main extends MovieClip {

public var currentFrameClip:MovieClip;

public function Main() {
this.boton1.addEventListener(MouseEvent.CLICK,gotoFrame);
this.boton2.addEventListener(MouseEvent.CLICK,gotoFrame);
this.boton3.addEventListener(MouseEvent.CLICK,gotoFrame);
this.boton4.addEventListener(MouseEvent.CLICK,gotoFrame);
this.boton5.addEventListener(MouseEvent.CLICK,gotoFrame);
this.stop();
}
public function gotoFrame(e:MouseEvent):void {
switch (e.currentTarget) {
case boton1 :
currentFrameClip.gotoFrame(1);
break;
case boton2 :
currentFrameClip.gotoFrame(2);
break;
case boton3 :
currentFrameClip.gotoFrame(3);
break;
case boton4 :
currentFrameClip.gotoFrame(4);
break;
case boton5 :
currentFrameClip.gotoFrame(5);
break;
}
}
}
}[/as]
CLASE FRAMEINOUT
[as]package {
import flash.display.MovieClip;
import flash.events.Event;
//
public class FrameInOut extends MovieClip {

public var goto:uint;
//
public function FrameInOut() {
MovieClip(this.parent).currentFrameClip=this;
frameIntro();
}
public function gotoFrame(frame:uint):void {
if (frame!=MovieClip(this.parent).currentFrame) {
goto=frame;
this.gotoAndStop("on");
this.addEventListener(Event.ENTER_FRAME,avanzaFrame);
}
}
public function frameIntro():void {
this.gotoAndStop("out");
this.addEventListener(Event.ENTER_FRAME,retrocedeFrame);
}
public function retrocedeFrame(e:Event):void {
if (this.currentLabel=="on") {
this.removeEventListener(Event.ENTER_FRAME,retrocedeFrame);
} else {
this.prevFrame();
}
}
public function avanzaFrame(e:Event):void {
if (this.currentLabel=="out") {
this.removeEventListener(Event.ENTER_FRAME,avanzaFrame);
MovieClip(this.parent).gotoAndStop(goto);
} else {
this.nextFrame();
}
}
}
}[/as]

Por Maite

30 de clabLevel



Genero:Femenino  

Badajoz/España

msie7
Citar            
MensajeEscrito el 04 Feb 2010 11:57 am
La Clase Main es la "Clase de documento". Así que, si abres tu .fla, en la ventana de propiedades le indicas que es de la Clase de Documento Main
La Clase "FrameInOut" es la clase a la que pertenecen tus símbolos. Así pues la clase base de tus símbolos serán (en lugar de MovieClip) FrameInOut
Echalé un ojo al post de Llops

Por Eliseo2

710 de clabLevel



 

firefox
Citar            
MensajeEscrito el 04 Feb 2010 01:36 pm
Muchas gracias Eliseo2, me has solucionado un problema que llevaba horas volviendo me loca, mil gracias, da gusto encontarse con gente con muchas ganas de ayudar. :wink:

Por Maite

30 de clabLevel



Genero:Femenino  

Badajoz/España

msie7

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.