I am having trouble drawing a very short line with actionscript3:
var cSp:Sprite = new Sprite();
var cGx:Graphics = cSp.graphics;
cGx.lineStyle( 1, 0xFF0000, 1, false, LineScaleMode.NONE, null, null, 1 );
cGx.moveTo( 2, 10 );
cGx.lineTo( 3, 10 );
This creates two vertically stacked pixels which are not quite red (#7f0000)!
(here...
I would like to know the iteration order for the Array, Dictionary and Object types in AS3, for both the for-each and the for-in loops. Also what factors can change the iteration order of these loop type combinations?
For example I presume that using a for-each on an Array type always move from the first element to the last. For-each ca...
I cannot find any way to clear a DateField control programmatically after either a user has selected a date, or after I set myDateField.selectedDate via code.
Documentation only states how to clear it if a user selects the date again.
But doing myDateField.selectedDate = myDateField.selectedDate doesn't work
I have tried all the obvio...
What is the best practice/coding standard with regard to the "this" scope is AS3? Is there one? I feel it really helps with standardization and my readability, but sometimes it seems like "too much".
For instance, is the use of "this" in the following really necessary (I know it works without "this")?:
private var _item:Object;
privat...
I'm trying to add a RasterImage component to a Surface at runtime. My code runs as follows:
var ri:RasterImage = new RasterImage();
ri.loadingLocation = new LoadingLocation('http://resources.mydomain.com/','crossdomain.xml');
ri.source = 'http://resources. mydomain.com/some.jpg'
this.myGeometryGroup.geometryCollection.addItem(ri);
Bo...
Currently I'm writing an app. If I want to avoid Singletons, do I have to simply pass references of everything around?
For example,
I have a "main" class.
Class: Main
+---- Screen
+---- Camera
+---- Terrain
+---- Vehicle
+---- PhysicsWorld
It contains my Camera, Terrain, and Vehicle,etc classes. Now, I have issues when I'm creating...
I've just switched from Windows to Mac and need to find a few tools to replace those that were Windows-only. I'm most familiar with FlashDevelop, which I've used for years, but it is Windows only. SEPY seems to have been abandoned, FlashIDE's editor seems weak, and I don't want to purchase FDT or FlexBuilder right now.
I would like an...
I have a flex TileList to which I load a bunch of images.
When the tile list is scrolled up and down, it does fresh requests for all the images even though they were loaded previously.
Is there a way to stop this behavior and let the TileList control keep its previously loaded images?
Thanks in advance!
...
In ActionScript 3.0, I want to extends ClassA and implements InterfaceB. The problem comes when there is a 'data' property in both ClassA and Interface B, but of different type. I wrote,
public class MyClass extends ClassA implements InterfaceB {
private var _data:Object;
public function get data():Object {
return _data...
Hello,
I have the coordinates of the top left Point of a rectangle as well as its width, height and rotation from 0 to 180 and -0 to -180.
I am trying to get the bounding coordinates of the actual box around the rectangle.
What is a simple way of calculating the coordinates of the bounding box
- min y, max y, min x, max x ?
The A p...
Hi, I'm getting up to speed with Flex and I am looking for any example of implementing a drag and drop re-sort within a vbox container. Basically I have a Vbox that contains a number of canvas's that are full width and 35px high. I want to be able to drag and drop them to re-order within the vbox.
Any help is greatly appreciated - thank...
I can't help think that making XML ad XMLList both unrelated, as in both extend Object directly, is a design flaw in the AS3 core library. Surely having XML extend XMLList would be a much cleaner system, where XML is considered an XMLList with only one member?
This would also avoid the very annoying practice of an E4X query possibly re...
I've got a movie clip on the stage that's rotated 10°, with a dynamic text box inside. I'm loading some text, with an embedded image into it thus:
(Using 1st frame AS3 for now, eventually this will go in a class.)
var txt:String = '<img src="foo.gif" id="myImg1" /><p>Lorem ipsum</p>';
my_mc.txtBox.htmlText = txt;
Which works fine. T...
I was able to smooth the loaded, rotated images in my textbox as discussed in this question. That solution requires that I know the id of the images that are coming in. Is there a way to generalize and get a list of all the images coming in?
...
I have a Flash application that have to detect the mouse wheel event (MouseEvent.MOUSE_WHEEL), I've tested on a stand alone flash player and works perfect, but when i put the swf in a web browser, the mouse wheel stop working.
I've tested this in: Internet Explorer 7.0, Mozilla Firefox 3, Safari 3 and Google Chrome; and this behavior ha...
In a previous application that I had written, I had a Class that extended AdvancedDataGrid (ADG). It contained the following code:
package
{
public class CustomADG extends AdvancedDataGrid
{
....
// This function serves as the result handler for a webservice call that retrieves XML data.
private function...
I have this code that is supposed to take an array with some words, and apply the tweens to them, one by one, with a specified timeout. I think I have to make an empty movieclip out of them and then animate them with a foreach loop with a timeout, but I'm lost in how I would do that exactly.
This is where I'm at:
var array:Array = new ...
Hi
In my Flex application, I use a FileReferenceList that the user can populate with multiple files using fileList.browse() before upload.
I check each file's size and use fileList[i].upload() to upload to my server, this works fine.
I have a suspicion that this is not possible, but before upload I would like to convert each FileRefer...
I was curious of just how much stress AS3 Regular Expression testing can impose on the end-user's pc. Is this something that should be used in moderation, or can most computers handle the exhaustive use of it?
...
I am trying to make a transitionmanager and I wish to pass a method into a method, because I would like to make a bunch of different seperate transition methods which I fetch as a public static function from a Transitions class.
Example
in TransitionController class:
public function doTransition(mc:MovieClip, transition:Function = Tra...