Questions tagged [actionscript-3]

ActionScript 3 (AS3) is the open source object oriented programming (OOP) language of the Adobe Flash and AIR Platforms. AS3 is widely used for RIAs, mobile apps, and desktop applications. (ActionScript 3 is a dialect of ECMAScript.)

ActionScript 3 (AS3), developed by Adobe, is an open source, object-oriented programming (OOP) language. It is a dialect of ECMAScript.

AS3 can be used to create web programs deployed using Flash Player, applications for iOS, Android, Blackberry (PlayBook OS and BlackBerry 10), and desktop using Adobe AIR, as well as TV applications using Adobe AIR for TV.

ActionScript is an object-oriented language originally developed by Macromedia Inc. (now owned by Adobe Systems). It is a dialect of ECMAScript (meaning it is a superset of the syntax and semantics of the language more widely known as JavaScript), and is used primarily for the development of websites and software targeting the Adobe Flash Player platform, used on Web pages in the form of embedded SWF files. The language itself is open-source in that its specification is offered free of charge and both an open source compiler (as part of Apache Flex) and open source virtual machine (Mozilla Tamarin) are available.

References:

Books:

Useful Links:

41246 questions
30
votes
3 answers

Get size of ActionScript 3 Dictionary

var d:Dictionary = new Dictionary(); d["a"] = "b"; d["b"] = "z"; How to get the length/size of the dictionary (which is 2) ?
Bart van Heukelom
  • 43,244
  • 59
  • 186
  • 301
28
votes
2 answers

AS3 - for (... in ...) vs for each (... in ...)

The following code does the exact same thing. Is there a difference between for each and for (... in ...)? var bar:Array = new Array(1,2,3); for (var foo in bar){ trace(foo); } for each (var foo2 in bar){ trace(foo2); }
apscience
  • 7,033
  • 11
  • 55
  • 89
28
votes
4 answers

Test if an object is defined in ActionScript

In ActionScript, how can you test if an object is defined, that is, not null?
Matthew Shanley
  • 1,091
  • 2
  • 11
  • 14
28
votes
5 answers

How do I test if a property exists on a object before reading its value?

I'm attempting to read a property on a series of Sprites. This property may or may not be present on these objects, and may not even be declared, worse than being null. My code is: if (child["readable"] == true){ // this Sprite is activated for…
Robin Rodricks
  • 110,798
  • 141
  • 398
  • 607
28
votes
4 answers

Conditional compilation "else"

In AS3 you can pass a constant to the compiler -define+=CONFIG::DEBUG,true And use it for conditional compilation like so: CONFIG::DEBUG { trace("This only gets compiled when debug is true."); } I'm looking for something like #ifndef so I can…
takteek
  • 7,020
  • 2
  • 39
  • 70
28
votes
2 answers

How do you get exactly 50% odds?

Which of these will give an exactly 50% chance when a random value is a float between 0 and 1 (such as AS3's or JavaScript's Math.random())? I have seen both of them used in practice: if (Math.random() > 0.5) ... if (Math.random() >= 0.5) ... Heads…
IQAndreas
  • 8,060
  • 8
  • 39
  • 74
28
votes
6 answers

How do I create a custom event class in Javascript?

How do I create a custom event class similar to ActionScript? What I mean by that is a class that I can use to fire off my own events, send the necessary data. I don't want to use third-party libraries like YUI or jQuery to do it. My goal is to be…
28
votes
12 answers

Getting unix timestamp in milliseconds in PHP5 and Actionscript3

In Actionscript, the Unix timestamp in milliseconds is obtainable like this: public static function getTimeStamp():uint { var now:Date = new Date(); return now.getTime(); } The doc clearly states the…
Tom
  • 8,536
  • 31
  • 133
  • 232
27
votes
7 answers

Smartcard reader access from a web browser?

Is it possible to access a smartcard reader connected to a computer from a web browser running on the same machine, i.e. from an ActionScript, JavaScript or whatsoever script running therein? For example, I read something about the…
jlnme
  • 321
  • 1
  • 3
  • 4
27
votes
11 answers

Best Tools for Debugging Flash ActionScript 3 (AS3)

Does anyone want to share the best debugging tools they have found for Actionscript 3 (AS3) and Flash CS5? I've just done a search and found a few, but would love to hear from people who've actually used any of them. (In order of 'most…
Simon East
  • 55,742
  • 17
  • 139
  • 133
27
votes
6 answers
26
votes
2 answers

ActionScript-3 cannot have multiple constructors?

I have public function Shard() { } public function Shard(x:Number, y:Number, vx:Number, vy:Number, rotation:Number, spin:Number) { ... } And I got on the second constructor: Multiple constructor definitions found.…
The Student
  • 27,520
  • 68
  • 161
  • 264
26
votes
12 answers

Scroll to selected item in Flex 4 Spark List component

I'm setting selected element in s:List component with Actionscript, it works, but List doesn't scroll to selected item -- need to scroll with scrollbar or mouse. Is it possible to auto-scroll to selected item ? Thanks !
Rodion Bykov
  • 614
  • 1
  • 7
  • 14
26
votes
5 answers

Actionscript 3 vs Haxe: Which to chose for new Flash project?

I am in the planning stages of a new Flash game project and was wondering which language would be better to use? I already have a strong understanding of Actionscript 3, and have not worked with Haxe yet, but I have read the language reference docs…
Jason Miesionczek
  • 14,268
  • 17
  • 76
  • 108
25
votes
4 answers

How to fix closure problem in ActionScript 3 (AS3)

In the code below I'm trying to load some images and put them in the stage as soon as they get individually loaded. But it is bugged since only the last image is displayed. I suspect it's a closure problem. How can I fix it? Isn't the behaviour of…
lbrandao
  • 4,144
  • 4
  • 35
  • 43