actionscript-3

Arrange (z) order of objects in Flash with ActionScript 3?

Is it possible to arrange (z) order of objects in Flash with ActionScript 3? e.g. I have 3 symbol instances on a given layer, and I want to perform the equivalent of 'Bring to Front', 'Bring Forward', and/or target a certain z position. ...

Change order of layers in Flash MovieClip with ActionScript?

Is it possible to change the order of layers in a Flash MovieClip timeline using ActionScript 3? ...

Parsing json as3

Hi, I have been trying and searching with no success.I waned to parse the following json string : {"label":"My ncWMS server","children":[{"label":"champ","children": [{"id":"champ/XE","label":"sea_surface_height_above_geoid"},{"id":"champ/U","label":"barotropic_eastward_sea_water_velocity"},{"id":"champ/V","label":"barotropic_northward...

Data grid crashes with data provider change

I have a radio button group within a data grid, whenever I attempt to change the selected radio button the web page crashes. Below is how I put together the radio button in the data grid. Anyone see what could be the cause of the issue? MXML <mx:Accordion> <fx:Declarations> <s:RadioButtonGroup id="cover"/> </fx:Declarations> <fx:Scrip...

How to capture Alert Dialog Box Selection?

Within an event handler I have an Alert.show(...) that prompts a user for confirmation. How can I capture the selection of the alert prompt and use it within the event handler. For example: private function mainEvtHandler(event:DynamicEvent):void { var alert:Alert = Alert.show("Are you sure?", "Confirmation", Alert.YES|Alert.NO, this, ...

How to set link colors in a RichEditableText component

I've got some text that includes links that I display in a RichEditableText component. How do I change the color of the links from the default blue? I tried the example posted by Peter deHaan but it doesn't work with SDK 4.1. I found a way to do this in MXML, but the text needs to be localizable which means I load it at runtime based o...

Detect Line Break in AS3 Input TextField

Hi all, I want to be able to write a paragraph in a textfield, and then click and hold, or do some similar gesture, and have the entire paragraph selected. I'm then going to drag it (using bitmapdata or whatever) to another textfield. In order to do this, I need to be able to detect where a given paragraph ends. So I'm trying to do tha...

Runtime introspection of linked SWC using ActionScript 3.0 + Flash/Flex

Wow, my first post on Stack Overflow. Have I "arrived"? Okay, this is an oddball. I'm trying to determine whether there might be some programmatic way to introspect the classes within a linked SWC at runtime. To give a little more background (maybe there's a completely different way to go about doing this), I'm considering a general fr...

flash as3 string encode decode

I want to encode / decode a string in AS3: var string:String = "This is an text"; encode(string) will give for example: "yuioUasUenUwdfr" decode(encoded(string)) will give: "This is an text"; It does not have to be secure or anything. Thnx! ...

Adobe Air 2.0 custom class problem

I'm trying to build an air 2 application with cs5 and as3. When I try to do "private var customClass : CustomClass;" inside the class definition of the document class of my fla the constructor of the document class is never called and I don't get any errors or warnings. If I comment out the private var it complies and the trace statement...

Nullify object passed to a function

I have the following problem with objects in actionscript3: var o:Object = new Object(); destroyObject(o); trace(o); // [object Object] function destroyObject(obj:Object):void{ obj = null; trace(obj); // null } Since objects are passed by reference in AS3 I assume that the previous code would change o to null, but it doesn't. ...

How to implement an Object Pool for Flex Data/Item Renderers

You can hook into the creation of Flex 4 item renderers easily enough (through itemRenderer, or itemRendererFunction) allowing you to pull renderers from a custom object pool, but how would you put those renderers back into the pool? I understand that layout virtualization does a form of object pooling, but I'd like a way to hook in to ...

Converting Actionscript syntax to Objective C

I have a game I wrote in Actionscript 3 I'm looking to port to iOS. The game has about 9k LOC spread across 150 classes, most of the classes are for data models, state handling and level generation all of which should be easy to port. However, the thought of rejiggering the syntax by hand across all these files is none too appealing. A...

How can I list all the const properties defined in a class

How can i list all the names (and values) of public (and private / protected) const defined in a class ? public class Layers { public const BACKGROUND:String = "background"; public const PARENT:String = "parent"; public const MAP:String = "map"; public const LINES:String = "lines"; public const POINTS:String = "poin...

References classes?

what's the correct way to reference a class, in this case from the same package. the code below shows class "Two" attempting to trace the value of a variable in class "One". no success. trace returns undefined. //Class One package { import flash.display.Sprite; public class One extends Sprite { public var myString:String =...

Show hide multiple datagrid columns in flex

I have a scenario in which i want to show hide multiple datagrid columns at the same time based on a user selection. I can write a click handler for the button and hide all columns one by one but I don't want to do that instead I want to group certain columns and in my click handler want to be able to hide the complete group in one go. I...

[Flash] Sounds fade in/out with ActionScript 3

Hey guys, what's up? I am trying to make a fade in/out in a music in a Flash (CS5) project. I imported the sound to library, set a classname for "Export for ActionScript", and I was trying to fade with TweenLite/TweenMax, like this: var sound = new MySound(); sT = new SoundTransform(0.1); sound.play(0,99999, c_sndEnvironment); TweenLit...

Error #2032: Stream Error

We are facing this issue in our URL while accessing the Result from the server on the Flex Application on a WAS Machine. The behavior is a bit varied when we access it on IE6 and IE7(both IEs are having same flash Player version). IE6 doesn’t work at all but IE7 works for some conditions. On Windows machine it is working fine(in IE6 and...

How to use Pixel Bender within an FP9 wrapper file

Hi, We create Flash games which are embedded within third party wrapper SWF files, which are exported for FP9. If I create an FP10 SWF which uses Pixel Bender classes (Shader, ShaderData), when I run them in an FP9 wrapper within an FP10 player, an error is thrown VerifyError: Error #1014: Class flash.display::Shader could not be foun...

Making scroller of spark list visible by default

I have a spark.components.List component on which I would like the vertival scroll to be visible by default. Any ideas? ...