Tema: Error en AS3
Ver Mensaje Individual
  #2 (permalink)  
Antiguo 22/05/2009, 18:41
Avatar de Lynxcraft
Lynxcraft
 
Fecha de Ingreso: noviembre-2007
Ubicación: yecla murcia
Mensajes: 1.346
Antigüedad: 16 años, 5 meses
Puntos: 51
Respuesta: Error en AS3

para meter un mc creado en otro mc utiliza addChild()

import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;

stop();

inicio_mc.addEventListener(MouseEvent.CLICK, onClick);
basico_mc.addEventListener(MouseEvent.CLICK, onClick);
shop_mc.addEventListener(MouseEvent.CLICK, onClick);
anim_mc.addEventListener(MouseEvent.CLICK, onClick);
contacto_mc.addEventListener(MouseEvent.CLICK, onClick);

inicio_mc.buttonMode = true;
basico_mc.buttonMode = true;
shop_mc.buttonMode = true;
anim_mc.buttonMode = true;
contacto_mc.buttonMode = true;

inicio_mc.mcTarget.addChild(new pageInicio())
basico_mc.mcTarget.addChild(new pageBasico())
shop_mc.mcTarget.addChild(new pageShop())
anim_mc.mcTarget.addChild( new pageAnim())
contacto_mc.mcTarget.addChild(new pageContacto())

var currentPage:MovieClip = inicio;
var nextPage:MovieClip;

inicio.alpha = 0;
inicio.x = 380;
inicio.y = 184;
addChild(inicio);

var myTween:Tween = new Tween(inicio,"alpha",Strong.easeOut,0,1,1,true);

function onClick(e:MouseEvent):void
{
inicio_mc.enabled = false;
basico_mc.enabled = false;
shop_mc.enabled = false;
anim_mc.enabled = false;
contacto_mc.enabled = false;
inicio_mc.removeEventListener(MouseEvent.CLICK, onClick);
basico_mc.removeEventListener(MouseEvent.CLICK, onClick);
shop_mc.removeEventListener(MouseEvent.CLICK, onClick);
anim_mc.removeEventListener(MouseEvent.CLICK, onClick);
contacto_mc.removeEventListener(MouseEvent.CLICK, onClick);
nextPage = e.currentTarget.mcTarget;
var offTween:Tween = new Tween(currentPage,"alpha",Strong.easeOut,1,0,6,fal se);
offTween.addEventListener(TweenEvent.MOTION_FINISH , onTween);
}

function onTween(e:TweenEvent):void
{
removeChild(currentPage);
currentPage = nextPage;
currentPage.alpha = 0;
currentPage.x = 380;
currentPage.y = 184;
addChild(currentPage);
var tweenOn:Tween = new Tween(currentPage,"alpha",Strong.easeOut,0,1,6,fal se);
tweenOn.addEventListener(TweenEvent.MOTION_FINISH, enableAll);
}

function enableAll(e:TweenEvent):void
{
inicio_mc.enabled = true;
basico_mc.enabled = true;
shop_mc.enabled = true;
anim_mc.enabled = true;
contacto_mc.enabled = true;
inicio_mc.addEventListener(MouseEvent.CLICK, onClick);
basico_mc.addEventListener(MouseEvent.CLICK, onClick);
shop_mc.addEventListener(MouseEvent.CLICK, onClick);
anim_mc.addEventListener(MouseEvent.CLICK, onClick);
contacto_mc.addEventListener(MouseEvent.CLICK, onClick);
}
__________________
Sobran las ideas cuando faltan ganas de trabajar en ellas
Lynxcraft