actionscript-3

What is the easiest way to find out when a Property of a built in type changes to a certain value?

I'm having an issue with Movieclips inside my Swf resizing to the wrong dimensions. I'm currently tracing the width of the offending clip every half second, and I can see the value change to an incorrect size at some interval in the logged output. I really want to see what code is changing the width. My plan was to extend Movieclip, over...

Ignoring case on E4X node names and attributes?

Does anyone know of a trick to ignore upper/lower/camelcase on XML node names and attributes? A quick example: I give an XML file to my client which contains an XML attribute named fooID but the client could change the XML, and - not being aware of upper/lowercaseness change or add an attribute under 'fooid'. Naturally my parser (in AS3...

Add setter in a prototype in Flex

In Flex, you can add functions to the prototype of a Class; but how do you add a setter? For example, with A some (non-dynamic) class, you can do this: var o:Object = new A(); A.prototype.myFunction = function():void{trace("foo");} o.foo(); And that will call the foo function. But how could you add a setter, so that setting the prope...

Flash/AS3 security - passing movieclip reference to child swf?

I'm seeing some strange behavior with respect to interactions between my preloader and main application classes (all AS3 / Flash CS4). Roughly speaking, here's the flow of events: Preloader.swf loads two things: main.swf, which is the main app, and assets for a custom object consisting of text and images, which are assembled into the ...

using setChildIndex();

If I use setChildIndex to change my movieclips index position on the stage. Can I only set it to a index that already been occupied. or can I make up an index of my own. like 100. Reason being is because I am trying to figure away to make movieclips always on top. What I had in mind besides setChildIndex is... if(eApi.getChildIndex(this...

Flex3: Load contents of an embedded text file into a variable

I have a block of html text which is displayed to the user in a TextArea. Currently, the I have embedded the HTML as an XML object within one of my classes, but this seems like a terrible design. I would like to put the HTML in an embedded file and load it into an XML or String object. I've tried to search for how to do this, but my s...

Flex binding in AS3 - Negate boolean value

I am binding a checkbox to a property on a control. Everything is fine, but I need to bind the checkbox to another property, and the value needs to be the opposite of chkbox.checked. BindingUtils.bindProperty(obj, "propertyBool", checkBox, "selected"); I need something like this... BindingUtils.bindProperty(obj, "propertyBool", chec...

Why am I getting this warning: 3594: parent is not a recognized method of the dynamic class XML?

It's coming from this line of code: var dropTargetXML:XML = XMLTemplate.template.component.section.question.(@question_questionID == nNode.parent().@question_questionID)[0]; nNode is an XML node sent as an argument to the function this is called in. The code runs, and does everything expected but the compiler sends out that warning. D...

Flash Restacking in Old Index Order With New Top.

My Brain Is Going to Explode.. . I have five images all named 0,1,2,3,4. I have five buttons, btn1, btn2, btn3, btn4, btn5. The buttons are laid out like: • • • • • when an image (lined to a button) is active it looks more like this if image 1 is active: • (•) • • • A timer is running, at the end of 240 seconds, the image on the b...

How does scaleX/scaleY work on Bitmap?

I'm using a Bitmap cache that stores down a few Bitmaps. I called scaleX/scaleY on some of them, but the next time I retrieve from the cache, the Bitmap is screwed up. How does scaleX/scaleY work with Bitmap? ...

Flash receive sockets

I was searching on google for it, I couldn't find it. I would like to know how can I listen to sockets using actionscript 3 ...

Flex bug trying to import actionscript files

The "import "Player.as" line throws the error: 1084: Syntax error: expecting rightbrace before semicolon. package { import "Player.as"; //ERROR import "Card.as"; public class Game { I was going great with Flex, until I tried to split up my code into separate files. Now I'm struggling. Here are my files and their dependencies:...

foregoing intialization on a page

Once you load an actionscript page from scratch (in my case loading XML data from a file, initializing various other elements in a fairly time consuming way) if you navigate away from that page and then return to it, (via the browser 'back' key for example) is their a way to forego the previous initialization and just immediately bring...

How to optimize modular flash apps (load time & flexibility)?

Hi all, I'm working on a large application that is broken up into many independent swfs. There is a master swf that loads a navigation shell and the foundational logic, and a module loading system that loads child swfs into the main display area. This is all working smoothly, and now I'm onto building the modules, and I'm starting to fe...

What's a fast, efficient way of looping 4 images being faded one after another?

I'm trying to figure out an easy way to fade 4 (or any number) images and loop it so the last image fades in with the first image. I threw something together which is pretty horrible, and doesn't even fade the last image into the first. The code is included below for you to laugh at. Any idea how I could improve this? function beginTwe...

Flex - Using the vanilla preloader to load additional assets?

I have a Flex application that automatically loads the SWF and it's contents and displays the default progress bar like in all Flex apps. Currently I have a class in the application using a Loader instance to load an external bitmap to be added to the stage/canvas. I'd like to handle the loading of this bitmap in the Flex default preload...

Flash Movieclips children Lost

Hi, I have a empty movieclip container in which I add movieclips as children. But when I try to get the children it does not trace/return anything. Here is my code. // Creating Container var competencyContainer:MovieClip = new MovieClip(); competencyContainer.name = "competencyContainer"; this.addChild(competencyContainer); var lastx:...

caret moves 2 positions in stead of 1

I have the strangest issue in Flex! Consider an <mx:TextInput /> with text. This textbox has focus and a nice little caret blinking inside. Now when you press the -> or <- button, the caret moves two positions instead of one! Also when you press the delete button, it removes two characters instead of one. This only occurs in Firefox, but...

Feature or bug? 3D perspective in Flash Player 10 changes as objects are added to the stage

In my AS3/Flash Player 10 app, I've got a movieclip on the stage with its own transform.perspectiveProjection properties configured; in particular, I'm explicitly setting its projectionCenter so that it has its own vanishing point (see this question for details). I'm adding functionality to my application so that if a user clicks one of...

Embedding FLV in PureMVC AS3 project

I need to embed an FLV in the SWF in order for it to work with the client's CMS. However, their existing video player uses netstream to control the video playback. Is there any way to use netstream to load an embedded FLV file? ...