actionscript-3

AS3 keyboard events within a class?

I seem to have trouble getting a keyboard event within a class to work, I have an ENTER_FRAME event which works fine, but the keyboard event never gets called. Any ideas? here's the code package { import flash.display.MovieClip; import flash.display.Stage; import flash.events.*; public class mainGame extends MovieClip { var myPlayer:...

Global variable problem

I load an image and add it to the MC someMC. If "something" is true, the someVariable gets the someMC scaleX number. Let's say its 0.82. What I need is to get that number into the s.value in my Slider object. Since I want the Slider value to be where my image scale is. This of course doesn't work because of variable scope limitations. ...

How to hack private static field in Flex?

Is there a way to change private static field of an alien class? For example: package mx.managers { public class TooltipManager ... { private static var _impl:IToolTipManager2; // <- assign my own value here ... } } In Java it is possible to do it using Reflection API. What about Flex? ...

AS3: Increase Child Index by 1

How would I increase the child index of a movie clip by 1? ...

External HTML file into Dynamic Text Field in Flash/AS3

Hi there, I've looked through the forums, and couldn't find the answer to my question outright, so I figured I'd just ask it. Apologies if this question has been asked already. I'm trying to load an external html file into a dynamic text field. The dynamic text field has html display enabled. The html file contains a list of links in ...

flex context menu clipboard item clear

Hi, I am using context menu using the code given below in a flex air application. For me all Context Menu Clipboard Items are working fine except "clear". Plese suggest me where I am wrong. var cMenu:ContextMenu = createContextMenu(); private function createContextMenu():ContextMenu { var editContextMenu:ContextM...

What is the best way to resize a BitmapData object?

Say I have a BitmapData of 600x600 and I want to scale it down to 100x100. ...

Checkbox label disable

I created a samble checkbox: <mx:CheckBox label="checkbox"/> Is there any way to disable checkbox state changing when clicking on it's label? Checkbox should change is's state only when i click [V] but do not change state when i click it's label ...

Why is JPGEncoded bytearray sent from AS3 to AMFPHP resulting in an invalid image?

Hi, Im loading images into Flash and using JPGEncoder to encode the image to a ByteArray and send this to AMF PHP which writes out the bytearray to a file. This all appears to work correctly and I can download the resulting file in Photoshop CS4 absolutely fine. When i try to open it from the desktop or open it back in Flash it doesnt w...

Cheapest Way To Export/Import Array Contents To File - AS3/AIR

I'm working on a basic editor application. It uses an array of varying size that I want to store to disk. This will eventually be in an AIR application, but for now it's just an AS3 project in Flex. I want to store the array in a file. The application edits the data, so it doesn't need to be human readable. I want it to be in whatever ...

Flex 3: Dynamic creation and binding of textinput

Does anyone have any examples on how to create a dynamic number of TextInput boxes and have each of the text being typed in these boxes be bound to a label? For example, say I have an XML file that specifies that I want 3 TextInput boxes. Flex should then take this data, create the TextInput boxes, create bindable variables for each Text...

ActionScript 3 multiple instance, same name, question

Hello, I'm trying to create a grid where the users can 'draw' across it and change the colors of the grid squares to a chosen color. In this code, I'm creating the grid with squares. I've got the functionality 'working', but it's only working on the last square instanced. How do I get it to work on all the squares, not just the last on...

ActionScript Project to AIR Application?

I'm not using the Flex libraries or anything from Flash. I'm developing a pure AS3 project in Flexbuilder which I would like to deploy as an AIR application. What are my options? What's easiest? I'm having trouble finding a straight answer here. ...

Flex 3 TileList Drag/Drop/Re-order Exception. How do I rearrange tiles?

Hi all. I’m in need of some dire help here. I'm writing an application in Flex 3 that utilizes a TileList with a custom itemRenderer to display info from a service. Unfortunately, I'm running into an exception with the drag/drop/rearrange portion of the TileList. With dragEnabled and dragMoveEnabled, I receive a fully-reproducible ex...

How to go from xsd schema to Actionscript object (Flex) at runtime?

I have seen questions here asking about xsd->actionscript objects, but these seem to require xsd->java->actionscript and is all in source code. Our requirements are a bit different: receive an xsd during runtime that we have never seen before Create an instance object based on the xsd fill in the values of the instance (either from an ...

AS3 anti bot form script?

I wrote a AS3 script, basically the script just a form that allow user to enter their email address. After launch the site for couple of months, I found I receive a lots of BOT spammers. I know, 1 way of prevent BOT is using recaptcha thing, beside recaptcha, is there any way to prevent bot to submit my AS3 form?? ...

Adobe Flex pdf functionality

I have a task of getting the snapshot of Adobe Flex application (imagine graphs, charts and tables) and produce the PDF file of it from inside of that same Flex application. Imagine having a button that would do the screenshot and dump it into PDF file. Does anybody know the framework and/or component that would have such functionalit...

What is the best way to share assets - icons/images - across multiple Flex applications?

I am in the process of creating a new - "lite" - version of a Flex application I created a while ago. I have been porting over many of the Classes and Components to a Flex Library Project that compiles an SWC file. Because both are Cairngorm applications, I'm not able to completely eradicate duplicate code, but it seems logical that I sh...

AS3 ... (rest) parameter

Hello, I've tested the following code: function aa(...aArgs):void { trace("aa:", aArgs.length); bb(aArgs); } function bb(...bArgs):void { trace("bb:", bArgs.length); } aa(); //calling aa without any arguments. The output is: aa: 0 //this is expected. bb: 1 //this is not! When I pass empty arguments (aArgs) to bb functi...

AS3 arguments

Why do you think the code below does not work? What would you change/add to make it work? Any help is appreciated.. function TraceIt(message:String, num:int) { trace(message, num); } function aa(f:Function, ...args):void { bb(f, args); } aa(TraceIt, "test", 1); var func:Function = null; var argum:Array = null; function bb(...