Foros del Web » Creando para Internet » Flash y Actionscript »

Error en AS3

Estas en el tema de Error en AS3 en el foro de Flash y Actionscript en Foros del Web. Estoy haciendo una pagina sencilla con 5 secciones, en action script he programado que cada vez que haces clic la pagina actual se desvanesca, y ...
  #1 (permalink)  
Antiguo 22/05/2009, 12:47
 
Fecha de Ingreso: mayo-2009
Mensajes: 71
Antigüedad: 14 años, 11 meses
Puntos: 0
Error en AS3

Estoy haciendo una pagina sencilla con 5 secciones, en action script he programado que cada vez que haces clic la pagina actual se desvanesca, y a la que hiciste clic haga lo contrario, vaya apareciendo.. todo funciona bn pero al hacer clic en la seccion de contactenos me aparece el siguiente error:

TypeError: Error #2007: El valor del parámetro child debe ser distinto de null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/drawNow()
at fl.controls::ScrollBar/fl.controls:ScrollBar::draw()
at fl.controls::UIScrollBar/fl.controls:UIScrollBar::draw()
at fl.core::UIComponent/drawNow()
at fl.controls::TextArea/fl.controls:TextArea::updateScrollBars()
at fl.controls::TextArea/fl.controls:TextArea::drawLayout()
at fl.controls::TextArea/fl.controls:TextArea::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: El valor del parámetro child debe ser distinto de null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/drawNow()
at fl.controls::ScrollBar/fl.controls:ScrollBar::draw()
at fl.controls::UIScrollBar/fl.controls:UIScrollBar::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: El valor del parámetro child debe ser distinto de null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: El valor del parámetro child debe ser distinto de null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::LabelButton/fl.controls:LabelButton::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: El valor del parámetro child debe ser distinto de null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: El valor del parámetro child debe ser distinto de null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: El valor del parámetro child debe ser distinto de null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/drawNow()
at fl.controls::ScrollBar/fl.controls:ScrollBar::draw()
at fl.controls::UIScrollBar/fl.controls:UIScrollBar::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: El valor del parámetro child debe ser distinto de null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: El valor del parámetro child debe ser distinto de null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::LabelButton/fl.controls:LabelButton::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: El valor del parámetro child debe ser distinto de null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/::callLaterDispatcher()
TypeError: Error #2007: El valor del parámetro child debe ser distinto de null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/fl.controls:BaseButton::drawBackground()
at fl.controls::BaseButton/fl.controls:BaseButton::draw()
at fl.core::UIComponent/::callLaterDispatcher()




dejo aqui mi codigo.. toda la pagina corre sobre un solo fotograma. de verdad cualquier ayuda es apreciada..


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;

var inicio:pageInicio = new pageInicio();
var basico:pageBasico = new pageBasico();
var shop:pageShop = new pageShop();
var anim:pageAnim = new pageAnim();
var contacto:pageContacto = new pageContacto();

inicio_mc.mcTarget = inicio;
basico_mc.mcTarget = basico;
shop_mc.mcTarget = shop;
anim_mc.mcTarget = anim;
contacto_mc.mcTarget = contacto;

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);
}
  #2 (permalink)  
Antiguo 22/05/2009, 18:41
Avatar de 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
  #3 (permalink)  
Antiguo 22/05/2009, 23:59
 
Fecha de Ingreso: mayo-2009
Mensajes: 71
Antigüedad: 14 años, 11 meses
Puntos: 0
Respuesta: Error en AS3

gracias, voy a chequear a ver que tal
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:22.