actionscript-3

FLEX Cairngorm commands... odd behaviour

while trying to solve my problems in serializing the execution of cairngorm commands, I tried to bypass completely the event dispatching and simply instantiated the command I wanted to execute, then called it's execute method. In this method there's a call to a delegate that calls ServiceUtils that performs the HTTPService.send thing... ...

AS3: Whats determines the order of: for..in

OK I am looping through the properties in an object like so: private var _propsList:Object = {'Type':'product_type' ,'Kind':'product_type_sub' ,'Stone':'primary_stone' ,'Stone Color':'primary_stone_sub' ,'Metal':'metal_type' ...

AS3 TextField - unwanted carriage return when setting value to ""

I have an input TextField and have a KeyboardEvent.KEY_DOWN even listener on the stage to listen for the Keyboard.ENTER event. The event listener adds the entered text to an array or whatever, and then clears the TextField. The problem is that when the Enter key event fires and the TextField value is set to "", it leaves a carriage ret...

Why am I getting this error? Error #1006: draw is not a function.

I have 2 classes with a draw function in them, my Background class and VideoDisplay class. I'm not done with the VideoDisplay class, but I put simple traces in it to test. I call both the Background and VideoDisplay the same way in my document class, but when I try to call the draw function of the VideoDisplay class I get this error: Er...

Approaches / libraries for resize dragging

I'm currently working on a WYSISYG editor that allows the user to move, resize and rotate shapes by directly manipulating them. The resizing seems to be fairly complex when the shape is rotated. I got this working for non-rotated shapes, but it will take some trigonometric calculations to resize shapes that are rotated. The registration ...

How can I play a library item with four keyframes as a single animation?

I'm using AS3, and have one simple layer with 4 keyframes If I import it to another fla file as a library item, it keeps showing me all keyframes, I don't want that I want it to show me the whole animation. Like, if I have an animation of me swinging a baseball bat, I don't want to see all the keyframes seperately imported into the libr...

Storing Factory Pattern Products

Right now, I've got a switch statement which is being used to create objects based on a string. There are three types of objects which extend an abstract generic object. I should really be using a factory pattern, which I'm figuring out right now. My issue is thus: I appreciate the flexibility of the factory pattern, but right now I'm st...

getting the name of a class through an instance of that class

I have a function that takes as parameters 2 instances of a (custom) class. But they can each be one of several classes, and I need to then call another function based on what type they are. I'd like to do something like this: function any_any(inst1, inst2) { this[inst1.classname + "_" + inst2.classname] (inst1, inst2); } function C...

What's the different between Value Object and a generic Class in AS3?

I don't understand what is structurally different between a Value Object and a Class in ActionScript3. Can any Class be a VO if you decide to call it one? Thanks. ...

Using Loader without creating a reference

Ive been using the loader a lot of upload images into my movieclip. But the only way I know how to do it is load the content, add an event listener, wait for it to finish finish the job in the handler using the reference to the loader like this. protected function loadImage(imageDir:String):void { loader:Loader = ne...

Parameter sourceBitmapData must be non-null.

I am trying to copy the pixels of a bitmap data. but I keep getting the following error Parameter sourceBitmapData must be non-null. it happens in the method drawImage. exact after my trace that says "got canvas data". canvasData.copyPixels(image,tileRect,tilePoint); Below is my code package com.objects { import flash.displ...

Styles that are not found in Flex documentation

Hello all, today I wanted to change the border color of TextInput when user has a focus on it. I could not find any style that would allow me to change that. A little bit of Google searching and I found answer to be themeColor. Why is it that there are some styles that work and which are not even mentioned in the Flex documentation? (...

Accessing root node of XML in Flex

I'm having trouble accessing the value of the root node of an XML variable in flex. For example: var X:XML= <Message Type="abc"> Content123 </Message> I can change the "Type" attribute above with X.@Type="xyz"; But how do I change "Content123" to something else? If the xml document were longer/deeper, I could say something ...

xml data in actionscript 3.0?

is the target.data, a default structure of whole xml? in as3, should the data of xml loaded through this data itself? function xmlDisplay(e:Event):void { xmlData = new XML(e.target.data); trace(xmlData); } ...

ArgumentError: Error #2015: Invalid BitmapData.

I am having problems loading a bitmapData. I am getting the following error Engine Init //trace loadimage//trace ArgumentError: Error #2015: Invalid BitmapData. at flash.display::BitmapData() Below is my code. it appears it happens after the trace loadimage package com.objects { import flash.display.Sprite; import flash...

Call AS3 MouseEvent function from JS

Is there any way to call MouseEvent function in as3 from JavaScript? I have HTML button and swf object, I need to sent a POST request from swf by clicking on HTML button. ...

Zend PHP Class Variable retention for mysql queries

I have a flash application which uses a single php file to retrieve records from a database (using the Zend framework). When the application first begins, I make a call to the php to set a class variable, so that all future requests to the database will use this variable to select records based on its value. So here is how the class begi...

When subclassing in AS3, is a new constructor function necessary?

Basic OOP question... I want to add a couple functions to the Array class so that my program will be amazing and make me rich and famous overnight. So I create a new subclass NewArray which extends Array. Do I need to write a constructor method for NewArray? If I leave it blank will it just use the parent's (Array's) constructor metho...

as3: Loading XML into a my class' property doesn't seem to do what I would expect...

This seems like it should be an easy one but I can't figure it out. I'm trying out a very simple class that, when created, loads and XML file into the class's property. I must be getting a basic concept tangled up here because I can see the XML coming in just fine in the handleComplete function, but the class property _result remains em...

Send ByteArray to JavaScript

How to send a jpg image as ByteArray from as3 to javescript? And how to convert ByteArray to image in javascript? ...