actionscript-3

how to debug swf browser crashes

My swf is occasionally crashing the browser (or just crashing the plugin as chrome tells me). How do I diagnose the bug? I am developing for flash player 9 using flex. Things I have tried: Turned on log files so I can see trace("...") output. However, my log files, and my swf, are ending at inconsistent termination points. Insta...

is there fillArc function available for AS3

is there this kind of function available in AS3: g.fillArc(5,5,w-10,h-10,90,-360*value/limit); // JAVA ...

Flex AdvancedDataGridItemRenderer backgroundColor/textColor not rendering

I have the following class that extends AdvancedDataGridItemRenderer: package { import mx.controls.advancedDataGridClasses.AdvancedDataGridItemRenderer; public class TestADGIR extends AdvancedDataGridItemRenderer { public function TestADGIR() { super(); backgro...

How do I dynamically position a swf in flex relative to its parent container?

How do I position a child relative to its containing box? The Code: <mx:Script> <![CDATA[ thisMap.scaleX = scaleFactor; thisMap.scaleY = scaleFactor; thisMap.x = thisMap.x - thisMap.mouseX * 1.3; thisMap.y = thisMap.y - thisMap.mouseY * 1.3; ]]> </mx:Script> <mx:Box id="mapHolder" x="0" y="30"> ...

Fitting Flex Image in Canvas

How do I scale an Image in Flex to fit a Canvas? My code follows: <?xml version="1.0" encoding="utf-8"?> <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" horizontalAlign="center" width="100" height="100" verticalGap="0" borderStyle="solid" initialize="onLoad()" horizontalScrollPolicy="off" vertical...

Asynchronous function call in Flex

Is it possible to call a function asynchronously in Flex? I want to parse a file at regular intervals without blocking the rest of the application, what is the recommended approach for this? ...

ActionScript problem with prototype and static type variables

I'm developing a flash (Flash 9, AS3) to connect to a server and send/receive/parse data to a chat on JavaScript/HTML. I have a structure like this: package { public class myClass { String.prototype.escapeHtml = function() { var str = this.replace(/&/g, "&amp;"); str = str.replace(/</g, "&lt;"); str = str.repl...

Cloning object in Flex ? Canvas Degrafa ? help

Hello guys, I have a Canvas i would like to clone. This canvas hold a Degrafa Surface with several Geometry shapes. I tried the naive approach of return ObjectUtil.copy(graph_area) as Canvas; TypeError: Error #1034: Type Coercion failed: cannot convert Object@63b1b51 to com.degrafa.geometry.Geometry. TypeError: Error #1034: Type Coe...

how do I add properties named by runtime arguments to an actionscript object?

Hi. I need a function that gets two array parameters of the same length: property-names (Strings) and property-values. the function should create an object with properties so that, for an example, after calling var obj:Object = makeObject({"prop1","prop2"},{1,2}); the testing condition (obj.prop1 == 1 && obj.prop2 == 2) should be t...

Flex databinding a function

Does anyone know how to programmatically bind a property to a function that isn't a getter? IE: I have a function that returns a translated string based on the identifier you pass it. How do I do this in AS3 rather than MXML? (reason being - I have a dynamic layout that I render based on XML and so have create and add all children progr...

Is it possible to remove properties from a dynamic class?

I have a dynamic ActionScript Class that is used to send parameters to a WebService. Some of these parameters are always present, so they are public properties of the Class: package { [Bindable] public dynamic class WebServiceCriteria { public var property1:int; public var property2:String; public v...

When I use a dynamic class for my WebService arguments, the public properties are not included

I have a dynamic Class that is a Value Object that is used to pass arguments to a WebService. It has two public properties: package { [Bindable] public dynamic class WebServiceCriteria { public var property1:String; public var property2:String; } } I set these two properties in one part of my applicati...

Protocol simplicity versus "properness"

I have another argument with a friend of mine. Consider having a need to design a simplistic JSON-based protocol, which is basically used to send sort of events (messages) between parties. Say, something like { event_id: 1, chat_message: "Hello" } { event_id: 2, group_id: 3, presence: "online" } ... I propose to keep this protoc...

Lean packet protocol for AS3 and C#?

Is there by chance a lean (meaning not xml or json) packet protocol that is implemented in both actionscript 3 and C#? It would be great if there was one that already had an implementation in both languages. If not, I may have to code one side. That being said, would it be stupid/unsafe to figure out (or find documents of) C#'s serializa...

Flash: Dispatching/handling events

Hi, I have Flash application (main_container.swf) that loads another swf file (page1.swf). I want to dispatch an event when page1 has finished, to tell the main_container to close page1. Is this how you dispatch an event from page1 to the main_container? parent.dispatchEvent(new Event("pageFinish", true)); Then how do you catch the...

Reducing SWF File Size

I have a project with only a couple of graphics and lots of ActionScript 3. Anyone have any tips on reducing SWF file size? ...

AS3 XML and Line Spacing Problem

Background: I'm building this photo gallery in AS3, when user clicks a thumbnail is displays text gathered from an XML file. Problem Description: Everything runs wonderful on my local machine, but when I upload the files to the server and preview the site from the server, the line spacing on the description text is way different than wh...

Canvas, scrolling and special use case in Flex

Hello guys, I have a canvas of variable width and height with a maximum being 2K*2K This canvas current height and width vary depending on the user screen size. Usualy smaller than 2K*2K. If the user moves an element (free moving elements like child UIcontainer) inside the canvas at position greater than the current user available H a...

How to flip flash.media.Video?

I'm playing with the flash.media.Video and the Camera with Actionscript, and it bugs me that the video cam is showing a flipped video. Let me describe with an example: When I turn to my right, the video will show me turning to my left. If I held up a peace finger sign on my right hand, it appear as if I am doing it with my left. So, ho...

How to make black and white flash.media.Video?

I'm playing around with the flash Video cam and I'm a real puppy-dog-level newbie with Actionscript, flash and the video stuff. How do I make the video showing in black and white? I would like to say make a "black and White" feature of the video. Do I have to mess with filters? ...