<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
	>
<channel>
	<title>Comments on: Flash CS3 &#8211; Quote Rotator</title>
	<atom:link href="http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.six4rty.ch</link>
	<description>Code &#38; Technology Aficionado - Come for the Flash, stay for more!</description>
	<lastBuildDate>Thu, 29 Jul 2010 22:32:41 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: jack</title>
		<link>http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/comment-page-1/#comment-61900</link>
		<dc:creator>jack</dc:creator>
		<pubDate>Fri, 06 Nov 2009 20:33:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/#comment-61900</guid>
		<description>This is great, but I&#039;m curious how you remove the random rotation and make it cycle in the order of the XML?</description>
		<content:encoded><![CDATA[<p>This is great, but I&#8217;m curious how you remove the random rotation and make it cycle in the order of the XML?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: andy</title>
		<link>http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/comment-page-1/#comment-59013</link>
		<dc:creator>andy</dc:creator>
		<pubDate>Tue, 04 Aug 2009 23:24:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/#comment-59013</guid>
		<description>Hi there - thanks for sharing!!! It really helps us noobs learn.
Wondering if you might be able to walk through making this index the xml tree in order rather than random? Im trying everything but just bungle it everytime ; )

thx in advance</description>
		<content:encoded><![CDATA[<p>Hi there &#8211; thanks for sharing!!! It really helps us noobs learn.<br />
Wondering if you might be able to walk through making this index the xml tree in order rather than random? Im trying everything but just bungle it everytime ; )</p>
<p>thx in advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sander</title>
		<link>http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/comment-page-1/#comment-51363</link>
		<dc:creator>Sander</dc:creator>
		<pubDate>Fri, 13 Mar 2009 10:25:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/#comment-51363</guid>
		<description>I think more people have this problem but I can&#039;t seen to get a proper fix for it:

TypeError: Error #2007: Parameter text must be non-null.
	at flash.text::TextField/set text()
	at quoteRotator_fla::MainTimeline/rotateQuote()
	at flash.utils::Timer/flash.utils:Timer::_timerDispatch()
	at flash.utils::Timer/flash.utils:Timer::tick()

It&#039;s because sometimes it tries to place the text before it loaded the XML.</description>
		<content:encoded><![CDATA[<p>I think more people have this problem but I can&#8217;t seen to get a proper fix for it:</p>
<p>TypeError: Error #2007: Parameter text must be non-null.<br />
	at flash.text::TextField/set text()<br />
	at quoteRotator_fla::MainTimeline/rotateQuote()<br />
	at flash.utils::Timer/flash.utils:Timer::_timerDispatch()<br />
	at flash.utils::Timer/flash.utils:Timer::tick()</p>
<p>It&#8217;s because sometimes it tries to place the text before it loaded the XML.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sander</title>
		<link>http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/comment-page-1/#comment-50893</link>
		<dc:creator>Sander</dc:creator>
		<pubDate>Wed, 04 Mar 2009 09:49:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/#comment-50893</guid>
		<description>Solved my problem.
instead of adding the the movieclip containing the text field I dynamically generated a text field.</description>
		<content:encoded><![CDATA[<p>Solved my problem.<br />
instead of adding the the movieclip containing the text field I dynamically generated a text field.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sander</title>
		<link>http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/comment-page-1/#comment-50578</link>
		<dc:creator>Sander</dc:creator>
		<pubDate>Mon, 23 Feb 2009 15:19:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/#comment-50578</guid>
		<description>Hey I&#039;m trying to put the script in a class (the one with the Tweener Class). But I cant get it to work. I imported to necessary classes:
=================
import flash.events.*;
import flash.xml.*;
import flash.utils.*;
import flash.net.*;
import caurina.transitions.Tweener;
=================
But now I get these errors:
=================
- 1119: Access of possibly undefined property alpha through a reference with static type Class. &#124;&#124; QuoteMC.alpha = 0;

- 1119: Access of possibly undefined property alpha through a reference with static type Class.  &#124;&#124; AuthorMC.alpha = 0;

- 1120: Access of undefined property rotateTimer. &#124;&#124; rotateTimer.addEventListener(&quot;timer&quot;, rotateQuote);//add a listener to the timer

- 1120: Access of undefined property rotateQuote. &#124;&#124; rotateTimer.addEventListener(&quot;timer&quot;, rotateQuote);//add a listener to the timer

- 1120: Access of undefined property rotateTimer. &#124;&#124; rotateTimer.start();// start the timer

- 1180: Call to a possibly undefined method init. &#124;&#124; init();

- 1119: Access of possibly undefined property quote_txt through a reference with static type Class. &#124;&#124; QuoteMC.quote_txt.text = String(quote[initRandom]);

- 1119: Access of possibly undefined property author_txt through a reference with static type Class. &#124;&#124; AuthorMC.author_txt.text = String(author[initRandom]);

- 1119: Access of possibly undefined property alpha through a reference with static type Class. &#124;&#124; QuoteMC.alpha = 0;

- 1119: Access of possibly undefined property alpha through a reference with static type Class. &#124;&#124; AuthorMC.alpha = 0;

- 1119: Access of possibly undefined property quote_txt through a reference with static type Class. &#124;&#124; QuoteMC.quote_txt.text = &quot;&quot;;

- 1119: Access of possibly undefined property author_txt through a reference with static type Class. &#124;&#124; AuthorMC.author_txt.text = &quot;&quot;;

- 1119: Access of possibly undefined property quote_txt through a reference with static type Class. &#124;&#124; QuoteMC.quote_txt.text = quote[randomness];

- 1119: Access of possibly undefined property author_txt through a reference with static type Class. &#124;&#124; AuthorMC.author_txt.text = author[randomness];
=================
Now I&#039;m adding the text field Dynamically in another class containing:
=================
public var quote:QuoteMC = new QuoteMC();
public var quotegen:Quotes = new Quotes(); 

auteur.x = 659;
auteur.y = 282;
addChild(auteur);
			
quote.x = 2;
quote.y = 282;
addChild(quote);
=================

Can someone please help me out with the classes.
I think the common problem is that I don&#039;t give the created MC&#039;s the instance names needed (quote_txt &amp; author_txt). The other problems I can&#039;t seem to figure out. If anyone knows the answer please post a reply on my blog here: http://blog.libertystudio.nl/2009/02/23/quote-rotator-using-classes/ or email me.

Thanks in advance :)</description>
		<content:encoded><![CDATA[<p>Hey I&#8217;m trying to put the script in a class (the one with the Tweener Class). But I cant get it to work. I imported to necessary classes:<br />
=================<br />
import flash.events.*;<br />
import flash.xml.*;<br />
import flash.utils.*;<br />
import flash.net.*;<br />
import caurina.transitions.Tweener;<br />
=================<br />
But now I get these errors:<br />
=================<br />
- 1119: Access of possibly undefined property alpha through a reference with static type Class. || QuoteMC.alpha = 0;</p>
<p>- 1119: Access of possibly undefined property alpha through a reference with static type Class.  || AuthorMC.alpha = 0;</p>
<p>- 1120: Access of undefined property rotateTimer. || rotateTimer.addEventListener(&#8220;timer&#8221;, rotateQuote);//add a listener to the timer</p>
<p>- 1120: Access of undefined property rotateQuote. || rotateTimer.addEventListener(&#8220;timer&#8221;, rotateQuote);//add a listener to the timer</p>
<p>- 1120: Access of undefined property rotateTimer. || rotateTimer.start();// start the timer</p>
<p>- 1180: Call to a possibly undefined method init. || init();</p>
<p>- 1119: Access of possibly undefined property quote_txt through a reference with static type Class. || QuoteMC.quote_txt.text = String(quote[initRandom]);</p>
<p>- 1119: Access of possibly undefined property author_txt through a reference with static type Class. || AuthorMC.author_txt.text = String(author[initRandom]);</p>
<p>- 1119: Access of possibly undefined property alpha through a reference with static type Class. || QuoteMC.alpha = 0;</p>
<p>- 1119: Access of possibly undefined property alpha through a reference with static type Class. || AuthorMC.alpha = 0;</p>
<p>- 1119: Access of possibly undefined property quote_txt through a reference with static type Class. || QuoteMC.quote_txt.text = &#8220;&#8221;;</p>
<p>- 1119: Access of possibly undefined property author_txt through a reference with static type Class. || AuthorMC.author_txt.text = &#8220;&#8221;;</p>
<p>- 1119: Access of possibly undefined property quote_txt through a reference with static type Class. || QuoteMC.quote_txt.text = quote[randomness];</p>
<p>- 1119: Access of possibly undefined property author_txt through a reference with static type Class. || AuthorMC.author_txt.text = author[randomness];<br />
=================<br />
Now I&#8217;m adding the text field Dynamically in another class containing:<br />
=================<br />
public var quote:QuoteMC = new QuoteMC();<br />
public var quotegen:Quotes = new Quotes(); </p>
<p>auteur.x = 659;<br />
auteur.y = 282;<br />
addChild(auteur);</p>
<p>quote.x = 2;<br />
quote.y = 282;<br />
addChild(quote);<br />
=================</p>
<p>Can someone please help me out with the classes.<br />
I think the common problem is that I don&#8217;t give the created MC&#8217;s the instance names needed (quote_txt &amp; author_txt). The other problems I can&#8217;t seem to figure out. If anyone knows the answer please post a reply on my blog here: <a href="http://blog.libertystudio.nl/2009/02/23/quote-rotator-using-classes/" rel="nofollow">http://blog.libertystudio.nl/2009/02/23/quote-rotator-using-classes/</a> or email me.</p>
<p>Thanks in advance <img src='http://blog.six4rty.ch/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WilliamR</title>
		<link>http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/comment-page-1/#comment-50565</link>
		<dc:creator>WilliamR</dc:creator>
		<pubDate>Mon, 23 Feb 2009 01:03:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/#comment-50565</guid>
		<description>Since this is open forum, I felt like I should share my code. In no way I&#039;m a flash programmer, maybe get a half dozen projects a year. And hack most of the code together. So be nice! 

Modifications: Added no duplicate rotation, so no one quote is shown twice in a row. Added Fade in and fade out based on Toby&#039;s code. I also added a system to move the author up or down depending if it was using multiple lines or not (the size will very depending on you&#039;re dimensions). With my last message also fixed that annoying #2007 error.

CODE:


import caurina.transitions.Tweener;

var quote:Array = new Array();
var author:Array = new Array();
var lastQuote:Number = 0;

var totalQuotes:Number;
quoteMC.alpha = 0;
authMC.alpha = 0;

var rotateTimer:Timer = new Timer(7000, 100000); //rotates the quote every 2 seconds for 100000 times
rotateTimer.addEventListener(&quot;timer&quot;, rotateQuote);//add a listener to the timer
rotateTimer.start();// start the timer

function init():void {
var quotesXML:XML = new XML();
quotesXML.ignoreWhitespace = true;
var XMLURL:URLRequest = new URLRequest(&quot;http://localhost/quotes1.xml&quot;);
var myLoader:URLLoader = new URLLoader(XMLURL);
myLoader.addEventListener(&quot;complete&quot;, xmlLoaded);
function xmlLoaded(event:Event):void {
quotesXML = XML(myLoader.data);
totalQuotes = quotesXML.quote.length() - 1;
for (var i:int = 0; i &lt; quotesXML.quote.length(); i++) {
	quote[i] = quotesXML.quote[i].text;
	author[i] = quotesXML.quote[i].author;
}
var initRandom:Number = randomNumber(0, totalQuotes);
lastQuote = initRandom;
	
	var temp:String = quote[initRandom];
	if (temp.length &lt; 60) {
		authMC.y = 50;
	} else {
		authMC.y = 72;
	}


Tweener.addTween(quoteMC, {alpha:1, time:5});
Tweener.addTween(authMC, {alpha:1, time:5});
quoteMC.quote_txt.text = String(quote[initRandom]);
authMC.author_txt.text = String(author[initRandom]);
}

}

function wait(evt:TimerEvent)
{ 
	stop();
	var myInterval = setInterval( function () { 
										play(); 
										clearInterval(myInterval);
										rotateQuoteIN(evt);
										}, 2000);
}

function rotateQuote(evt:TimerEvent) {
Tweener.addTween(quoteMC, {alpha:0, time:3});
Tweener.addTween(authMC, {alpha:0, time:3});
wait(evt);
}

function rotateQuoteIN(evt:TimerEvent) {
quoteMC.alpha = 0;
authMC.alpha = 0;
Tweener.addTween(quoteMC, {alpha:1, time:6});
Tweener.addTween(authMC, {alpha:1, time:6});
quoteMC.quote_txt.text = &quot;&quot;;
authMC.author_txt.text = &quot;&quot;;
var randomness:Number = randomNumber(0, totalQuotes);

/* prevent the same quote from showing */
while ( lastQuote == randomness) {
	randomness = randomNumber(0, totalQuotes);
}
	

	lastQuote = randomness;
	
	var temp:String = quote[randomness];
	if (temp.length &lt; 60) {
		authMC.y = 50;
	} else {
		authMC.y = 72;
	}
	
	quoteMC.quote_txt.text = quote[randomness];
	authMC.author_txt.text = author[randomness];

}

function randomNumber(low:Number, high:Number):Number {
var low:Number = low;
var high:Number = high;
return Math.round(Math.random() * high - low) + low;
}
init();</description>
		<content:encoded><![CDATA[<p>Since this is open forum, I felt like I should share my code. In no way I&#8217;m a flash programmer, maybe get a half dozen projects a year. And hack most of the code together. So be nice! </p>
<p>Modifications: Added no duplicate rotation, so no one quote is shown twice in a row. Added Fade in and fade out based on Toby&#8217;s code. I also added a system to move the author up or down depending if it was using multiple lines or not (the size will very depending on you&#8217;re dimensions). With my last message also fixed that annoying #2007 error.</p>
<p>CODE:</p>
<p>import caurina.transitions.Tweener;</p>
<p>var quote:Array = new Array();<br />
var author:Array = new Array();<br />
var lastQuote:Number = 0;</p>
<p>var totalQuotes:Number;<br />
quoteMC.alpha = 0;<br />
authMC.alpha = 0;</p>
<p>var rotateTimer:Timer = new Timer(7000, 100000); //rotates the quote every 2 seconds for 100000 times<br />
rotateTimer.addEventListener(&#8220;timer&#8221;, rotateQuote);//add a listener to the timer<br />
rotateTimer.start();// start the timer</p>
<p>function init():void {<br />
var quotesXML:XML = new XML();<br />
quotesXML.ignoreWhitespace = true;<br />
var XMLURL:URLRequest = new URLRequest(&#8220;http://localhost/quotes1.xml&#8221;);<br />
var myLoader:URLLoader = new URLLoader(XMLURL);<br />
myLoader.addEventListener(&#8220;complete&#8221;, xmlLoaded);<br />
function xmlLoaded(event:Event):void {<br />
quotesXML = XML(myLoader.data);<br />
totalQuotes = quotesXML.quote.length() &#8211; 1;<br />
for (var i:int = 0; i &lt; quotesXML.quote.length(); i++) {<br />
	quote[i] = quotesXML.quote[i].text;<br />
	author[i] = quotesXML.quote[i].author;<br />
}<br />
var initRandom:Number = randomNumber(0, totalQuotes);<br />
lastQuote = initRandom;</p>
<p>	var temp:String = quote[initRandom];<br />
	if (temp.length &lt; 60) {<br />
		authMC.y = 50;<br />
	} else {<br />
		authMC.y = 72;<br />
	}</p>
<p>Tweener.addTween(quoteMC, {alpha:1, time:5});<br />
Tweener.addTween(authMC, {alpha:1, time:5});<br />
quoteMC.quote_txt.text = String(quote[initRandom]);<br />
authMC.author_txt.text = String(author[initRandom]);<br />
}</p>
<p>}</p>
<p>function wait(evt:TimerEvent)<br />
{<br />
	stop();<br />
	var myInterval = setInterval( function () {<br />
										play();<br />
										clearInterval(myInterval);<br />
										rotateQuoteIN(evt);<br />
										}, 2000);<br />
}</p>
<p>function rotateQuote(evt:TimerEvent) {<br />
Tweener.addTween(quoteMC, {alpha:0, time:3});<br />
Tweener.addTween(authMC, {alpha:0, time:3});<br />
wait(evt);<br />
}</p>
<p>function rotateQuoteIN(evt:TimerEvent) {<br />
quoteMC.alpha = 0;<br />
authMC.alpha = 0;<br />
Tweener.addTween(quoteMC, {alpha:1, time:6});<br />
Tweener.addTween(authMC, {alpha:1, time:6});<br />
quoteMC.quote_txt.text = &#8220;&#8221;;<br />
authMC.author_txt.text = &#8220;&#8221;;<br />
var randomness:Number = randomNumber(0, totalQuotes);</p>
<p>/* prevent the same quote from showing */<br />
while ( lastQuote == randomness) {<br />
	randomness = randomNumber(0, totalQuotes);<br />
}</p>
<p>	lastQuote = randomness;</p>
<p>	var temp:String = quote[randomness];<br />
	if (temp.length &lt; 60) {<br />
		authMC.y = 50;<br />
	} else {<br />
		authMC.y = 72;<br />
	}</p>
<p>	quoteMC.quote_txt.text = quote[randomness];<br />
	authMC.author_txt.text = author[randomness];</p>
<p>}</p>
<p>function randomNumber(low:Number, high:Number):Number {<br />
var low:Number = low;<br />
var high:Number = high;<br />
return Math.round(Math.random() * high &#8211; low) + low;<br />
}<br />
init();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WilliamR</title>
		<link>http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/comment-page-1/#comment-50512</link>
		<dc:creator>WilliamR</dc:creator>
		<pubDate>Sat, 21 Feb 2009 20:36:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/#comment-50512</guid>
		<description>If you get error #2007, i think the problem is

totalQuotes = quotesXML.quote.length();

needs to be changed too

totalQuotes = quotesXML.quote.length() - 1;

You get the #2007 because the original code is reaching out of the array bounds.</description>
		<content:encoded><![CDATA[<p>If you get error #2007, i think the problem is</p>
<p>totalQuotes = quotesXML.quote.length();</p>
<p>needs to be changed too</p>
<p>totalQuotes = quotesXML.quote.length() &#8211; 1;</p>
<p>You get the #2007 because the original code is reaching out of the array bounds.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex C</title>
		<link>http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/comment-page-1/#comment-49974</link>
		<dc:creator>Alex C</dc:creator>
		<pubDate>Sun, 08 Feb 2009 01:53:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/#comment-49974</guid>
		<description>I was having the same error #2007. It&#039;s caused by this line:

	var XMLURL:URLRequest = new URLRequest(&quot;http://localhost/quoteRotator/quotes1.xml&quot;);

You need to change that to the localhost folder where the app is running. However, after fixing that, the first quote comes up as &quot;undefined&quot; and then it works ok. What&#039;s causing this?</description>
		<content:encoded><![CDATA[<p>I was having the same error #2007. It&#8217;s caused by this line:</p>
<p>	var XMLURL:URLRequest = new URLRequest(&#8220;http://localhost/quoteRotator/quotes1.xml&#8221;);</p>
<p>You need to change that to the localhost folder where the app is running. However, after fixing that, the first quote comes up as &#8220;undefined&#8221; and then it works ok. What&#8217;s causing this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ZeroHart</title>
		<link>http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/comment-page-1/#comment-46806</link>
		<dc:creator>ZeroHart</dc:creator>
		<pubDate>Tue, 11 Nov 2008 16:07:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/#comment-46806</guid>
		<description>Is there a way to do this but in AS2??</description>
		<content:encoded><![CDATA[<p>Is there a way to do this but in AS2??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ZeroHart</title>
		<link>http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/comment-page-1/#comment-46672</link>
		<dc:creator>ZeroHart</dc:creator>
		<pubDate>Fri, 07 Nov 2008 21:55:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/#comment-46672</guid>
		<description>Hi there is there a way I can make a Flash SWF to add quotes to the XML? so People can add quotes by themselves?</description>
		<content:encoded><![CDATA[<p>Hi there is there a way I can make a Flash SWF to add quotes to the XML? so People can add quotes by themselves?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: orange</title>
		<link>http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/comment-page-1/#comment-46495</link>
		<dc:creator>orange</dc:creator>
		<pubDate>Mon, 03 Nov 2008 20:25:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/#comment-46495</guid>
		<description>Excelent job and thanks for sharing your work Tiago. I&#039;m using it and works fine however I&#039;m getting an error: 

TypeError: Error #2007: Parameter text must be non-null.
	at flash.text::TextField/set text()
	at quotes_fla::MainTimeline/rotateQuote()
	at flash.utils::Timer/flash.utils:Timer::_timerDispatch()
	at flash.utils::Timer/flash.utils:Timer::tick()

The code I&#039;m using is:

import caurina.transitions.Tweener;

var quote:Array = new Array();
var totalQuotes:Number;
quoteMC.alpha = 0;

var rotateTimer:Timer = new Timer(5000, 100);//rotates the quote every 2 seconds for 100 times
rotateTimer.addEventListener(&quot;timer&quot;, rotateQuote);//add a listener to the timer
rotateTimer.start();// start the timer

function init():void {
	var quotesXML:XML = new XML();
	quotesXML.ignoreWhitespace = true;
	var XMLURL:URLRequest = new URLRequest(&quot;flash/quotes1.xml&quot;);
	var myLoader:URLLoader = new URLLoader(XMLURL);
	myLoader.addEventListener(&quot;complete&quot;, xmlLoaded);
	function xmlLoaded(event:Event):void {
		quotesXML = XML(myLoader.data);
		totalQuotes = quotesXML.quote.length();
		for (var i:int = 0; i &lt; quotesXML.quote.length(); i++) {
			quote[i] = quotesXML.quote[i].text;
		}
		var initRandom:Number = randomNumber(0, totalQuotes);
		Tweener.addTween(quoteMC, {alpha:1, time:5});
		quoteMC.quote_txt.text = String(quote[initRandom]);
	}
	
}

function rotateQuote(evt:TimerEvent) {
	quoteMC.alpha = 0;
	Tweener.addTween(quoteMC, {alpha:1, time:5});
	quoteMC.quote_txt.text = &quot;&quot;;
	var randomness:Number = randomNumber(0, totalQuotes);
	quoteMC.quote_txt.text = quote[randomness];
}

function randomNumber(low:Number, high:Number):Number {
	var low:Number = low;
	var high:Number = high;
	return Math.round(Math.random() * high - low) + low;
}
init();


I&#039;m totally new at as3 so any help will be welcome.
Thanks in advance.</description>
		<content:encoded><![CDATA[<p>Excelent job and thanks for sharing your work Tiago. I&#8217;m using it and works fine however I&#8217;m getting an error: </p>
<p>TypeError: Error #2007: Parameter text must be non-null.<br />
	at flash.text::TextField/set text()<br />
	at quotes_fla::MainTimeline/rotateQuote()<br />
	at flash.utils::Timer/flash.utils:Timer::_timerDispatch()<br />
	at flash.utils::Timer/flash.utils:Timer::tick()</p>
<p>The code I&#8217;m using is:</p>
<p>import caurina.transitions.Tweener;</p>
<p>var quote:Array = new Array();<br />
var totalQuotes:Number;<br />
quoteMC.alpha = 0;</p>
<p>var rotateTimer:Timer = new Timer(5000, 100);//rotates the quote every 2 seconds for 100 times<br />
rotateTimer.addEventListener(&#8220;timer&#8221;, rotateQuote);//add a listener to the timer<br />
rotateTimer.start();// start the timer</p>
<p>function init():void {<br />
	var quotesXML:XML = new XML();<br />
	quotesXML.ignoreWhitespace = true;<br />
	var XMLURL:URLRequest = new URLRequest(&#8220;flash/quotes1.xml&#8221;);<br />
	var myLoader:URLLoader = new URLLoader(XMLURL);<br />
	myLoader.addEventListener(&#8220;complete&#8221;, xmlLoaded);<br />
	function xmlLoaded(event:Event):void {<br />
		quotesXML = XML(myLoader.data);<br />
		totalQuotes = quotesXML.quote.length();<br />
		for (var i:int = 0; i &lt; quotesXML.quote.length(); i++) {<br />
			quote[i] = quotesXML.quote[i].text;<br />
		}<br />
		var initRandom:Number = randomNumber(0, totalQuotes);<br />
		Tweener.addTween(quoteMC, {alpha:1, time:5});<br />
		quoteMC.quote_txt.text = String(quote[initRandom]);<br />
	}</p>
<p>}</p>
<p>function rotateQuote(evt:TimerEvent) {<br />
	quoteMC.alpha = 0;<br />
	Tweener.addTween(quoteMC, {alpha:1, time:5});<br />
	quoteMC.quote_txt.text = &#8220;&#8221;;<br />
	var randomness:Number = randomNumber(0, totalQuotes);<br />
	quoteMC.quote_txt.text = quote[randomness];<br />
}</p>
<p>function randomNumber(low:Number, high:Number):Number {<br />
	var low:Number = low;<br />
	var high:Number = high;<br />
	return Math.round(Math.random() * high &#8211; low) + low;<br />
}<br />
init();</p>
<p>I&#8217;m totally new at as3 so any help will be welcome.<br />
Thanks in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: orange</title>
		<link>http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/comment-page-1/#comment-46492</link>
		<dc:creator>orange</dc:creator>
		<pubDate>Mon, 03 Nov 2008 20:12:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.six4rty.ch/tutorials/flash-cs3-quote-rotator/#comment-46492</guid>
		<description>Excelent job and thanks for sharing your work Tiago. I&#039;m using it and works fine however I&#039;m getting an error: 

TypeError: Error #2007: Parameter text must be non-null.
	at flash.text::TextField/set text()
	at quotes_fla::MainTimeline/rotateQuote()
	at flash.utils::Timer/flash.utils:Timer::_timerDispatch()
	at flash.utils::Timer/flash.utils:Timer::tick()

The code I&#039;m using is:

import caurina.transitions.Tweener;

var quote:Array = new Array();
var author:Array = new Array();
var totalQuotes:Number;
quoteMC.alpha = 0;

var rotateTimer:Timer = new Timer(5000, 100);//rotates the quote every 2 seconds for 100 times
rotateTimer.addEventListener(&quot;timer&quot;, rotateQuote);//add a listener to the timer
rotateTimer.start();// start the timer

function init():void {
	var quotesXML:XML = new XML();
	quotesXML.ignoreWhitespace = true;
	var XMLURL:URLRequest = new URLRequest(&quot;flash/quotes1.xml&quot;);
	var myLoader:URLLoader = new URLLoader(XMLURL);
	myLoader.addEventListener(&quot;complete&quot;, xmlLoaded);
	function xmlLoaded(event:Event):void {
		quotesXML = XML(myLoader.data);
		totalQuotes = quotesXML.quote.length();
		for (var i:int = 0; i &lt; quotesXML.quote.length(); i++) {
			quote[i] = quotesXML.quote[i].text;
		}
		var initRandom:Number = randomNumber(0, totalQuotes);
		Tweener.addTween(quoteMC, {alpha:1, time:5});
		quoteMC.quote_txt.text = String(quote[initRandom]);
	}
	
}

function rotateQuote(evt:TimerEvent) {
	quoteMC.alpha = 0;
	Tweener.addTween(quoteMC, {alpha:1, time:5});
	quoteMC.quote_txt.text = &quot;&quot;;
	var randomness:Number = randomNumber(0, totalQuotes);
	quoteMC.quote_txt.text = quote[randomness];
}

function randomNumber(low:Number, high:Number):Number {
	var low:Number = low;
	var high:Number = high;
	return Math.round(Math.random() * high - low) + low;
}
init();


I&#039;m totally new at as3 so any help will be welcome.
Thanks in advance.</description>
		<content:encoded><![CDATA[<p>Excelent job and thanks for sharing your work Tiago. I&#8217;m using it and works fine however I&#8217;m getting an error: </p>
<p>TypeError: Error #2007: Parameter text must be non-null.<br />
	at flash.text::TextField/set text()<br />
	at quotes_fla::MainTimeline/rotateQuote()<br />
	at flash.utils::Timer/flash.utils:Timer::_timerDispatch()<br />
	at flash.utils::Timer/flash.utils:Timer::tick()</p>
<p>The code I&#8217;m using is:</p>
<p>import caurina.transitions.Tweener;</p>
<p>var quote:Array = new Array();<br />
var author:Array = new Array();<br />
var totalQuotes:Number;<br />
quoteMC.alpha = 0;</p>
<p>var rotateTimer:Timer = new Timer(5000, 100);//rotates the quote every 2 seconds for 100 times<br />
rotateTimer.addEventListener(&#8220;timer&#8221;, rotateQuote);//add a listener to the timer<br />
rotateTimer.start();// start the timer</p>
<p>function init():void {<br />
	var quotesXML:XML = new XML();<br />
	quotesXML.ignoreWhitespace = true;<br />
	var XMLURL:URLRequest = new URLRequest(&#8220;flash/quotes1.xml&#8221;);<br />
	var myLoader:URLLoader = new URLLoader(XMLURL);<br />
	myLoader.addEventListener(&#8220;complete&#8221;, xmlLoaded);<br />
	function xmlLoaded(event:Event):void {<br />
		quotesXML = XML(myLoader.data);<br />
		totalQuotes = quotesXML.quote.length();<br />
		for (var i:int = 0; i &lt; quotesXML.quote.length(); i++) {<br />
			quote[i] = quotesXML.quote[i].text;<br />
		}<br />
		var initRandom:Number = randomNumber(0, totalQuotes);<br />
		Tweener.addTween(quoteMC, {alpha:1, time:5});<br />
		quoteMC.quote_txt.text = String(quote[initRandom]);<br />
	}</p>
<p>}</p>
<p>function rotateQuote(evt:TimerEvent) {<br />
	quoteMC.alpha = 0;<br />
	Tweener.addTween(quoteMC, {alpha:1, time:5});<br />
	quoteMC.quote_txt.text = &#8220;&#8221;;<br />
	var randomness:Number = randomNumber(0, totalQuotes);<br />
	quoteMC.quote_txt.text = quote[randomness];<br />
}</p>
<p>function randomNumber(low:Number, high:Number):Number {<br />
	var low:Number = low;<br />
	var high:Number = high;<br />
	return Math.round(Math.random() * high &#8211; low) + low;<br />
}<br />
init();</p>
<p>I&#8217;m totally new at as3 so any help will be welcome.<br />
Thanks in advance.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
