I have a Problem with away 3d.I wanted to create an application and it was working fine till I had embedded 5 images in my program but as soon as I embed more than 5 images the flash develop stops responding [No debug Flash player connection request] showing me this message.Is it the problem with the number of images or should I do something else to include these images.
[Embed(source="assets1/b1 copy.png")]
private var EarthImage:Class;
private var earth:Bitmap = new EarthImage();
[Embed(source="assets1/balls.jpg")]
private var bac:Class;
private var bm:Bitmap = new bac();
[Embed(source="assets1/1.png")]
private var bac1:Class;
private var bm1:Bitmap = new bac1();
[Embed(source="assets1/2.png")]
private var bac2:Class;
private var bm2:Bitmap = new bac2();
[Embed(source="assets1/3.png")]
public var bac3:Class;
public var bm3:Bitmap = new bac3();
[Embed(source="assets1/4.png")]
public var bac4:Class;
public var bm4:Bitmap = new bac4();
[Embed(source="assets1/5.png")]
public var bac5:Class;
public var bm5:Bitmap = new bac5();
[Embed(source="assets1/6.png")]
public var bac6:Class;
public var bm6:Bitmap = new bac6();
[Embed(source="assets1/7.png")]
public var bac7:Class;
public var bm7:Bitmap = new bac7();
[Embed(source="assets1/8.png")]
public var bac8:Class;
public var bm8:Bitmap = new bac8();
[Embed(source="assets1/9.png")]
public var bac9:Class;
public var bm9:Bitmap = new bac9();
[Embed(source="assets1/10.png")]
public var bac10:Class;
public var bm10:Bitmap = new bac10();
[Embed(source="assets1/11.png")]
public var bac11:Class;
public var bm11:Bitmap = new bac11();
[Embed(source="assets1/12.png")]
public var bac12:Class;
public var bm12:Bitmap = new bac12();
[Embed(source="assets1/13.png")]
public var bac13:Class;
public var bm13:Bitmap = new bac13();
[Embed(source="assets1/14.png")]
public var bac14:Class;
public var bm14:Bitmap = new bac14();
[Embed(source="assets1/15.png")]
public var bac15:Class;
public var bm15:Bitmap = new bac15();
[Embed(source="assets1/16.png")]
public var bac16:Class;
public var bm16:Bitmap = new bac16();
[Embed(source="assets1/17.png")]
public var bac17:Class;
public var bm17:Bitmap = new bac17();
[Embed(source="assets1/18.png")]
public var bac18:Class;
public var bm18:Bitmap = new bac18();
[Embed(source="assets1/19.png")]
public var bac19:Class;
public var bm19:Bitmap = new bac19();
[Embed(source="assets1/20.png")]
public var bac20:Class;
public var bm20:Bitmap = new bac20()
This is the code I am using to embed the images into the application.
Related
I want to have embed video in flash game and have it looped. Is there a way to do it? As my code or more likely .seek or .resume dont give any effect? Am I using wrong commands or?
[Embed(source = "fast.flv", mimeType = "application/octet-stream")]
public var bytes:Class;
public var vidNS:NetStream
public var video:Video = new Video(1280, 720);
public var ns:NetStream;
public function Main() {
Doit();
}
private function Doit():void{
addChild(video);
var vidNC:NetConnection = new NetConnection(); vidNC.connect(null);
vidNS = new NetStream(vidNC);
var metaListener :Object = new Object(); metaListener = { onMetaData: process_Metadata };
vidNS.client = metaListener;
vidNS.addEventListener(NetStatusEvent.NET_STATUS, videoStatusHandler);
vidNS.play(null);
var file:ByteArray = new bytes();
vidNS.appendBytes(file);
video.attachNetStream(vidNS);
}
function process_Metadata (in_Data :Object):void
{
trace("duration is : " + in_Data.duration );
}
function videoStatusHandler (event:NetStatusEvent):void
{
if (event.info.code == "NetStream.Buffer.Empty")
{
trace('loop')
vidNS.seek(0); vidNS.resume();
}
}
You can loop by just simply re-feeding the bytes to the decoder (NetStream)
It's possible that you also need to involve the option RESET_BEGIN:
yourNS.appendBytesAction( NetStreamAppendBytesAction.RESET_BEGIN );
Try setting your code like below:
[Embed(source = "fast.flv", mimeType = "application/octet-stream")]
public var bytes:Class;
public var vidNS:NetStream;
public var video:Video = new Video(1280, 720);
public var ns:NetStream;
//# declare these vars outside of a function for global access
public var file:ByteArray = new bytes();
public var vidNC:NetConnection;
public var metaListener :Object;
public function Main()
{
Doit();
}
private function Doit():void
{
addChild(video);
vidNC = new NetConnection(); vidNC.connect(null);
vidNS = new NetStream(vidNC);
metaListener new Object(); metaListener = { onMetaData: process_Metadata };
vidNS.client = metaListener;
vidNS.addEventListener(NetStatusEvent.NET_STATUS, videoStatusHandler);
vidNS.play(null);
//var file:ByteArray = new bytes();
vidNS.appendBytes(file); //# feed video bytes to decoder
video.attachNetStream(vidNS);
}
function process_Metadata (in_Data :Object):void
{
trace("duration is : " + in_Data.duration );
}
function videoStatusHandler (event:NetStatusEvent):void
{
if (event.info.code == "NetStream.Buffer.Empty")
{
trace('now doing: looping...')
//# there is no timeline ".seek" in appendBytes mode, use ".seek" to clear the buffer for a new re-feed
vidNS.seek(0); //clears the current buffer (video data is removed)
vidNS.appendBytesAction( NetStreamAppendBytesAction.RESET_BEGIN ); //re-set timestamps for decoder
vidNS.appendBytes(file); //re-feed video bytes to decoder
}
}
So Thanks to VC. One i ended up with this code:
[Embed(source="1.flv", mimeType="application/octet-stream")]
public var bytes:Class;
public var vidNS:NetStream;
public var video:Video = new Video(1280, 720);
public var file:ByteArray = new bytes();
public var vidNC:NetConnection;
public var metaListener :Object;
public function Main()
{
Doit();
}
private function Doit():void
{
addChild(video);
vidNC = new NetConnection(); vidNC.connect(null);
vidNS = new NetStream(vidNC);
metaListener new Object(); metaListener = { onMetaData: process_Metadata };
vidNS.client = metaListener;
vidNS.play(null);
vidNS.appendBytes(file);
video.attachNetStream(vidNS);
}
function process_Metadata (in_Data :Object):void
{
trace("loop ");
vidNS.appendBytesAction(NetStreamAppendBytesAction.RESET_BEGIN);
vidNS.appendBytes(file);
}
Its working like it should, but i'm not sure if thats the right way of doing it ^^.
errore (private var isPlaying:Boolean;),i want paly more mp3 file for my project.help me.
Here's my code starts:
public class PlayerClass extends MovieClip
{
private var urlLoader:URLLoader;
private const xmlPath:String = "playlist.xml";//xml path
private var xml:XML;
private var songs:Array;// array for song paths
private var titles:Array;// array for song titles
private var currentSong:Number = 0;
private var sound:Sound;
private var context:SoundLoaderContext;
private var channel:SoundChannel;
private var isPlaying:Boolean;
private var isStopped:Boolean;
private var songPosition:int = 0;
}
I'm trying to create something like Assets manager, where I would embed bunch of images in one class and then pass them to other classes for further use. The problem is, after doing all the work, the images simply wont appear, not all of them. From total 41 images I get about 23 to render/display properly. I triple checked all the code, tried in both Flashdevelop and Flash Professional, tried to add each image to it's own MovieClip or Sprite before adding them to stage, tried adding them one by one with addChild method (without using for loop) and still no success... Also there is no compile error (neither syntax).
Is there something like "max embedded image count" for flashdevelop or flash professional?
Here is the code:
package
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.MovieClip;
import flash.display.Sprite;
public class AssetsLoader extends MovieClip
{
[Embed(source = "assets/map800x500.jpg")] private var _layer0Class:Class; public var layer0:Bitmap = new _layer0Class();
[Embed(source = "assets/al/AFR_01.png")] private var AFR_01_Class:Class; public var AFR_01:Bitmap = new AFR_01_Class() as Bitmap;
[Embed(source = "assets/al/AFR_02.png")] private var AFR_02_Class:Class; public var AFR_02:Bitmap = new AFR_02_Class() as Bitmap;
[Embed(source = "assets/al/AFR_03.png")] private var AFR_03_Class:Class; public var AFR_03:Bitmap = new AFR_03_Class() as Bitmap;
[Embed(source = "assets/al/AFR_04.png")] private var AFR_04_Class:Class; public var AFR_04:Bitmap = new AFR_04_Class() as Bitmap;
[Embed(source = "assets/al/AFR_05.png")] private var AFR_05_Class:Class; public var AFR_05:Bitmap = new AFR_05_Class() as Bitmap;
[Embed(source = "assets/al/AFR_06.png")] private var AFR_06_Class:Class; public var AFR_06:Bitmap = new AFR_06_Class() as Bitmap;
[Embed(source = "assets/al/ASI_01.png")] private var ASI_01_Class:Class; public var ASI_01:Bitmap = new ASI_01_Class() as Bitmap;
[Embed(source = "assets/al/ASI_02.png")] private var ASI_02_Class:Class; public var ASI_02:Bitmap = new ASI_02_Class() as Bitmap;
[Embed(source = "assets/al/ASI_03.png")] private var ASI_03_Class:Class; public var ASI_03:Bitmap = new ASI_03_Class() as Bitmap;
[Embed(source = "assets/al/ASI_04.png")] private var ASI_04_Class:Class; public var ASI_04:Bitmap = new ASI_04_Class() as Bitmap;
[Embed(source = "assets/al/ASI_05.png")] private var ASI_05_Class:Class; public var ASI_05:Bitmap = new ASI_05_Class() as Bitmap;
[Embed(source = "assets/al/ASI_06.png")] private var ASI_06_Class:Class; public var ASI_06:Bitmap = new ASI_06_Class() as Bitmap;
[Embed(source = "assets/al/ASI_07.png")] private var ASI_07_Class:Class; public var ASI_07:Bitmap = new ASI_07_Class() as Bitmap;
[Embed(source = "assets/al/ASI_08.png")] private var ASI_08_Class:Class; public var ASI_08:Bitmap = new ASI_08_Class() as Bitmap;
[Embed(source = "assets/al/ASI_09.png")] private var ASI_09_Class:Class; public var ASI_09:Bitmap = new ASI_09_Class() as Bitmap;
[Embed(source = "assets/al/ASI_10.png")] private var ASI_10_Class:Class; public var ASI_10:Bitmap = new ASI_10_Class() as Bitmap;
[Embed(source = "assets/al/ASI_11.png")] private var ASI_11_Class:Class; public var ASI_11:Bitmap = new ASI_11_Class() as Bitmap;
[Embed(source = "assets/al/AUS_01.png")] private var AUS_01_Class:Class; public var AUS_01:Bitmap = new AUS_01_Class() as Bitmap;
[Embed(source = "assets/al/AUS_02.png")] private var AUS_02_Class:Class; public var AUS_02:Bitmap = new AUS_02_Class() as Bitmap;
[Embed(source = "assets/al/AUS_03.png")] private var AUS_03_Class:Class; public var AUS_03:Bitmap = new AUS_03_Class() as Bitmap;
[Embed(source = "assets/al/AUS_04.png")] private var AUS_04_Class:Class; public var AUS_04:Bitmap = new AUS_04_Class() as Bitmap;
[Embed(source = "assets/al/EUR_01.png")] private var EUR_01_Class:Class; public var EUR_01:Bitmap = new EUR_01_Class() as Bitmap;
[Embed(source = "assets/al/EUR_02.png")] private var EUR_02_Class:Class; public var EUR_02:Bitmap = new EUR_02_Class() as Bitmap;
[Embed(source = "assets/al/EUR_03.png")] private var EUR_03_Class:Class; public var EUR_03:Bitmap = new EUR_03_Class() as Bitmap;
[Embed(source = "assets/al/EUR_04.png")] private var EUR_04_Class:Class; public var EUR_04:Bitmap = new EUR_04_Class() as Bitmap;
[Embed(source = "assets/al/EUR_05.png")] private var EUR_05_Class:Class; public var EUR_05:Bitmap = new EUR_05_Class() as Bitmap;
[Embed(source = "assets/al/EUR_06.png")] private var EUR_06_Class:Class; public var EUR_06:Bitmap = new EUR_06_Class() as Bitmap;
[Embed(source = "assets/al/EUR_07.png")] private var EUR_07_Class:Class; public var EUR_07:Bitmap = new EUR_07_Class() as Bitmap;
[Embed(source = "assets/al/NAM_01.png")] private var NAM_01_Class:Class; public var NAM_01:Bitmap = new NAM_01_Class() as Bitmap;
[Embed(source = "assets/al/NAM_02.png")] private var NAM_02_Class:Class; public var NAM_02:Bitmap = new NAM_02_Class() as Bitmap;
[Embed(source = "assets/al/NAM_03.png")] private var NAM_03_Class:Class; public var NAM_03:Bitmap = new NAM_03_Class() as Bitmap;
[Embed(source = "assets/al/NAM_04.png")] private var NAM_04_Class:Class; public var NAM_04:Bitmap = new NAM_04_Class() as Bitmap;
[Embed(source = "assets/al/NAM_05.png")] private var NAM_05_Class:Class; public var NAM_05:Bitmap = new NAM_05_Class() as Bitmap;
[Embed(source = "assets/al/NAM_06.png")] private var NAM_06_Class:Class; public var NAM_06:Bitmap = new NAM_06_Class() as Bitmap;
[Embed(source = "assets/al/NAM_07.png")] private var NAM_07_Class:Class; public var NAM_07:Bitmap = new NAM_07_Class() as Bitmap;
[Embed(source = "assets/al/NAM_08.png")] private var NAM_08_Class:Class; public var NAM_08:Bitmap = new NAM_08_Class() as Bitmap;
[Embed(source = "assets/al/NAM_09.png")] private var NAM_09_Class:Class; public var NAM_09:Bitmap = new NAM_09_Class() as Bitmap;
[Embed(source = "assets/al/SAM_01.png")] private var SAM_01_Class:Class; public var SAM_01:Bitmap = new SAM_01_Class() as Bitmap;
[Embed(source = "assets/al/SAM_02.png")] private var SAM_02_Class:Class; public var SAM_02:Bitmap = new SAM_02_Class() as Bitmap;
[Embed(source = "assets/al/SAM_03.png")] private var SAM_03_Class:Class; public var SAM_03:Bitmap = new SAM_03_Class() as Bitmap;
[Embed(source = "assets/al/SAM_04.png")] private var SAM_04_Class:Class; public var SAM_04:Bitmap = new SAM_04_Class() as Bitmap;
public var allTerritories:Array = [AFR_01, AFR_02, AFR_03, AFR_04, AFR_05, AFR_06,
ASI_01, ASI_02, ASI_03, ASI_04, ASI_05, ASI_06, ASI_07, ASI_08, ASI_09, ASI_10, ASI_11,
AUS_01, AUS_02, AUS_03, AUS_04,
EUR_01, EUR_02, EUR_03, EUR_04, EUR_05, EUR_06, EUR_07,
NAM_01, NAM_02, NAM_03, NAM_04, NAM_05, NAM_06, NAM_07, NAM_08, NAM_09,
SAM_01, SAM_02, SAM_03, SAM_04];
public var alphaContainer:MovieClip = new MovieClip();
public function AssetsLoader()
{
for (var i:int = 0; i < allTerritories.length; i++)
{
alphaContainer.addChild(allTerritories[i]);
alphaContainer.getChildAt(i).alpha = 1;
}
}
}
}
In another class I'm adding "alphaContainer" to stage:
package
{
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
[SWF(width = "800", height = "500", backgroundColor = "#222222", frameRate = "60")]
public class GameMap extends MovieClip
{
public var map:AssetsLoader = new AssetsLoader();
public function GameMap()
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init():void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
addChild(map.alphaContainer);
}
}
}
I once had a similar problem, and when I run my SWF in a debugger, it turned out that there's some runtime library missing which is required for loading embedded content. It was related to a compiler warning which appeared in my command line when compiling:
Warning: This compilation unit did not have a factoryClass specified in Frame metadata to load the configured runtime shared libraries. To compile without runtime shared libraries either set the -static-link-runtime-shared-libraries option to true or remove the -runtime-shared-libraries option.
When I added the -static-link-runtime-shared-libraries option, it started working.
Maybe the cause of your problem is the same?
I'm trying to transform my actionscript 3 code from the timeline, which I previously used, to packages.
I need to define some dictionaries in the beginning of the code.
But when running the following code inside my class, actionscript returns an error.
public var S_USA:Dictionary = new Dictionary();
S_USA["x"] = -299;
S_USA["y"] = -114;
S_USA["bynavn"] = "New York";
This is the error: "1120: Access of undefined property S_USA.
EDIT: Posting the entire code:
package
{
import fl.motion.MatrixTransformer;
import flash.display.MovieClip;
import flash.utils.Dictionary;
import flash.display.Shape;
import fl.transitions.Fly;
import fl.motion.MatrixTransformer;
import flash.events.MouseEvent;
import flash.display.Sprite;
import flash.events.KeyboardEvent;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.ui.Mouse;
import flash.text.TextField;
import flash.display.SimpleButton;
import fl.controls.List;
public class Main extends MovieClip
{
public static var bg_width = 980;
public static var bg_height = 541;
public var spImage:Sprite;
public var mat:Matrix;
public var mcIn:MovieClip;
public var mcOut:MovieClip;
public var externalCenter:Point;
public var internalCenter:Point;
public var scaleFactor:Number = 0.8;
public var minScale:Number = 0.25;
public var maxScale:Number = 10.0;
/*public static var startList:List;
public static var sluttList:List;*/
public var bynavntxt:TextField;
public var intervall:TextField;
public var create_route:SimpleButton;
public var confirm_button:SimpleButton;
public var beregn_tid:SimpleButton;
public static var S_Norway:Dictionary = new Dictionary();
S_Norway["x"] = -60;
S_Norway["y"] = -183;
S_Norway["bynavn"] = "Oslo";
public static var S_Australia:Dictionary = new Dictionary();
S_Australia["x"] = 307;
S_Australia["y"] = 153;
S_Australia["bynavn"] = "Sydney";
public static var S_China:Dictionary = new Dictionary();
S_China["x"] = 239;
S_China["y"] = -98;
S_China["bynavn"] = "Beijing";
public static var S_South_Africa:Dictionary = new Dictionary();
S_South_Africa["x"] = -26;
S_South_Africa["y"] = 146;
S_South_Africa["bynavn"] = "Cape Town";
public static var S_Brazil:Dictionary = new Dictionary();
S_Brazil["x"] = -210;
S_Brazil["y"] = 73;
S_Brazil["bynavn"] = "Rio de Janeiro";
public static var S_USA:Dictionary = new Dictionary();
S_USA["x"] = -299;
S_USA["y"] = -114;
S_USA["bynavn"] = "New York";
public static var S_France:Dictionary = new Dictionary();
S_France["x"] = -79;
S_France["y"] = -135;
S_France["bynavn"] = "Paris";
// ------------------------------------------------------
public static var Flyplasser:Dictionary = new Dictionary();
Flyplasser["USA"] = S_USA;
Flyplasser["Norway"] = S_Norway;
Flyplasser["South Africa"] = S_South_Africa;
Flyplasser["Brazil"] = S_Brazil;
Flyplasser["France"] = S_France;
Flyplasser["China"] = S_China;
Flyplasser["Australia"] = S_Australia;
public function Main()
{
// ------------------------------------
startList:List = new List();
sluttList:List = new List();
bynavntxt:TextField = new TextField() ;
intervall:TextField = new TextField() ;
create_route:SimpleButton = new SimpleButton() ;
confirm_button:SimpleButton = new SimpleButton() ;
beregn_tid:SimpleButton = new SimpleButton() ;
this.addChild(startList);
this.addChild(sluttList);
this.addChild(bynavntxt);
this.addChild(intervall);
this.addChild(create_route);
this.addChild(confirm_button);
this.addChild(beregn_tid);
// -----------------------------------------
// We use the ctrl and shift keys to display the two different cursors that were created on the stage.
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler);
stage.addEventListener(KeyboardEvent.KEY_UP, keyHandler);
this.addEventListener(MouseEvent.CLICK, mouseCoordinates);
trace("Main spawned");
// --------------------
this.width = bg_width;
this.height = bg_height;
// --------------------
for (var k:Object in Flyplasser)
{
var value = Flyplasser[k];
var key = k;
trace(key);
startList.addItem({label:key, data:key});
sluttList.addItem({label:key, data:key});
var airport:flyplass = new flyplass(key,Flyplasser[key]["bynavn"]);
airport.koordinater(Flyplasser[key]["x"], Flyplasser[key]["y"]);
this.addChild(airport);
}
var mcOut = new OutCursorClip();
this.addChild(mcOut);
var mcIn = new InCursorClip();
this.addChild(mcIn);
startList = new List();
this.addChild(startList)
sluttList = new List();
this.addChild(sluttList)
bynavntxt = new TextField;
this.addChild(bynavntxt)
intervall = new TextField;
this.addChild(intervall)
create_route = new SimpleButton;
this.addChild(create_route)
confirm_button = new SimpleButton;
this.addChild(confirm_button)
beregn_tid = new SimpleButton;
this.addChild(beregn_tid)
Are you setting this data inside Constructor or function?
EDIT:
Hm, where to start...
1) You know that the trick with static is not gonna work if you'll create more than 1 instance of class? In this case if you have only 1 Main class it's gonna work, but omg... Imho it's not nice to store data in static vars...
2) If you already declared:
public var bynavntxt:TextField;
public var intervall:TextField;
later just do
bynavntxt = new TextField() ;
intervall = new TextField() ;
no need for type in there.
3) Later in Main you have something like:
var mcOut = new OutCursorClip();
this.addChild(mcOut);
var mcIn = new InCursorClip();
this.addChild(mcIn);
Why are you declaring new variables with same name but without Type?
Waaaaaay up you have:
public var mcIn:MovieClip;
public var mcOut:MovieClip;
so those variables are already declared. By declaring them once again you are creating local ones. Beware!! The ones from the top would be null after that.
1) Fill the dictionary inside the Constructor (I seen by comments you have done this already).
2) you have already assigned type to bynavntxt with public var bynavntxt:TextField; you should not be doing it again with bynavntxt:TextField = new TextField(); just bynavntxt= new TextField(); will do.
This is the same with all other variables on similar type.
3) Make sure this class is going to be your "Document Class"/"Compiled Class" otherwise you will not have access to the 'stage' variable yet. To make sure you will have access to the stage variable you can always do:
/* Inside Constructor */
addEventListener(Event.ADDED_TO_STAGE, _onAddedToStage);
/* Outside Constructor */
private function _onAddedToStage(e:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, _onAddedToStage);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler);
stage.addEventListener(KeyboardEvent.KEY_UP, keyHandler);
}
Again, if this is going to be the compiled class, this can be skipped.
private static var tileDir:String;
public static var tileImage:BitmapData;
private static var loader:Loader;
public static var tileReady:EventDispatcher = new EventDispatcher();
public static var tileNum_perRow:Number = 3;
public static var select:selector;
public var tileNum:Number = 0;
public var setBack:Number = 0;
public var tileState:String;
public var tCol:Number;
public var tRow:Number;
private var tWidth:int = 30;
private var tHeight:int = 30;
private var tImage:BitmapData;
private var canvas:Bitmap;
private var p:Point;
private var r:Rectangle;
public function Tile():void
{
var tempImage:BitmapData = tileImage;
r = new Rectangle(0,0,30,30);
p = new Point(0,0);
tImage = new BitmapData(30,30);
tImage.copyPixels(tempImage,r,p);
}
And I get the following error:
ArgumentError: Error #2015: Invalid BitmapData.
It tends to happen when I copy the pixels. I dont know why.
tileImage;
tileImage is valid, I've used the variable in the code below and it works. But above doesnt. Don't know why. Anyone have any clues?
this.graphics.beginBitmapFill(tileImage);
this.graphics.drawRect(60, 0,tWidth ,tHeight );
Nevermind, I figure a better solution
theMatrix.translate(30,0);
this.graphics.beginBitmapFill(tileImage,theMatrix);
//this.graphics.drawRect(0, 0,tWidth ,tHeight );
this.graphics.endFill();
using the theMatrix.translates give you the ability to choose what part of the tile you want, without effecting the position of the sprite