actionscript-3

What are the key differences between JavaScript and ActionScript 3?

瘦欲@ 提交于 2019-12-17 09:21:05
问题 I know both languages are from the same ECMA-262 standard. It seems that the two are becoming very similar with JavaScript adding event listeners for core Object instances through methods like freeze and seal in EMCAScript-262 5th edition and such. I was wondering what the differences are? 回答1: First of all ActionScript 3 and JavaScript are both defined in ECMA-262 so they have a lot in common. Both languages feature prototype inheritance for instance. It is however not correct that

Asynchronous HTTP Client for Java

你。 提交于 2019-12-17 08:59:09
问题 As a relative newbie in the Java world, I am finding many things frustratingly obtuse to accomplish that are relatively trivial in many other frameworks. A primary example is a simple solution for asynchronous http requests. Seeing as one doesn't seem to already exist, what is the best approach? Creating my own threads using a blocking type lib like httpclient or the built-in java http stuff, or should I use the newer non-blocking io java stuff - it seems particularly complex for something

How to deal with Number precision in Actionscript?

柔情痞子 提交于 2019-12-17 06:36:16
问题 I have BigDecimal objects serialized with BlazeDS to Actionscript. Once they hit Actionscript as Number objects, they have values like: 140475.32 turns into 140475.31999999999998 How do I deal with this? The problem is that if I use a NumberFormatter with precision of 2, then the value is truncated to 140475.31 . Any ideas? 回答1: This is my generic solution for the problem (I have blogged about this here) : var toFixed:Function = function(number:Number, factor:int) { return Math.round(number *

How to deal with Number precision in Actionscript?

吃可爱长大的小学妹 提交于 2019-12-17 06:36:13
问题 I have BigDecimal objects serialized with BlazeDS to Actionscript. Once they hit Actionscript as Number objects, they have values like: 140475.32 turns into 140475.31999999999998 How do I deal with this? The problem is that if I use a NumberFormatter with precision of 2, then the value is truncated to 140475.31 . Any ideas? 回答1: This is my generic solution for the problem (I have blogged about this here) : var toFixed:Function = function(number:Number, factor:int) { return Math.round(number *

StackTrace in Flash / ActionScript 3.0

醉酒当歌 提交于 2019-12-17 06:13:01
问题 I want to see the stack trace in any function of my code, so i made somthing like this to call it and print the stack trace: public function PrintStackTrace() { try { throw new Error('StackTrace'); } catch (e:Error) { trace(e.getStackTrace()); } } I like to know if there are other way to do this. In some place, the Error class creates the stack trace, but maybe it didn't do it with ActionScript 3.0 so maybe it's not posible, but i want to know. Thanks! 回答1: As far as I know, the only way to

How to notify the HTML container that the SWF has finished, using swfobject

帅比萌擦擦* 提交于 2019-12-17 05:15:54
问题 I am embedding a flash object (swf file) into an HTML page. The object is written in as3 and built using Flash Builder. Its purpose is to show some animation, then finish. It is really important to me to be able to notify the container that the animation has finished, but I can't find anything that works. I am using swfobject version 2.2. Tried both on Chrome 40 and IE 11. HTML (sample): <!DOCTYPE html> <html> <head> <meta http-equiv="Content-type" content="text/html;charset=UTF-8"> <script

Call AngularJS from legacy code

百般思念 提交于 2019-12-16 20:16:01
问题 I'm using AngularJS to build HTML controls that interact with a legacy Flex application. All callbacks from the Flex app must be attached to the DOM window. For example (in AS3) ExternalInterface.call("save", data); Will call window.save = function(data){ // want to update a service // or dispatch an event here... } From within the JS resize function I'd like to dispatch an event that a controller can hear. It seems that creating a service is the way to go. Can you update a service from

Casting a loaded SWF as an interface

南楼画角 提交于 2019-12-14 04:22:45
问题 I'm trying to load in a remote SWF and access it's methods and properties, using an interface. (There's a similar question here that got as far as "that's weird!" but didn't resolve it: Loading swf and using it through interface) My remote SWF looks like this: package { import flash.display.Sprite; import flash.events.Event; import flash.system.Security; import IMultiplayer; [SWF(width="238", height="60", frameRate="60", backgroundColor="#FFFFFF")] public class Main extends Sprite implements

Why does Flash CS3 require you to specify the base class when exporting for actionscript (as3)?

这一生的挚爱 提交于 2019-12-14 04:06:46
问题 In the library, right-click on a movieclip that you have written an ActionScript class for and select "Linkage...". Notice that the "Base class" field is not empty (it can't be). It's likely to be flash.display.MovieClip , but it could be something else, depending on what your class inherits from. This base class field is only required when publishing for ActionScript 3. So can anyone tell me why Flash CS3 insists on me providing the base class in both the ActionScript file and the Linkage

Adding Local Filenames/References To Array In Actionscript

一个人想着一个人 提交于 2019-12-14 04:01:58
问题 how can i cycle thru a local folder to add all (or some) files names and references to that file in an array using actionscript 3.0? var fileArray:Array = new Array(); for (var item:Object in "../myFolder/") { trace(item.name); fileArray.push(item); } something like this? 回答1: You can only access the file system using AIR :/, or by having Flex make an HTTP call to a server-side language like ruby/python/php and having it return that information. Here is an AIR Directory Listing Example (you