<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Weird parent thing (bug?) in Flash</title>
	<link>http://www.tyz.nl/2009/06/23/weird-parent-thing-bug-in-flash/</link>
	<description>Flash Developer</description>
	<pubDate>Mon, 06 Feb 2012 07:34:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>

	<item>
		<title>By: Thijs</title>
		<link>http://www.tyz.nl/2009/06/23/weird-parent-thing-bug-in-flash/#comment-2661</link>
		<author>Thijs</author>
		<pubDate>Thu, 25 Jun 2009 12:20:52 +0000</pubDate>
		<guid>http://www.tyz.nl/2009/06/23/weird-parent-thing-bug-in-flash/#comment-2661</guid>
		<description>Hey Patrick,

Timeline vs code is always tricky. The best practice is to not combine them. But sometimes you don't have a choice.

But actually the added_to_stage event is also fired on timeline clips. But you can't catch them with timeline code, since the event is already dispatched before you could add the listener. 

So I kind of solved to problem to create a class for all objects and set listeners to the 'added' and 'removed' events to keep track of the object has a parent or not. If the object has a parent (and .parent is not null) you can safely do 'this.parent.contains(this)'. Otherswise I'll do 'this.parent.contains(this)' within a try-catch block. I know, it's still dirty...</description>
		<content:encoded><![CDATA[<p>Hey Patrick,</p>
<p>Timeline vs code is always tricky. The best practice is to not combine them. But sometimes you don&#8217;t have a choice.</p>
<p>But actually the added_to_stage event is also fired on timeline clips. But you can&#8217;t catch them with timeline code, since the event is already dispatched before you could add the listener. </p>
<p>So I kind of solved to problem to create a class for all objects and set listeners to the &#8216;added&#8217; and &#8216;removed&#8217; events to keep track of the object has a parent or not. If the object has a parent (and .parent is not null) you can safely do &#8216;this.parent.contains(this)&#8217;. Otherswise I&#8217;ll do &#8216;this.parent.contains(this)&#8217; within a try-catch block. I know, it&#8217;s still dirty&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick</title>
		<link>http://www.tyz.nl/2009/06/23/weird-parent-thing-bug-in-flash/#comment-2660</link>
		<author>Patrick</author>
		<pubDate>Thu, 25 Jun 2009 12:07:14 +0000</pubDate>
		<guid>http://www.tyz.nl/2009/06/23/weird-parent-thing-bug-in-flash/#comment-2660</guid>
		<description>Hi Thijs!

Animations on timeline according to code is always a pain in the ass! My guess is that you've assigned the enterframe event on the actual mc that is put on stage in timeline and not by code. The frame of this clip is async with the main timeline frame, so the mc isn't initialized (the added_to_stage event is never fired, only the removed_from_stage will be fired). It's odd that the timeline contains the actual clip while the timeline hasn't any children!</description>
		<content:encoded><![CDATA[<p>Hi Thijs!</p>
<p>Animations on timeline according to code is always a pain in the ass! My guess is that you&#8217;ve assigned the enterframe event on the actual mc that is put on stage in timeline and not by code. The frame of this clip is async with the main timeline frame, so the mc isn&#8217;t initialized (the added_to_stage event is never fired, only the removed_from_stage will be fired). It&#8217;s odd that the timeline contains the actual clip while the timeline hasn&#8217;t any children!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

