actionscript-3

Using amfphp with Flash CS3 and AS2

All, I've starting experimenting with amfphp. I've gone through a few great tutorials (particularly those by Lee Brimlow at gotoandlearn.com). As long as you're using AS3, it works great, since AS3 includes the built-in NetConnection class. However, I'm looking to use amfphp on a bunch of existing AS2 projects. The problem is that AS...

AS3 FLVPLaybackCaptioning Component Displaying Images?

I am using the FLVPlaybackCaptioning Component to display captions for a video. We've built a player that uses a FLV file hosted locally or streamed from the server to show captions for a video, a slide title, and slide text. The example is up here: http://www.brainline.org/multimedia/webreadyplayer I want to display images using the ...

Flex: Is there any way to find find out when a ComboBox is open?

I may be missing something here because I thought this might be really easy but... Using Flex, how can you tell when a ComboBox is open? I do find the open and close events that this component dispatches can be flaky so I'm looking for something a little more solid - it's probably staring me in the face. ...

flexunit addAsync chaining

For some reason, addAsync chaining in a flexunit test as described in this article utterly fails to work when I try to do it. public function testWhatever():void { var cont:EventDispatcher = new EventDispatcher(); cont.addEventListener("continue", addAsync(verifyFirst, 1000)); cont.dispatchEvent(new Event("continue")); } pr...

retaining list selectedIndex between data binding reloads in Flex

In my Flex interface, I've got a few List components that are data bound to ArrayCollections. I'm finding that when the ArrayCollections are updated (by Web services) and the data bindings for the Lists update, each List is reset and its selectedIndex is dropped. This is a problem if a user is in the middle of a task and has already sele...

Most complex WMS mapserver?

i'm building a client-side WMS parser (flex/ActionScript 3) & i'd like to test against as complex a WMS mapserver as i can find. can anyone point me to some sites? thanks. ...

Passing flashvars-style parameters to a loaded SWF

I have a Flex 3 app (player v9) which loads a Flash SWF (AS3, also player v9) and needs to dynamically pass it a collection of parameters which are known at run-time. These are parameters that are normally passed via the flashvars element in an HTML page. The embedded movie accesses these parameters via the loaderInfo.parameters object. ...

Finding the center of mass on a 2D bitmap

I'm coding a game, and I'd like to be able to find the center of mass of an arbitrary shape on a black and white bitmap such as this: 012345678 0.XX...... 1..XXX.... 2...XXX... 3..XXXXXXX 4...XXX... All "cells" have the same weight. Diagonally adjacent cells are not considered to be connected, and the shape will always be a single o...

Send data to a Flex 3 application from an SWF (version 7).

Does anyone know how to take a swf (version 7) and use the SwfLoader or something similar to access a root variable in the swf from a Flex application? I have tried many things with no success. I don't want to clutter this post with all of my failed attempts, but I will post them later if I see that they are needed as examples. Just so...

Setting instance names on keyframes quickly in AS3

Right now in Flash CS3 and up (using Actionscript 3) if you have the same instance that is used in multiple keyframes in a layer, and you decide to assign or change the instance name later, you would have to go to each keyframe and set the instance name. This is a big nuisance. Is there a quicker or better way to do this? NOTE: In AS2...

How to emulate keyword arguments in ActionScript 3 functions

Functions in Python can be called using keyword arguments of the form keyword = value. For instance, the following function: def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'): print "-- This parrot wouldn't", action, print "if you put", voltage, "volts through it." print "-- Lovely plumage, the", typ...

Flex/Accordion: Conditionally hide a child

How do I hide a child in a accordion? Using visible doesn't seem to work and enabled isn't what I'm after. <mx:Accordion> <mx:VBox width="100%" height="100%" label="Foo" id="viewOverview" visible="false"> ... </mx:VBox> ... </mx:Accordion> ...

Flash communication with Erlang server

This is an erlang problem, it seems. I have this code to test the client sending data, written in Actionscript 3: var socket:Socket=new Socket("localhost", 2345); socket.addEventListener(Event.CONNECT, connected); private function connected(event:Event):void { socket.writeInt(12); //packet length, should be correct? 4 bytes each? ...

Lint tool for actionscript?

Are there any lint tools available for actionscript? One source would be ideal, but anything is welcome. My team is starting to adopt more a more rigorous style guide (where "more rigorous" means "existant"), and I think a linter would help us all adhere more easily to the style rules we've agreed on. I'm not above writing my own, but...

Flex: Updating a Tree control

I've a tree control with checkboxes that uses the control from http://www.sephiroth.it/file_detail.php?id=151# Somehow I can't get the control to update when I change the dataProvider (i.e. by clicking a checkbox) the only way I can get it to update is to use the scrollbar. How do I force the update? I've tried all possible methods I ca...

Actionscript: how can I determine the type of some loaded content?

I have a situation where I'm loading some content using a URLLoader but the content could either be a video (flv or swf) an image(jpg or png or gif) or a swf. The trick is, I need to react in different ways based on the type of content that's loaded without necessarily knowing what type of content it is beforehand. I currently have con...

How do I get the alias string of a class in AS3?

var alias:String = 'models.User'; registerClassAlias(alias, models.User); // If I have the alias, then // I can get the class like this: var klass:Class = flash.net.getClassByAlias(alias); // How do I do the reverse // (get the alias from the class)? // // I want to do this, but I can't find a // 'getAliasByClass' function. alias = ge...

Load images in the background using Flex

Hey guys, In my Flex application I call a web service that returns a few dozen "items" where each item has an associated image url. I create a model based on this data and bind the image components source property to the url string. I'd like to have more control over the loading of these images, particularly the order in which they are...

How to get Flex to see a .NET Webservice session when I use the proxy auto-generation?

So I have a Stateful .NET webservice (C#) that I would like Flex to use. The only problem is that I don't see a cookie being passed, even though I have the WebMethods decorated with: WebMethod(EnableSession=true) I can't seem to figure out if it is an issue with Flex or .NET. Does Flex 3 (as3) pay attention to the session cookie aut...

How to fix closure problem in ActionScript 3 (AS3)

Hello, In the code below I'm trying to load some images and put them in the stage as soon as they get individually loaded. But it is bugged since only the last image is displayed. I suspect it's a closure problem. How can I fix it? Isn't the behaviour of closures in AS3 the same as in Java Script ? var imageList:Array = new Array(); im...