<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Accediendo al stage antes de tiempo</title>
	<atom:link href="http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/feed/" rel="self" type="application/rss+xml" />
	<link>http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/</link>
	<description>Blog de programación creativa mantenido por llops. Experimentos y artículos entorno a la plataforma flash y as3.</description>
	<lastBuildDate>Mon, 12 Jul 2010 17:57:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Kaus</title>
		<link>http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/comment-page-1/#comment-493</link>
		<dc:creator>Kaus</dc:creator>
		<pubDate>Sat, 29 May 2010 05:00:26 +0000</pubDate>
		<guid isPermaLink="false">http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/#comment-493</guid>
		<description>gracias men  si no encuentro esto para evitar ese error no se que haria ya me estaba desesperando me fue de gran ayuda, creeme  muchas gracias</description>
		<content:encoded><![CDATA[<p>gracias men  si no encuentro esto para evitar ese error no se que haria ya me estaba desesperando me fue de gran ayuda, creeme  muchas gracias</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: aquiles perez</title>
		<link>http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/comment-page-1/#comment-457</link>
		<dc:creator>aquiles perez</dc:creator>
		<pubDate>Sat, 27 Feb 2010 17:19:20 +0000</pubDate>
		<guid isPermaLink="false">http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/#comment-457</guid>
		<description>Hola todos, tengo una dudilla, por que este codigo no me trabaja, cuando creo un objeto en un frame de flash, no me muestra nada, sin embargo cuando agrego addChild(new GrettingApp) si trabaja, alguien me puede decir como puedo mostrar los graficos de esta clase sin poner esa instruccion, ya se que el stage es el tope, pero necesito referirme a el desde mi clase.
 
 saludos


[as3] package {
import flash.display.*;
import flash.text.TextField;
public class GreetingApp extends Sprite {
public function GreetingApp( ) {
// Create the Shape object
var rectAndCircle:Shape = new Shape( );
// Set line thickness to one pixel
rectAndCircle.graphics.lineStyle(1);
// Draw a blue rectangle
rectAndCircle.graphics.beginFill(0x0000FF, 1);
rectAndCircle.graphics.drawRect(125, 0, 150, 75);
// Draw a red circle
rectAndCircle.graphics.beginFill(0xFF0000, 1);
rectAndCircle.graphics.drawCircle(50, 100, 50);
// Move the shape to the right 125 pixels and down 100 pixels
rectAndCircle.x = 125;
rectAndCircle.y = 100;
// Show rectAndCircle on screen by adding it to the display list
addChild(rectAndCircle);
// Create a TextField object to contain some text
var greeting_txt:TextField = new TextField( );
// Specify the text to display
greeting_txt.text = &quot;Hello world&quot;;
// Position the text
greeting_txt.x = 200;
greeting_txt.y = 300;
// Show the text on screen by adding greeting_txt to the display list
addChild(greeting_txt);
}
}
}[/as3]</description>
		<content:encoded><![CDATA[<p>Hola todos, tengo una dudilla, por que este codigo no me trabaja, cuando creo un objeto en un frame de flash, no me muestra nada, sin embargo cuando agrego addChild(new GrettingApp) si trabaja, alguien me puede decir como puedo mostrar los graficos de esta clase sin poner esa instruccion, ya se que el stage es el tope, pero necesito referirme a el desde mi clase.</p>
<p> saludos</p>
<div class="igBar"><span id="lactionscript3-1"><a href="#" onclick="javascript:showCodeTxt('actionscript3-1'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite">
<div id="actionscript3-1">
<div class="actionscript3">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #1518ff;">package</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #1518ff;">import</span> flash.<span style="color: #000000;">display</span>.*;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #1518ff;">import</span> flash.<span style="color: #000000;">text</span>.<span style="color: #000099;">TextField</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #1518ff;">public</span> <span style="color: #1518ff;">class</span> GreetingApp <span style="color: #1518ff;">extends</span> <span style="color: #000099;">Sprite</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #1518ff;">public</span> <span style="color: #1518ff;">function</span> GreetingApp<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF9933; font-style: italic;">// Create the Shape object</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #1518ff;">var</span> rectAndCircle:<span style="color: #000099;">Shape</span> = <span style="color: #1518ff;">new</span> <span style="color: #000099;">Shape</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF9933; font-style: italic;">// Set line thickness to one pixel</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rectAndCircle.<span style="color: #000099;">graphics</span>.<span style="color: #000000;">lineStyle</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;color:#000099;">1</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF9933; font-style: italic;">// Draw a blue rectangle</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rectAndCircle.<span style="color: #000099;">graphics</span>.<span style="color: #000000;">beginFill</span><span style="color: #000000;">&#40;</span>0x0000FF, <span style="color: #FF0000;color:#000099;">1</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rectAndCircle.<span style="color: #000099;">graphics</span>.<span style="color: #000000;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;color:#000099;">125</span>, <span style="color: #FF0000;color:#000099;">0</span>, <span style="color: #FF0000;color:#000099;">150</span>, <span style="color: #FF0000;color:#000099;">75</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF9933; font-style: italic;">// Draw a red circle</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rectAndCircle.<span style="color: #000099;">graphics</span>.<span style="color: #000000;">beginFill</span><span style="color: #000000;">&#40;</span>0xFF0000, <span style="color: #FF0000;color:#000099;">1</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rectAndCircle.<span style="color: #000099;">graphics</span>.<span style="color: #000000;">drawCircle</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;color:#000099;">50</span>, <span style="color: #FF0000;color:#000099;">100</span>, <span style="color: #FF0000;color:#000099;">50</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF9933; font-style: italic;">// Move the shape to the right 125 pixels and down 100 pixels</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rectAndCircle.<span style="color: #000000;">x</span> = <span style="color: #FF0000;color:#000099;">125</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rectAndCircle.<span style="color: #000000;">y</span> = <span style="color: #FF0000;color:#000099;">100</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF9933; font-style: italic;">// Show rectAndCircle on screen by adding it to the display list</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">addChild<span style="color: #000000;">&#40;</span>rectAndCircle<span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF9933; font-style: italic;">// Create a TextField object to contain some text</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #1518ff;">var</span> greeting_txt:<span style="color: #000099;">TextField</span> = <span style="color: #1518ff;">new</span> <span style="color: #000099;">TextField</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF9933; font-style: italic;">// Specify the text to display</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">greeting_txt.<span style="color: #000000;">text</span> = <span style="color: #398EC6;">"Hello world"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF9933; font-style: italic;">// Position the text</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">greeting_txt.<span style="color: #000000;">x</span> = <span style="color: #FF0000;color:#000099;">200</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">greeting_txt.<span style="color: #000000;">y</span> = <span style="color: #FF0000;color:#000099;">300</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF9933; font-style: italic;">// Show the text on screen by adding greeting_txt to the display list</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">addChild<span style="color: #000000;">&#40;</span>greeting_txt<span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nilson</title>
		<link>http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/comment-page-1/#comment-421</link>
		<dc:creator>Nilson</dc:creator>
		<pubDate>Thu, 07 Jan 2010 04:47:54 +0000</pubDate>
		<guid isPermaLink="false">http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/#comment-421</guid>
		<description>Hola, creo que tengo el mismo problema que Matìas, pues los Movieclips los tengo ya en el escenariom pero al pulsar un botòn dentro de un MC que me dirija al Escenario principal, me arroja el error

aqui el còdigo dentro de un MC



grafico_BTN.addEventListener(MouseEvent.MOUSE_DOWN,grafico);

function grafico(Event:MouseEvent):void {
	root.imagen_mc.gotoAndStop(113);
}</description>
		<content:encoded><![CDATA[<p>Hola, creo que tengo el mismo problema que Matìas, pues los Movieclips los tengo ya en el escenariom pero al pulsar un botòn dentro de un MC que me dirija al Escenario principal, me arroja el error</p>
<p>aqui el còdigo dentro de un MC</p>
<p>grafico_BTN.addEventListener(MouseEvent.MOUSE_DOWN,grafico);</p>
<p>function grafico(Event:MouseEvent):void {<br />
	root.imagen_mc.gotoAndStop(113);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ccenta</title>
		<link>http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/comment-page-1/#comment-390</link>
		<dc:creator>Ccenta</dc:creator>
		<pubDate>Sat, 03 Oct 2009 20:17:34 +0000</pubDate>
		<guid isPermaLink="false">http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/#comment-390</guid>
		<description>Hola y gracias por el post, pero la misma dura me persiste a mi, por favor podria darme un pequeña ayuda.

Soy novato en todo esto. Resulta q estoy haciendo una pequeña aplicacion en actionscript 3.0 que desde una clase as3 todo ese pequeño trozo de codigo, intento llamarlo desde el mismo reproductor fla, la clase as3, dentro de esa clase tengo un parametro de MovieClip y desde el reproductor aplicando su parametro movieclip me vota cierto error

1120: Acceso a una propiedad stage no definida
1120: Acceso a una propiedad stage no definida

package
{
import flash.display.MovieClip;
public class Centrar
{
public var miclip:MovieClip = new MovieClip();
public function Centrar (clip):void
{
miclip = clip;
miclip.x = (stage.stageWidth - miclip.width) / 2;
miclip.y = (stage.stageHeight - miclip.height) / 2;

}
}
}

y lo llamo asi

import Centrar;
var movi:Centrar = new Centrar(cuadro_mc);

press control + enter y me vota este error

1120: Acceso a una propiedad stage no definida
1120: Acceso a una propiedad stage no definida

lo q intento es querer llamar por via codigo import, no por el mismo documento principal donde nada mas se pone el nombre de la clase, por favor ayuden</description>
		<content:encoded><![CDATA[<p>Hola y gracias por el post, pero la misma dura me persiste a mi, por favor podria darme un pequeña ayuda.</p>
<p>Soy novato en todo esto. Resulta q estoy haciendo una pequeña aplicacion en actionscript 3.0 que desde una clase as3 todo ese pequeño trozo de codigo, intento llamarlo desde el mismo reproductor fla, la clase as3, dentro de esa clase tengo un parametro de MovieClip y desde el reproductor aplicando su parametro movieclip me vota cierto error</p>
<p>1120: Acceso a una propiedad stage no definida<br />
1120: Acceso a una propiedad stage no definida</p>
<p>package<br />
{<br />
import flash.display.MovieClip;<br />
public class Centrar<br />
{<br />
public var miclip:MovieClip = new MovieClip();<br />
public function Centrar (clip):void<br />
{<br />
miclip = clip;<br />
miclip.x = (stage.stageWidth - miclip.width) / 2;<br />
miclip.y = (stage.stageHeight - miclip.height) / 2;</p>
<p>}<br />
}<br />
}</p>
<p>y lo llamo asi</p>
<p>import Centrar;<br />
var movi:Centrar = new Centrar(cuadro_mc);</p>
<p>press control + enter y me vota este error</p>
<p>1120: Acceso a una propiedad stage no definida<br />
1120: Acceso a una propiedad stage no definida</p>
<p>lo q intento es querer llamar por via codigo import, no por el mismo documento principal donde nada mas se pone el nombre de la clase, por favor ayuden</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ELSanto</title>
		<link>http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/comment-page-1/#comment-379</link>
		<dc:creator>ELSanto</dc:creator>
		<pubDate>Sat, 19 Sep 2009 05:08:10 +0000</pubDate>
		<guid isPermaLink="false">http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/#comment-379</guid>
		<description>hola. soy nuevo en este  tema, no se mucho pero ahi voy tratando de aprender.
Tengo una serie de botones que me llevan cada uno a una etiqueta, cada boton es una sola etiqueta pero en una de ellas debo ingresar dos botones para darle continuacion a la informacion. Quiero decir que cada boton tiene una sola pagina de información, pero uno de ellos tiene dos paginas y debo poner un boton de &quot;siguiente&quot; eneste pantallazo. cuando hago esto me sale el error #1009: este es el codigo que tengo...me pueden ayudar urgente?
[as3]//PROPOSITOS
Propositos_btn.addEventListener(MouseEvent.CLICK, TextProp);
function TextProp(event:MouseEvent):void
{
	gotoAndPlay(&quot;Propositos&quot;)
}
//REQUISITOS
Requisitos_btn.addEventListener(MouseEvent.CLICK, TextReq);
function TextReq(event:MouseEvent):void
{
	gotoAndPlay(&quot;Requisitos&quot;)
}
botonSiguiente_btn.addEventListener(MouseEvent.CLICK, TextReq_2);
function TextReq_2(event:MouseEvent):void
{
	gotoAndPlay(&quot;Requisitos2&quot;)
}[/as3]</description>
		<content:encoded><![CDATA[<p>hola. soy nuevo en este  tema, no se mucho pero ahi voy tratando de aprender.<br />
Tengo una serie de botones que me llevan cada uno a una etiqueta, cada boton es una sola etiqueta pero en una de ellas debo ingresar dos botones para darle continuacion a la informacion. Quiero decir que cada boton tiene una sola pagina de información, pero uno de ellos tiene dos paginas y debo poner un boton de "siguiente" eneste pantallazo. cuando hago esto me sale el error #1009: este es el codigo que tengo...me pueden ayudar urgente?</p>
<div class="igBar"><span id="lactionscript3-2"><a href="#" onclick="javascript:showCodeTxt('actionscript3-2'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite">
<div id="actionscript3-2">
<div class="actionscript3">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF9933; font-style: italic;">//PROPOSITOS</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Propositos_btn.<span style="color: #000000;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #000099;">MouseEvent</span>.<span style="color: #000000;">CLICK</span>, TextProp<span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #1518ff;">function</span> TextProp<span style="color: #000000;">&#40;</span><span style="color: #000099;">event</span>:<span style="color: #000099;">MouseEvent</span><span style="color: #000000;">&#41;</span>:<span style="color: #000099;">void</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; gotoAndPlay<span style="color: #000000;">&#40;</span><span style="color: #398EC6;">"Propositos"</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF9933; font-style: italic;">//REQUISITOS</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Requisitos_btn.<span style="color: #000000;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #000099;">MouseEvent</span>.<span style="color: #000000;">CLICK</span>, TextReq<span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #1518ff;">function</span> TextReq<span style="color: #000000;">&#40;</span><span style="color: #000099;">event</span>:<span style="color: #000099;">MouseEvent</span><span style="color: #000000;">&#41;</span>:<span style="color: #000099;">void</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; gotoAndPlay<span style="color: #000000;">&#40;</span><span style="color: #398EC6;">"Requisitos"</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">botonSiguiente_btn.<span style="color: #000000;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #000099;">MouseEvent</span>.<span style="color: #000000;">CLICK</span>, TextReq_2<span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #1518ff;">function</span> TextReq_2<span style="color: #000000;">&#40;</span><span style="color: #000099;">event</span>:<span style="color: #000099;">MouseEvent</span><span style="color: #000000;">&#41;</span>:<span style="color: #000099;">void</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; gotoAndPlay<span style="color: #000000;">&#40;</span><span style="color: #398EC6;">"Requisitos2"</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chefo</title>
		<link>http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/comment-page-1/#comment-337</link>
		<dc:creator>Chefo</dc:creator>
		<pubDate>Mon, 13 Apr 2009 08:18:10 +0000</pubDate>
		<guid isPermaLink="false">http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/#comment-337</guid>
		<description>Hola LLops, muy bueno el tutorial. Me ha funcionado al pelo!

 Sin embargo cuando he querido ampliarlo un poco ve he visto frente a un problema serio. Quiero tener un Main.as que sea el document y que llame a un Controlador.as que sea quie efectivamente llame al círculo. Tengo que pasar el stage hacia los futuros hijos

[as3]
        import flash.display.Sprite;
	import flash.display.Stage;
	import Circulo;
	public class Main extends Sprite {
		function Main() {
			var controlador:Controlador = new Controlador(stage);
			addChild(controlador);
		}
	}
[/as3]
[as3]
        public class Controlador extends MovieClip {
		public function Controlador(stageRef:Stage) {
			var c:Circulo = new Circulo(stageRef);
			addChild(c); 
		}
	}
[/as3]
Para Circulo ahora escucho stageRef en lugar de stage
[as3]
function Circulo(stageRef:Stage) {
			...
			this.stageRef=stageRef;
                       ...
}

private function init(e:Event):void
		{

			this.stageRef.addEventListener(MouseEvent.CLICK, clic);
		}
[/as3]

Hasta aqui todo va bien, pero si quiero editar a mano el objeto Circulo, es decir desde flash y no desde as. No se ve nada en la pantalla! Eso si que me ha dejado planchado. Mi objetivo es desde la clase Controlador.as cargar todos los simbolos de un juego y detectar un fin de partida para avisar a Main y que éste carge a traves de otro controlador otro juego. 

De momento estoy haciendo los juegos por separado, pero no puedo ensamblar sus clases principales a traves de un Main comun porque  no se ve nada, ademas de que para probar cada juego desde el Main tengo que pasar una instancia de stage hasta los hijos, con lo cual, cuando los edito con flash me fallan por que les sobra un parametro en el constructor (el parametro que les paso el stage).

Le he dado mil vueltas y leido muchos foros, pero no veo cual es el problema, a ver si me puedes orientar un poco Llop</description>
		<content:encoded><![CDATA[<p>Hola LLops, muy bueno el tutorial. Me ha funcionado al pelo!</p>
<p> Sin embargo cuando he querido ampliarlo un poco ve he visto frente a un problema serio. Quiero tener un Main.as que sea el document y que llame a un Controlador.as que sea quie efectivamente llame al círculo. Tengo que pasar el stage hacia los futuros hijos</p>
<div class="igBar"><span id="lactionscript3-3"><a href="#" onclick="javascript:showCodeTxt('actionscript3-3'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite">
<div id="actionscript3-3">
<div class="actionscript3">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #1518ff;">import</span> flash.<span style="color: #000000;">display</span>.<span style="color: #000099;">Sprite</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #1518ff;">import</span> flash.<span style="color: #000000;">display</span>.<span style="color: #000099;">Stage</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #1518ff;">import</span> Circulo;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #1518ff;">public</span> <span style="color: #1518ff;">class</span> Main <span style="color: #1518ff;">extends</span> <span style="color: #000099;">Sprite</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #1518ff;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #1518ff;">var</span> controlador:Controlador = <span style="color: #1518ff;">new</span> Controlador<span style="color: #000000;">&#40;</span><span style="color: #000099;">stage</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addChild<span style="color: #000000;">&#40;</span>controlador<span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="igBar"><span id="lactionscript3-4"><a href="#" onclick="javascript:showCodeTxt('actionscript3-4'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite">
<div id="actionscript3-4">
<div class="actionscript3">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #1518ff;">public</span> <span style="color: #1518ff;">class</span> Controlador <span style="color: #1518ff;">extends</span> <span style="color: #000099;">MovieClip</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #1518ff;">public</span> <span style="color: #1518ff;">function</span> Controlador<span style="color: #000000;">&#40;</span>stageRef:<span style="color: #000099;">Stage</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #1518ff;">var</span> c:Circulo = <span style="color: #1518ff;">new</span> Circulo<span style="color: #000000;">&#40;</span>stageRef<span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addChild<span style="color: #000000;">&#40;</span>c<span style="color: #000000;">&#41;</span>; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Para Circulo ahora escucho stageRef en lugar de stage</p>
<div class="igBar"><span id="lactionscript3-5"><a href="#" onclick="javascript:showCodeTxt('actionscript3-5'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite">
<div id="actionscript3-5">
<div class="actionscript3">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #1518ff;">function</span> Circulo<span style="color: #000000;">&#40;</span>stageRef:<span style="color: #000099;">Stage</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000099;">this</span>.<span style="color: #000000;">stageRef</span>=stageRef;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;...</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #1518ff;">private</span> <span style="color: #1518ff;">function</span> init<span style="color: #000000;">&#40;</span>e:<span style="color: #000099;">Event</span><span style="color: #000000;">&#41;</span>:<span style="color: #000099;">void</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000099;">this</span>.<span style="color: #000000;">stageRef</span>.<span style="color: #000000;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #000099;">MouseEvent</span>.<span style="color: #000000;">CLICK</span>, clic<span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Hasta aqui todo va bien, pero si quiero editar a mano el objeto Circulo, es decir desde flash y no desde as. No se ve nada en la pantalla! Eso si que me ha dejado planchado. Mi objetivo es desde la clase Controlador.as cargar todos los simbolos de un juego y detectar un fin de partida para avisar a Main y que éste carge a traves de otro controlador otro juego. </p>
<p>De momento estoy haciendo los juegos por separado, pero no puedo ensamblar sus clases principales a traves de un Main comun porque  no se ve nada, ademas de que para probar cada juego desde el Main tengo que pasar una instancia de stage hasta los hijos, con lo cual, cuando los edito con flash me fallan por que les sobra un parametro en el constructor (el parametro que les paso el stage).</p>
<p>Le he dado mil vueltas y leido muchos foros, pero no veo cual es el problema, a ver si me puedes orientar un poco Llop</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pablo</title>
		<link>http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/comment-page-1/#comment-321</link>
		<dc:creator>Pablo</dc:creator>
		<pubDate>Mon, 09 Mar 2009 16:45:07 +0000</pubDate>
		<guid isPermaLink="false">http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/#comment-321</guid>
		<description>Gracias, por tu explicación Llops. Practicaré lo que tan gentilmente me has explicado. Muchas Gracias y un Saludo.</description>
		<content:encoded><![CDATA[<p>Gracias, por tu explicación Llops. Practicaré lo que tan gentilmente me has explicado. Muchas Gracias y un Saludo.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: llops</title>
		<link>http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/comment-page-1/#comment-320</link>
		<dc:creator>llops</dc:creator>
		<pubDate>Sun, 08 Mar 2009 23:18:45 +0000</pubDate>
		<guid isPermaLink="false">http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/#comment-320</guid>
		<description>Buenas Pablo, &lt;strong&gt;creo&lt;/strong&gt; que lo que pasa es lo siguiente:
Con el DocumentClass, el archivo se inicializa y se añade a la displayList, pero cuando tú lo haces &quot;manualmente&quot; en el stage (tanto en el KoolMoves como en Flash), pasa algo como esto:

[as3]import Main;
var m:Main = new Main(); 
// Main en su constructor crea Circulo
// Circulo en su constructor detecta que ha sido añadido (ADDED) y llama a init()
// init contiene esta linea: 
this.stage.addEventListener(MouseEvent.CLICK, clic);
// se intenta añadir el listener al stage erroneamente, porque this (Circulo) no se ha añadido todavía a la displayList, ya que su padre (Main) tampoco lo está
// se genera el error
addChild(m) // llegamos un poco tarde... :)[/as3]
&#160;&lt;br /&gt;
En el ejemplo final que he puesto para descargar, en la clase Circulo, comenta la linea:
[as3]this.addEventListener(Event.ADDED, init);[/as3]
y descomenta esta:
[as3]this.addEventListener(Event.ADDED_TO_STAGE, init);[/as3]

Ahora sí se está esperando a que se añada Circulo a la display List (no al &quot;programa&quot;), y no debería generarte errores.
&#160;&lt;br /&gt;
Y si quieres evitar andar pensando cual va a ser el orden de ejecución del programa, siempre puedes hacer algo así:
[as3]import Main;
var m:Main = new Main(); 
addChild(m)
m.init();[/as3]

En el constructor del Main no pones nada e inicializas en un método público (init), habiéndote asegurado que ya está en displayList y que puedes añadir cualquier hijo.

Saludos!</description>
		<content:encoded><![CDATA[<p>Buenas Pablo, <strong>creo</strong> que lo que pasa es lo siguiente:<br />
Con el DocumentClass, el archivo se inicializa y se añade a la displayList, pero cuando tú lo haces "manualmente" en el stage (tanto en el KoolMoves como en Flash), pasa algo como esto:</p>
<div class="igBar"><span id="lactionscript3-6"><a href="#" onclick="javascript:showCodeTxt('actionscript3-6'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite">
<div id="actionscript3-6">
<div class="actionscript3">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #1518ff;">import</span> Main;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #1518ff;">var</span> m:Main = <span style="color: #1518ff;">new</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF9933; font-style: italic;">// Main en su constructor crea Circulo</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF9933; font-style: italic;">// Circulo en su constructor detecta que ha sido añadido (ADDED) y llama a init()</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF9933; font-style: italic;">// init contiene esta linea: </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000099;">this</span>.<span style="color: #000099;">stage</span>.<span style="color: #000000;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #000099;">MouseEvent</span>.<span style="color: #000000;">CLICK</span>, clic<span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF9933; font-style: italic;">// se intenta añadir el listener al stage erroneamente, porque this (Circulo) no se ha añadido todavía a la displayList, ya que su padre (Main) tampoco lo está</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF9933; font-style: italic;">// se genera el error</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">addChild<span style="color: #000000;">&#40;</span>m<span style="color: #000000;">&#41;</span> <span style="color: #FF9933; font-style: italic;">// llegamos un poco tarde... :) </span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
&nbsp;<br />
En el ejemplo final que he puesto para descargar, en la clase Circulo, comenta la linea:</p>
<div class="igBar"><span id="lactionscript3-7"><a href="#" onclick="javascript:showCodeTxt('actionscript3-7'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite">
<div id="actionscript3-7">
<div class="actionscript3">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000099;">this</span>.<span style="color: #000000;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #000099;">Event</span>.<span style="color: #000000;">ADDED</span>, init<span style="color: #000000;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
y descomenta esta:</p>
<div class="igBar"><span id="lactionscript3-8"><a href="#" onclick="javascript:showCodeTxt('actionscript3-8'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite">
<div id="actionscript3-8">
<div class="actionscript3">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000099;">this</span>.<span style="color: #000000;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #000099;">Event</span>.<span style="color: #000000;">ADDED_TO_STAGE</span>, init<span style="color: #000000;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Ahora sí se está esperando a que se añada Circulo a la display List (no al "programa"), y no debería generarte errores.<br />
&nbsp;<br />
Y si quieres evitar andar pensando cual va a ser el orden de ejecución del programa, siempre puedes hacer algo así:</p>
<div class="igBar"><span id="lactionscript3-9"><a href="#" onclick="javascript:showCodeTxt('actionscript3-9'); return false;">Plain Text</a></span></div>
<div class="syntax_hilite">
<div id="actionscript3-9">
<div class="actionscript3">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #1518ff;">import</span> Main;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #1518ff;">var</span> m:Main = <span style="color: #1518ff;">new</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">addChild<span style="color: #000000;">&#40;</span>m<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#666666;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">m.<span style="color: #000000;">init</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>En el constructor del Main no pones nada e inicializas en un método público (init), habiéndote asegurado que ya está en displayList y que puedes añadir cualquier hijo.</p>
<p>Saludos!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pablo</title>
		<link>http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/comment-page-1/#comment-318</link>
		<dc:creator>Pablo</dc:creator>
		<pubDate>Thu, 05 Mar 2009 14:54:36 +0000</pubDate>
		<guid isPermaLink="false">http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/#comment-318</guid>
		<description>Hola Llop, he de decirte que llevo tiempo buscando a alguien que me de una respuesta a esto pero aún no lo he encontrado, o bien no supe entender lo que me explicaron, mi problema es parecido, yo no utilizo Adobe CS3, uso KoolMoves un programa de bajo costo pero que en su ultima version incorpora AS3, este programa no tiene al igual que CS3 en el panel de propiedades, el campo Clase de Documento (el del lapicito), por lo que tengo que llamar a las clases desde el timeline con action script en el primer frame, yo utilizo para llamarlas al estage en el fotograma 1:

import Circulo;
var c:Circulo = new Circulo();
addChild(c);

Esto a veces funciona y otras no, por ejemplo con tu clase MainSelector.as:

import com.llops.MainSelector;
var selector:MainSelector = new MainSelector();
addChild(selector);

No funciona. ¿Por que? ¿ Es que todas las clases no se conportan igual? Gracias.</description>
		<content:encoded><![CDATA[<p>Hola Llop, he de decirte que llevo tiempo buscando a alguien que me de una respuesta a esto pero aún no lo he encontrado, o bien no supe entender lo que me explicaron, mi problema es parecido, yo no utilizo Adobe CS3, uso KoolMoves un programa de bajo costo pero que en su ultima version incorpora AS3, este programa no tiene al igual que CS3 en el panel de propiedades, el campo Clase de Documento (el del lapicito), por lo que tengo que llamar a las clases desde el timeline con action script en el primer frame, yo utilizo para llamarlas al estage en el fotograma 1:</p>
<p>import Circulo;<br />
var c:Circulo = new Circulo();<br />
addChild(c);</p>
<p>Esto a veces funciona y otras no, por ejemplo con tu clase MainSelector.as:</p>
<p>import com.llops.MainSelector;<br />
var selector:MainSelector = new MainSelector();<br />
addChild(selector);</p>
<p>No funciona. ¿Por que? ¿ Es que todas las clases no se conportan igual? Gracias.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: LLops</title>
		<link>http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/comment-page-1/#comment-312</link>
		<dc:creator>LLops</dc:creator>
		<pubDate>Thu, 12 Feb 2009 11:48:35 +0000</pubDate>
		<guid isPermaLink="false">http://llops.com/blog/2008/02/18/accediendo-al-stage-antes-de-tiempo/#comment-312</guid>
		<description>Hola Pilar, me temo que no te he entendido... como le comentaba a Matias (#8), si quieres contáctame y me detallas lo que quieres hacer.

Saludos!</description>
		<content:encoded><![CDATA[<p>Hola Pilar, me temo que no te he entendido... como le comentaba a Matias (#8), si quieres contáctame y me detallas lo que quieres hacer.</p>
<p>Saludos!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
