<?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: Simple Tiling Sprite Class in AS3</title>
	<atom:link href="http://efnx.com/conveniently-simple-tiling-sprite/feed/" rel="self" type="application/rss+xml" />
	<link>http://efnx.com/conveniently-simple-tiling-sprite/</link>
	<description>code. blog.</description>
	<lastBuildDate>Sun, 25 Mar 2012 18:08:20 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Dhruba</title>
		<link>http://efnx.com/conveniently-simple-tiling-sprite/comment-page-1/#comment-1984</link>
		<dc:creator>Dhruba</dc:creator>
		<pubDate>Thu, 17 Feb 2011 20:18:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.efnx.com/?p=25#comment-1984</guid>
		<description>hi............ I just want to make a class which draw line whenever i called Line() function . Here is the code I hv written...... but it gives blank screen Please Help me.............. (It works if I directly paste the code of Line () function on Frame i.e without using class)


/*Action Frame code........*/
 new Line();




/*class script...........*/
package {

	import flash.display.MovieClip;
        import flash.display.Sprite;
	import flash.display.*
	import flash.geom.Point;
	import flash.events.*;
	import flash.utils.*;

	public class Line extends Sprite {
	public var canvas:Sprite = new Sprite();

	
	 public function Line ():void{
	 
	            
				
	                       canvas.graphics.lineStyle(5, 0xFF0000, 1);
				canvas.graphics.moveTo( 10 , 10 );
				canvas.graphics.lineTo( 300 , 300 )
				addChild(canvas);
				
				
	
	 }
	
   }

}</description>
		<content:encoded><![CDATA[<p>hi&#8230;&#8230;&#8230;&#8230; I just want to make a class which draw line whenever i called Line() function . Here is the code I hv written&#8230;&#8230; but it gives blank screen Please Help me&#8230;&#8230;&#8230;&#8230;.. (It works if I directly paste the code of Line () function on Frame i.e without using class)</p>
<p>/*Action Frame code&#8230;&#8230;..*/<br />
 new Line();</p>
<p>/*class script&#8230;&#8230;&#8230;..*/<br />
package {</p>
<p>	import flash.display.MovieClip;<br />
        import flash.display.Sprite;<br />
	import flash.display.*<br />
	import flash.geom.Point;<br />
	import flash.events.*;<br />
	import flash.utils.*;</p>
<p>	public class Line extends Sprite {<br />
	public var canvas:Sprite = new Sprite();</p>
<p>	 public function Line ():void{</p>
<p>	                       canvas.graphics.lineStyle(5, 0xFF0000, 1);<br />
				canvas.graphics.moveTo( 10 , 10 );<br />
				canvas.graphics.lineTo( 300 , 300 )<br />
				addChild(canvas);</p>
<p>	 }</p>
<p>   }</p>
<p>}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://efnx.com/conveniently-simple-tiling-sprite/comment-page-1/#comment-1922</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Tue, 07 Dec 2010 10:35:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.efnx.com/?p=25#comment-1922</guid>
		<description>If you struggling with the bg tile image appeared on top of your other movieclips add this to brndn&#039;s class:

stageInstance.setChildIndex(child,0);

add to line 79, after 

stageInstance.addChild(child);

Hope that helps.</description>
		<content:encoded><![CDATA[<p>If you struggling with the bg tile image appeared on top of your other movieclips add this to brndn&#8217;s class:</p>
<p>stageInstance.setChildIndex(child,0);</p>
<p>add to line 79, after </p>
<p>stageInstance.addChild(child);</p>
<p>Hope that helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Schell</title>
		<link>http://efnx.com/conveniently-simple-tiling-sprite/comment-page-1/#comment-744</link>
		<dc:creator>Schell</dc:creator>
		<pubDate>Thu, 25 Feb 2010 17:10:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.efnx.com/?p=25#comment-744</guid>
		<description>The public, protected, private and internal keywords denote variable access. Here&#039;s a quick article describing each: &lt;a href=&quot;http://greenethumb.com/article/27/public-private-protected-internal-access-modifiers-in-as&quot; rel=&quot;nofollow&quot;&gt;http://greenethumb.com/article/27/public-private-protected-internal-access-modifiers-in-as&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>The public, protected, private and internal keywords denote variable access. Here&#8217;s a quick article describing each: <a href="http://greenethumb.com/article/27/public-private-protected-internal-access-modifiers-in-as" rel="nofollow">http://greenethumb.com/article/27/public-private-protected-internal-access-modifiers-in-as</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Miggy</title>
		<link>http://efnx.com/conveniently-simple-tiling-sprite/comment-page-1/#comment-743</link>
		<dc:creator>Miggy</dc:creator>
		<pubDate>Thu, 25 Feb 2010 08:30:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.efnx.com/?p=25#comment-743</guid>
		<description>Thanks so much Schell,  i will try that tonight.
by the way  may i ask whats the use of &quot;public&quot; in &#039;public var loader:Loader = new Loader();&#039; i know its kinda off topic and im very sorry for the dumb/noob question.  I have so much to learn in AS3, it cool to learn new things. 

thanks a lot!</description>
		<content:encoded><![CDATA[<p>Thanks so much Schell,  i will try that tonight.<br />
by the way  may i ask whats the use of &#8220;public&#8221; in &#8216;public var loader:Loader = new Loader();&#8217; i know its kinda off topic and im very sorry for the dumb/noob question.  I have so much to learn in AS3, it cool to learn new things. </p>
<p>thanks a lot!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Schell</title>
		<link>http://efnx.com/conveniently-simple-tiling-sprite/comment-page-1/#comment-742</link>
		<dc:creator>Schell</dc:creator>
		<pubDate>Thu, 25 Feb 2010 02:14:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.efnx.com/?p=25#comment-742</guid>
		<description>&gt; Miggy
Your problem is that my class doesn&#039;t expose a member named &#039;contentLoaderInfo&#039; - which is definitely a design flaw, as the class is loading an image. You could change line 54 to read &#039;public var loader:Loader = new Loader();&#039; and then in your code use &#039;BlackPattern2.loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);&#039; or you could just do &#039;addChild(beam, 1);&#039; without the onComplete event. The image does not have to be loaded to add the tile to the stage.</description>
		<content:encoded><![CDATA[<p>> Miggy<br />
Your problem is that my class doesn&#8217;t expose a member named &#8216;contentLoaderInfo&#8217; &#8211; which is definitely a design flaw, as the class is loading an image. You could change line 54 to read &#8216;public var loader:Loader = new Loader();&#8217; and then in your code use &#8216;BlackPattern2.loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);&#8217; or you could just do &#8216;addChild(beam, 1);&#8217; without the onComplete event. The image does not have to be loaded to add the tile to the stage.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Miggy</title>
		<link>http://efnx.com/conveniently-simple-tiling-sprite/comment-page-1/#comment-741</link>
		<dc:creator>Miggy</dc:creator>
		<pubDate>Wed, 24 Feb 2010 12:44:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.efnx.com/?p=25#comment-741</guid>
		<description>Hi I am a newbie in action script and Im glad I found this class that really helped much. I had encountered some problems using this class, I tried to preload the background before the next image appears resulting to an error 
&quot;Access of possible undefined property contentLoaderInfo through a reference with static type com.efnx.GUI:tile.&quot;

here is my code


stop();


import flash.display.*;
import flash.geom.Rectangle;
import flash.display.BitmapData;
import flash.display.Stage;
import flash.net.URLRequest; 
import flash.display.Loader; 
import flash.events.Event; 
import flash.events.ProgressEvent; 
import flash.display.BitmapData;
import gs.plugins.*;
import gs.TweenLite;
import gs.easing.*;
import gs.*;
import com.efnx.GUI.*

var BlackPattern:tile = new tile(&quot;images/blackpattern.png&quot;, 1955, 1024);
addChildAt(BlackPattern,0);

var BlackPatternXPos:Number = swfWidth - 1955;
var BlackPatternYPos:Number = swfHeight - 1024;

BlackPattern.x = BlackPatternXPos / 2 ;
BlackPattern.y =  0;




var BlackPattern2:tile = new tile(&quot;images/blackpattern.png&quot;, 1955, 1024);
addChildAt(BlackPattern2,2);
BlackPattern2.alpha = .7;

var BlackPattern2XPos:Number = swfWidth - 1955;
var BlackPattern2YPos:Number = swfHeight - 1024;

BlackPattern2.x = BlackPattern2XPos / 2 ;
BlackPattern2.y =  0;

BlackPattern2.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);

var beam:tile = new tile(&quot;images/beam.png&quot;, 1280, 1150);
function onComplete(ev:Event):void
{  
addChildAt(beam,1);
}

beam.alpha = .8

var beamXPos:Number = swfWidth - 1280;
var beamYPos:Number = swfHeight - 1150;

beam.x = beamXPos/2;
beam.y = 0;



Honestly Im not sure if im doing it correctly, is there other way where i could load the &quot;blackpattern1&quot; and &quot;blackpattern2&quot; before loading the &quot;beam&quot;


thank you so much.

Great AS3 Class!! very helpful!!</description>
		<content:encoded><![CDATA[<p>Hi I am a newbie in action script and Im glad I found this class that really helped much. I had encountered some problems using this class, I tried to preload the background before the next image appears resulting to an error<br />
&#8220;Access of possible undefined property contentLoaderInfo through a reference with static type com.efnx.GUI:tile.&#8221;</p>
<p>here is my code</p>
<p>stop();</p>
<p>import flash.display.*;<br />
import flash.geom.Rectangle;<br />
import flash.display.BitmapData;<br />
import flash.display.Stage;<br />
import flash.net.URLRequest;<br />
import flash.display.Loader;<br />
import flash.events.Event;<br />
import flash.events.ProgressEvent;<br />
import flash.display.BitmapData;<br />
import gs.plugins.*;<br />
import gs.TweenLite;<br />
import gs.easing.*;<br />
import gs.*;<br />
import com.efnx.GUI.*</p>
<p>var BlackPattern:tile = new tile(&#8220;images/blackpattern.png&#8221;, 1955, 1024);<br />
addChildAt(BlackPattern,0);</p>
<p>var BlackPatternXPos:Number = swfWidth &#8211; 1955;<br />
var BlackPatternYPos:Number = swfHeight &#8211; 1024;</p>
<p>BlackPattern.x = BlackPatternXPos / 2 ;<br />
BlackPattern.y =  0;</p>
<p>var BlackPattern2:tile = new tile(&#8220;images/blackpattern.png&#8221;, 1955, 1024);<br />
addChildAt(BlackPattern2,2);<br />
BlackPattern2.alpha = .7;</p>
<p>var BlackPattern2XPos:Number = swfWidth &#8211; 1955;<br />
var BlackPattern2YPos:Number = swfHeight &#8211; 1024;</p>
<p>BlackPattern2.x = BlackPattern2XPos / 2 ;<br />
BlackPattern2.y =  0;</p>
<p>BlackPattern2.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);</p>
<p>var beam:tile = new tile(&#8220;images/beam.png&#8221;, 1280, 1150);<br />
function onComplete(ev:Event):void<br />
{<br />
addChildAt(beam,1);<br />
}</p>
<p>beam.alpha = .8</p>
<p>var beamXPos:Number = swfWidth &#8211; 1280;<br />
var beamYPos:Number = swfHeight &#8211; 1150;</p>
<p>beam.x = beamXPos/2;<br />
beam.y = 0;</p>
<p>Honestly Im not sure if im doing it correctly, is there other way where i could load the &#8220;blackpattern1&#8243; and &#8220;blackpattern2&#8243; before loading the &#8220;beam&#8221;</p>
<p>thank you so much.</p>
<p>Great AS3 Class!! very helpful!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Schell</title>
		<link>http://efnx.com/conveniently-simple-tiling-sprite/comment-page-1/#comment-624</link>
		<dc:creator>Schell</dc:creator>
		<pubDate>Fri, 18 Dec 2009 18:36:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.efnx.com/?p=25#comment-624</guid>
		<description>&gt;&gt;pixteur
Well, it&#039;s been a very long time since I first wrote the class, but, you should be able to treat it just like any other Sprite (though I&#039;m not sure about the other classes in the comments). I&#039;m sorry if this sounds trite: when you are adding your DisplayObjects to the Stage, just make sure you add them in a way that you can keep track of the order. It&#039;s easiest just to keep all of your calls to addChild() in a block. Put the addChild() call for the tile in the middle, then you&#039;ll know the tiling is in the middle of the display list. You must also be aware that if you&#039;re tiling a completely opaque tile and stretching the tile to the full stageWidth and stageHeight of the flash window, you won&#039;t see anything that might be behind the tile.</description>
		<content:encoded><![CDATA[<p>>>pixteur<br />
Well, it&#8217;s been a very long time since I first wrote the class, but, you should be able to treat it just like any other Sprite (though I&#8217;m not sure about the other classes in the comments). I&#8217;m sorry if this sounds trite: when you are adding your DisplayObjects to the Stage, just make sure you add them in a way that you can keep track of the order. It&#8217;s easiest just to keep all of your calls to addChild() in a block. Put the addChild() call for the tile in the middle, then you&#8217;ll know the tiling is in the middle of the display list. You must also be aware that if you&#8217;re tiling a completely opaque tile and stretching the tile to the full stageWidth and stageHeight of the flash window, you won&#8217;t see anything that might be behind the tile.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pixteur</title>
		<link>http://efnx.com/conveniently-simple-tiling-sprite/comment-page-1/#comment-623</link>
		<dc:creator>pixteur</dc:creator>
		<pubDate>Fri, 18 Dec 2009 14:39:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.efnx.com/?p=25#comment-623</guid>
		<description>Thanks for this class. 

I have gotten brndn&#039;s version working but am still having trouble getting the tiled image not to go on top of everything. 

I tried various versions of setChildIndex(bg, 0); and I can get it to go behind everything, but I cann&#039;t seem to get it to layer in the middle of several movie clips. 

I&#039;ve tried the setChildIndex(bg,numChildren - 1); technique doing the same to the other movie clips to control the order but it doesn&#039;t work. Any ideas? cheers</description>
		<content:encoded><![CDATA[<p>Thanks for this class. </p>
<p>I have gotten brndn&#8217;s version working but am still having trouble getting the tiled image not to go on top of everything. </p>
<p>I tried various versions of setChildIndex(bg, 0); and I can get it to go behind everything, but I cann&#8217;t seem to get it to layer in the middle of several movie clips. </p>
<p>I&#8217;ve tried the setChildIndex(bg,numChildren &#8211; 1); technique doing the same to the other movie clips to control the order but it doesn&#8217;t work. Any ideas? cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Schell</title>
		<link>http://efnx.com/conveniently-simple-tiling-sprite/comment-page-1/#comment-601</link>
		<dc:creator>Schell</dc:creator>
		<pubDate>Mon, 02 Nov 2009 17:12:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.efnx.com/?p=25#comment-601</guid>
		<description>Great! Thanks.</description>
		<content:encoded><![CDATA[<p>Great! Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: brndn</title>
		<link>http://efnx.com/conveniently-simple-tiling-sprite/comment-page-1/#comment-600</link>
		<dc:creator>brndn</dc:creator>
		<pubDate>Mon, 02 Nov 2009 14:19:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.efnx.com/?p=25#comment-600</guid>
		<description>Found a bug with Ringo&#039;s class, when it resized, it litterally was stacking backgrounds ontop.
Also added a blendmode option. for more complex and layered backgrounds. nothing too advanced but possibly useful.

[cc lang=&quot;actionscript&quot;]
package {

/**
* Import required packages.
*/
import flash.display.Bitmap;
import flash.display.Shape;
import flash.display.BlendMode;
import flash.display.BitmapData;
import flash.display.Loader;
import flash.display.Sprite;
import flash.display.Stage;
import flash.display.StageAlign;
import flash.events.*;
import flash.net.URLRequest;

/**
* Class definition.
*/
public class TileBG extends Sprite {

/**
* Class variables.
*/
public static var identifier:int;
public var bitmap:Bitmap = new Bitmap();
public var stageInstance:Stage;
public var _blendMode:String;
public var child:Shape;
/**
* Class constructor.
*/
public function TileBG(obj:*, stage, blend:String):void {
identifier++;
_blendMode = blend;
name = &#039;bgSprite-&#039; + identifier;
stageInstance = stage;

if(obj is BitmapData) {
bitmap.bitmapData = obj;
resize();
} else if (obj is String) {
var url:URLRequest = new URLRequest(obj);
var loader:Loader = new Loader();
configureListeners(loader.contentLoaderInfo);
loader.load(url);
} else {
throw new Error(&quot;Problem : First parameter obj must be a string \&quot;path_to_image\&quot; or bitmapData.&quot;);
}
stageInstance.addEventListener(Event.RESIZE, resize);
}

/**
* Configure the loader object events.
*/
private function configureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.COMPLETE, loaderComplete);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR, loaderError);
}

/**
* Loader object complete event.
*/
private function loaderComplete(event:Event):void {
bitmap.bitmapData = Bitmap(event.target.content).bitmapData;
resize();
}

/**
* Loader object error event.
*/
private function loaderError(event:Event):void {
throw new Error(&quot;Problem : There was an error accessing the image file.&quot;);
}

/**
* Resize the background sprite to the stage size.
*/
private function resize(event:Event = null) {

	if(child != null){
	stageInstance.removeChild(child);
	
	}
child = new Shape();

child.graphics.beginBitmapFill(bitmap.bitmapData);
child.graphics.drawRect(0, 0, stageInstance.stageWidth, stageInstance.stageHeight);
child.graphics.endFill();
stageInstance.align = StageAlign.TOP_LEFT;
stageInstance.addChild(child);
child.blendMode = _blendMode;
}

}

}


var bg:TileBG = new TileBG(&quot;pattern1.png&quot;, stage, &quot;difference&quot; );
[/cc]

</description>
		<content:encoded><![CDATA[<p>Found a bug with Ringo&#8217;s class, when it resized, it litterally was stacking backgrounds ontop.<br />
Also added a blendmode option. for more complex and layered backgrounds. nothing too advanced but possibly useful.</p>
<div class="codecolorer-container actionscript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">package <span style="color: #66cc66;">&#123;</span><br />
<br />
<span style="color: #808080; font-style: italic;">/**<br />
* Import required packages.<br />
*/</span><br />
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Bitmap</span>;<br />
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Shape</span>;<br />
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">BlendMode</span>;<br />
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">BitmapData</span>;<br />
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Loader</span>;<br />
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;<br />
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">Stage</span>;<br />
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">StageAlign</span>;<br />
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #66cc66;">*</span>;<br />
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #006600;">URLRequest</span>;<br />
<br />
<span style="color: #808080; font-style: italic;">/**<br />
* Class definition.<br />
*/</span><br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TileBG <span style="color: #0066CC;">extends</span> Sprite <span style="color: #66cc66;">&#123;</span><br />
<br />
<span style="color: #808080; font-style: italic;">/**<br />
* Class variables.<br />
*/</span><br />
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> identifier:<span style="color: #0066CC;">int</span>;<br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> bitmap:Bitmap = <span style="color: #000000; font-weight: bold;">new</span> Bitmap<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> stageInstance:<span style="color: #0066CC;">Stage</span>;<br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> _blendMode:<span style="color: #0066CC;">String</span>;<br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> child:Shape;<br />
<span style="color: #808080; font-style: italic;">/**<br />
* Class constructor.<br />
*/</span><br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> TileBG<span style="color: #66cc66;">&#40;</span>obj:<span style="color: #66cc66;">*</span>, <span style="color: #0066CC;">stage</span>, blend:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span><br />
identifier++;<br />
_blendMode = blend;<br />
<span style="color: #0066CC;">name</span> = <span style="color: #ff0000;">'bgSprite-'</span> + identifier;<br />
stageInstance = <span style="color: #0066CC;">stage</span>;<br />
<br />
<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>obj is BitmapData<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
bitmap.<span style="color: #006600;">bitmapData</span> = obj;<br />
resize<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>obj is <span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">url</span>:URLRequest = <span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span>obj<span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #000000; font-weight: bold;">var</span> loader:Loader = <span style="color: #000000; font-weight: bold;">new</span> Loader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
configureListeners<span style="color: #66cc66;">&#40;</span>loader.<span style="color: #006600;">contentLoaderInfo</span><span style="color: #66cc66;">&#41;</span>;<br />
loader.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">url</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #0066CC;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Problem : First parameter obj must be a string <span style="color: #000099; font-weight: bold;">\&quot;</span>path_to_image<span style="color: #000099; font-weight: bold;">\&quot;</span> or bitmapData.&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
stageInstance.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">RESIZE</span>, resize<span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #808080; font-style: italic;">/**<br />
* Configure the loader object events.<br />
*/</span><br />
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> configureListeners<span style="color: #66cc66;">&#40;</span>dispatcher:IEventDispatcher<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span><br />
dispatcher.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>, loaderComplete<span style="color: #66cc66;">&#41;</span>;<br />
dispatcher.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>IOErrorEvent.<span style="color: #006600;">IO_ERROR</span>, loaderError<span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #808080; font-style: italic;">/**<br />
* Loader object complete event.<br />
*/</span><br />
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> loaderComplete<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span><br />
bitmap.<span style="color: #006600;">bitmapData</span> = Bitmap<span style="color: #66cc66;">&#40;</span>event.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">content</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">bitmapData</span>;<br />
resize<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #808080; font-style: italic;">/**<br />
* Loader object error event.<br />
*/</span><br />
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> loaderError<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #0066CC;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Problem : There was an error accessing the image file.&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #808080; font-style: italic;">/**<br />
* Resize the background sprite to the stage size.<br />
*/</span><br />
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> resize<span style="color: #66cc66;">&#40;</span>event:Event = <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>child <span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; stageInstance.<span style="color: #006600;">removeChild</span><span style="color: #66cc66;">&#40;</span>child<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
child = <span style="color: #000000; font-weight: bold;">new</span> Shape<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<br />
child.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">beginBitmapFill</span><span style="color: #66cc66;">&#40;</span>bitmap.<span style="color: #006600;">bitmapData</span><span style="color: #66cc66;">&#41;</span>;<br />
child.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, stageInstance.<span style="color: #006600;">stageWidth</span>, stageInstance.<span style="color: #006600;">stageHeight</span><span style="color: #66cc66;">&#41;</span>;<br />
child.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
stageInstance.<span style="color: #0066CC;">align</span> = StageAlign.<span style="color: #006600;">TOP_LEFT</span>;<br />
stageInstance.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>child<span style="color: #66cc66;">&#41;</span>;<br />
child.<span style="color: #006600;">blendMode</span> = _blendMode;<br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<br />
<span style="color: #000000; font-weight: bold;">var</span> bg:TileBG = <span style="color: #000000; font-weight: bold;">new</span> TileBG<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;pattern1.png&quot;</span>, <span style="color: #0066CC;">stage</span>, <span style="color: #ff0000;">&quot;difference&quot;</span> <span style="color: #66cc66;">&#41;</span>;</div></div>
]]></content:encoded>
	</item>
</channel>
</rss>

