actionscript-3

certain BitMapData types dont work in a beginBitmapFill() method.

Say I loaded a bitMap into a bitmapData type called tileImage. tileImage = Bitmap(loader.content).bitmapData; say I decided to add that bitmap into a sprite like below this.graphics.beginBitmapFill(tileImage ); this.graphics.drawRect(0, 0,tWidth ,tHeight ); It would of course work. But say If I decided to add tileImage into a ano...

extending a class and implementing an interface

I am creating objects for a game, they are all sprites. but I also want them to implement an interface. Is it possible to do both ? If not, how can i have an object have the capabilities of a sprite and also have it implement an interface. I am wanting to create another class that checks all my objects to see what datatype they are and e...

TextField getCharBoundaries not giving proper co-ordinates

Hi all, I'm developing one AS3 application in which I need to add blank editable box between string. I use tag to define blank. The problem I'm having is, getCharBoundries may b not giving proper bounding box for characters. to get boundingBox of word, I use getCharBourndries of First char of word and last char of word and calculate x,...

transform single channel of BitmapData object

I have a BitmapData object with an alpha channel. I'd like to know the fastet way to offset that alpha channel in ActionScript3 (FlashPlayer10). By offsetting I mean shifting all pixels of that channel in one direction (wrapping around the image borders) while leaving the color channels as they were. Is there a good way to apply a such ...

Actionscript BlurFilter wrap around

I'm using the standard ActionScript blur filter to blur an image. The image will later be used as a texture map on a cylinder, i.e. it's left and right edges will meet in 3D. This looks bad because the blur filter has discontinuities at the image edges. I'd like to set it so it'll wrap around the image so that instead of truncating the f...

How to properly create Game Objects

I am making sims like game and right now I am trying to figure out how I will structure my objects. Right now I am thinking to create a class called GameObject, the psuedo is below public class GameObject { name:String width:int height:int } This way I could create objects like bushes, trees, and buildings. But...

Does a class have to implement a interface directly

Quick question. Does a class have to implement a interface directly to be accepted, or can it be a child of a parent class that implements it. so If I pass a child object into a method that only accepts IOBJECT, but the child class parent implements IOBJECT. will child object be accepted ? ...

Does flash only compile what it needs to? Or does it always 'rebuild all'?

new to Flash - I have a main FLA that loads and runs my entire flash/AS3 project. It always seems to take the same amount of time (~3 minutes) no matter what code has changed. Does Flash have the concept of makefiles? Is it always rebuilding all of my code? ...

Finding out what type a certain interface is

I am creating a method that accepts a IOBJECT parameter. there is multiple class that implement this interface. I need to figure out which type IOBJECT is. how would i go about doing that ...

applying the is operand or the instanceof in a case statement

I am trying to figure out how to apply the is operand or the instanceof in a case statement to determine which datatype a interface object belongs too. keep getting errors switch (IOjbect is) { case Tile: trace ("Load Tile"); break; case House: trace ("A House Load...

Changing a sprites bitmap

As of right now, I am trying to create a tiling effect for a game I am creating. I am using a tilesheet and I am loading the tiles to the sprite like so... this.graphics.beginBitmapFill(tileImage); this.graphics.drawRect(30, 0,tWidth ,tHeight ); var tileImage is the bitMapData. 30 is the Number of pixels to move retangle. then tWidth ...

Invalid BitMapdata Error #2015

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:Numb...

1067: Implicit coercion of a value of type void to an unrelated type flash.geom:Matrix.

Im confused, I passed a matrix datatype into the this.graphics.beginBitmapFill(); and i get Implicit coercion of a value of type. below is my code. var theMatrix:Matrix; theMatrix = new Matrix(); this.graphics.beginBitmapFill(tileImage,theMatrix.translate(30,0)); this.graphics.endFill(); and the fol...

understanding matrix.transition(); as3

I am trying to understand the method transition that falls in the Matrix Class. I am using it to copy pieces of a bitMapData. But I need to better understand what transitions do. I have a tilesheet that has 3 images on it. all 30x30 pixels. the width of the total bitmap is 90pxs. The first tile is green, the second is brown, and the ...

#2015: Invalid BitmapData.

in my class, if I create bitmapData like this private var tImage:BitmapData; public function object():void { tImage = new BitmapData(30,30,false,0x000000); } I get the following error ArgumentError: Error #2015: Invalid BitmapData. But if I declare the varible inside the method public function object():void { var tIm...

Flex 4 - Programmatically set a button click handler function to null

I am looking for a way to programmatically dissassoicate the click handler function from a button on my mxml component through actionscript code. Something like what older actionscript let you do, mybutton.click = null; Thanks in advance ...

Can I force actionscript code to be executed lineary?

Let's say I have some code like this in AS3 for(...) thing = new Thing(...) The constructor for Thing is going to cause a swf to be rendered onto some movieclip. If the loop is run 10 times or so, most of the time I will only end up with a subset of Things showing up on the clip. I'm guessing this is a problem that flash is having ...

How to convert a date object to a formatted string?

so I have a variable containing a date object. I want to convert it to a string in this format: dd/mm/yyyy. How could this be achieved? ...

Get date from period number in Actionscript.

Hi, I have a table which containt a date, a number for the number of weeks per period, and a year. the user then enters a date and I can calculate the period number from this. But I'd like to do it the other way too: Entering a period number and get the start and end date of the period from this. Unfortunately, I can't seem to get the r...

Binary search, from java to Actionscript

Hi I am trying to convert the following java binary search routine to as3. I assume that 'compareTo' is a built in java method and that '>>>' s a type of bitwise operation. Can anyone familiar with both actionscript 3 and Java help with this? package binary; public class Finder { public static int find( String[ ] keys, String targe...