actionscript-3

Passing along information on a FileReference Complete event.

I need to pass along a string with my FileReference, or provide that string as an argument when an event fires. To be clear, it really annoys me that AS3 doesn't allow you to pass parameters on events. Right now, I've extended the FileReference class to include an additional variable. I'm trying to get this to compile, but it won't comp...

In ActionScript 3, how can I pass the current value of an array in a loop to an event listener

Code Example: var gospels : Array = ["john", "mark", "matthew", "paul"]; for each (var book : String in gospels) { var loader : URLLoader = new URLLoader(); loader.load(new URLRequest("http://example.com/" + name)); trace(book) // outputs current value of array loader.addEventListener(Event.COMPLETE, function(e : Event) : voi...

Using JSFL, pulling items out of a library using libraryPath

I'm making a SWF panel to automate some file setup. I'm using the libraryPath JSFL command to point to some external libraries. How do I put an item from one of those external libraries onto the stage using JSFL? I've tried: fl.getDocumentDOM().library.addItemToDocument({x:0, y:0}, 'myItem'); ...

Dynamic Image resizing

In my flex app there's an item renderer for a TileList that I am using. I load the image into the Item Renderer at runtime. I am using the following code to resize the image width and height. But it doesn't seem to be working. I debugged the flex app and find that the actual width and height values are getting assigned. But the image n...

Flex: Is it guaranteed that code is excluded from compiled build when not reachable?

Suppose you have private static const INCLUDE_MY_DEBUG_CODE:Boolean = false; public function runMyDebugCode():void { if ( INCLUDE_MY_DEBUG_CODE ) { callADebugFunction(); } } private function callADebugFunction():void { ... } Given there is no other reference to callADebugFunction, will it be guaranteed that c...

When to render Legend in Flex

My Flex chart has code that creates a legend from each data series. Currently, I have the drawLegend function execute when a button is clicked. I am trying to get the legend to draw automatically but I am having trouble determining when to call the drawLegend function. Users click on an 'Update' button which retrieves data. I want the l...

Key press issue in ActionScript 3

I'm creating a DDR-like game for an assignment and my keyboard seems to respond and trace it, but only if I press on the screen with the mouse first. How can I get rid of that and just have it respond right away? right_mc is the arrow that's moving ArrowRight_mc is the arrow at the top perfect_mc should pop up briefly and so should a...

Compiling a Flex Library with a source attachment using compc or FlashBuilder

I am trying to compile a Library SWC using FlashBuilder while retaining the references to the source code so that asdocs will still appear and the debugger will show source code when there is a problem. The results I want are similar to what you get when you set a "source-attachment" in the "ActionScript Build Path" settings panel. (see ...

Generating correlated numbers

Here is a fun one: I need to generate random x/y pairs that are correlated at a given value of Pearson product moment correlation coefficient, or Pearson r. You can imagine this as two arrays, array X and array Y, where the values of array X and array Y must be re-generated, re-ordered or transformed until they are correlated with each...

Branching code for different platforms in SVN

Note: my code is written in flash but this is a SVN-related issue and is not a flash-specific. I have a code library targeted at Flash Player 9 stored in an SVN repository. I want to create a modified version of the code targeted at Flash Player 10. What are the best practices for maintaining both versions of the code? Should I create ...

Add/Tween/Remove - Multiple instances of the same MC (Tweenlite)

I'm trying to create a simple loop that adds a random number of stars, fades them out and removes them. The script I've come up with does everything but remove them, and perhaps I need a less on adding children to a stage. Here's what I come up with import flash.display.*; import com.greensock.*; import com.greensock.easing.*; // tim...

scrollbar in flash CS4

I am trying to put a vertical scrollbar onto a dynamic TextField in Flash CS4. When I do this in Scene 1, everything works just fine. However, if I move the TextField+Scrollbar to Scene 2, it breaks. The errors I get when I run the code indicate that Flash is loading the scrollbar right away and then trying to find the associated TextFie...

How to stretch out the movie clip after applying some Pixel Bender filter? (Flash)

How to stretch out the movie clip to twice its width and height after applying some Pixel Bender filter? I have some object with video on it (for ex 512 by 512) I apply a Pixel Bender Filter on it. Now I want to stretch the result (for ex to 1024 by 1024). How to stretch it? So my point is 1) Render the result of effect 2) Stretc...

basic as3 json question

i'm trying to parse json in as3 that has multiple arrays like this: { "a1": [ { "a": 1, "b": "2", "c": 3 }, { "a": 1, "b": "2", "c": 3 } ], "a2": [ { "a": 1, "b": "2", "...

How to use flex tilelist data effects combined with a ListCollectionView dataprovider

I am using a TileList control with an effect sequence linked to the itemsChangeEffect property. <mx:TileList itemsChangeEffect="{dataChangeEffectSequence}" ...> </mx:TileList > <mx:Sequence id="dataChangeEffectSequence"> <mx:Blur blurYTo="12" blurXTo="12" duration="250" perElementOffset="150" filt...

How to write trace output to a text file without a web server in AS3

I have an application that writes traces with a timestamp when certain items are clicked or accessed. I need to write these to a text log file so that they can be accessed remotely.. The device the app runs on doesn't have a web server and doesn't run the flash debug player, os is xp. How can I send these traces to a text file? I noticed...

Has anyone played with PushButtonEngine?

http://pushbuttonengine.com/ I'd like to know if anyone has experienced any major (particularly performance) issues with the engine. Any heavyweight features we should stay away from? Thanks. ...

Adobe Flex mx:TileList scrolling issue applying filters to DataProvider

After scrolling down a TileList if I apply a filter to the DataProvider (ArrayCollection), the TileList UI object doesn't re-position correctly. It let the user in the bottom of the list that looks like empty but it isn't, simple the existing records are above the scrolling position. I solved the issue calling method scrollToIndex(0) of ...

Flex RemoteObject + Zend AMF Server problem

Hello! I am working with php, Flex and zend's AMF Server using this guide. I successfully managed to connect php with Flex but after 'reconstruction' of my MySQL query I get a little bit different objects - some of their values are NULL. That confuses Flex and I get an error from my RemoteObject: Was expecting mx.messaging.messages.Ackno...

AS3 Camera selection

Has anyone build a AS3 Camera-Select-algorithm, ready to use? With MacBooks you have the problem that the build-in webcam is not rightly choosen from the webplayer. You have to select the USP-Cam by youself from the list DV Video IIDC FireWire Video USB Video Class Video by camera = Camera.getCamera("2"); THNX! ...