actionscript-3

Something like PHP's __call() in Actionscript

Suppose (as an example) that I have a class which I want to log all method calls to. In PHP this can be accomplished quickly and easily with __call(), or in Python with decorators. What would be the easiest way to accomplish the same thing in Actionscript 3? ...

Flash Total Memory Usage and TaskManager Memory Usage are diffrent?

Hi I wrote an application in flash AS3, and when I trace from flash the total memory usage of the total application is only about 9MB, But at the same time Task Manager Shows the memory usage as 110MB. Around 100MB difference. Flash Trace Method System.totalMemory difference of the Trace from the Beginning of the application to end of ...

problems with KeyboardEvent and special characters requiring shift key

Hi it seems Flex trapKeys(e:KeyboardEvent) has problems when user is pressing some special marks ; / ? = + ( ) & * with non-us (european) keyboards. Pressing these require shift key. I am using String.fromCharCode Any ideas why e.g. pressing semicolor combination faulty outputs "<" var key:String=String.fromCharCode(e.charCod...

what encoding unescape() function uses?

what encoding unescape() function uses ? I have problem that URL param has utf8 foreign chars, that flash fails to read. ...

Get character with most occurences in a string

Hi there! I've been trying to wrap my head around this for some time now, but haven't been able to come up with an elegant solution. The problem: I have a string with different characters ("ABDDEEDDC") and I need to know which character occurs the most. Any help would be greatly appreciated. Cheers, Niko ...

regex in as3 to ignore match with specific start to string

I have the following as3 function below which converts normal html with links so that the links have 'event:' prepended so that I can catch them with a TextEvent listener. protected function convertLinks(str:String):String { var p1:RegExp = /href|HREF="(.[^"]*)"/gs; str = str.replace(p1,'HREF="event:$1"'); return str; } For exam...

send an object to a function using the "every" loop in AS3

how exactly you send an object using the "every" loop in as3? var myFunction:Function = function(obj:Object):void { obj.height=400*Math.random(); obj.width=400*Math.random(); } function onMouseMove(event:MouseEvent):void { mylist.every(myFunction(this)); } i have also tried using the: function onMouseMove(event:MouseEvent):voi...

AS3 POST Request sending as a GET

When trying to send a POST request to an ASP.NET asmx web service I am seeing (in Charles and Firebug) it go through as a GET. Here is my AS3 public function save(page:SharedPageVO, callback :Function = null): void { var req:URLRequest = new URLRequest( "service.asmx/CreateSharedPage" ); req.data = page; req.method = URLReques...

formulae / algorithm to select centre cells in a grid?

If I have a grid say consisting of 15 x 15 cells (but variable), what formulae or algorithm would I use to randomly select 20 cells clustered around the centre cell? I guess I would ideally like to be able to set the centre point, cluster radius, density etc... any pointers would be really appreciated! cheers. ...

ActionScript-3 cannot have multiple constructors?

I have public function Shard() { } public function Shard(x:Number, y:Number, vx:Number, vy:Number, rotation:Number, spin:Number) { ... } And I got on the second constructor: Multiple constructor definitions found. Constructor may not be defined in code. So, ActionScript-3 cannot have multiple c...

Flex - Date serialization

Does anyone know how to get actionscript to render a null date value '000:00:00T00:00:00'? I am calling a web service that expects date fields in the SOAP xml. I need some of these dates to serialize as null and I can't see how to produce null. The closest value I can get is '1899-11-30T00:00:00Z'. Below is the code I am using: var dat...

FLVPlayback - replay counter

Is there a way to output in the text filed a number of how many times the video looped? (how many times it has played) Thanks, Yan ...

flex 4: window system development ideas

My application will need some windows but I can't use the popUpManager to handle custom components so I'm thinking to implement a new window system. But I still don't know how to merge it with my custom components. Any ideas? My code: My login skin: <s:Skin(...)> <s:Group> (...login components...) </s:Group> </s:Skin> `...

Actionscript 3 top-level exception handling

Is it possible to catch ALL exceptions at some top-level in Actionscript 3? If so, how? ...

Actionscript Child within parent within parent

I am trying to make a calculator where a user can select from a list of items. If a user clicks say "ITEM1", it should add the item to a "CONTAINER_MC". The problem i have is all my data is set inside an array containing names and prices like the code below. var menuNames:Array = [ "Item1", "Item2", "Item3", "Item4", "item5", "i...

How can I make a flash as3 drop shadow overlap something else?

So I am porting a game I started in html canvas to flash as3. In this game there is a tank. This tank has a body and a turret. It can rotate 360 degrees and move foward and backwards and swivel it's turret 360 degrees. The tank base and the turret are seperate animated images. I have set it up so that there is a tank movieclip and a t...

write an adapter that maps all the LinkedSetFx events to the expected Flex collection events(As3Common-collection)

LinkeSetFx has its own CollectionEvent, but I don't know how to map the LinkedSetFx event to mx.events.collectionEvent(I want use it in ComboBox). LinkedSetFx is in AS3Commons-collection framework.Here is the url, choose the as3commons-collections-1.0.0.zip, you'll find LinkedSetFx in src\org\as3commons\collections\fx ...

Streaming sound control in Flex (Newbie)

I'm assuming my lack of knowledge (I just started learning Flex yesterday, hah!) is the reasoning behind my inability to figure out how to make this work correctly - it may even just be a code positioning issue. I've got several MP3 files I'm trying to stream. Right now I'm just trying to start and stop the main MP3. I've got the MP3 su...

Actionscript: How do I rotate an external png image using a matrix?

Okay so I have two import pieces of code involved in this. This first tiny bit is what creates an object called OBJECT_arrow. It is located in the main function of my main class: new OBJECT_arrow().CREATE(this,200,200); It isn't really all that important. Now this next bit is the OBJECT_arrow class. What it does is loads an external p...

Flash/AS3 "Shutdown" or "close" event?

I am making a Flash puzzle game. When the user loads the game, it needs to ask whether to resume the game from the last state (if it exists). I have a serialization system in place, but I need to ensure that the loaded state is definitely the last state. One solution is to save the state to a SharedObject every time the state changes (w...