actionscript

ActionScript: Package-level introspection? Or some other pluggable loading scheme?

我的未来我决定 提交于 2019-12-05 21:35:30
I'm coding up some delicious business logic and I've come to a situation like this: There are a bunch of rules ( ruleA , ruleB , etc...) which all follow a standard pattern. I've created a Rule interface, and implemented it in RuleA , RuleB , and so on. So now I just need a way to load them. Right now I'm using a map: var rules:Object = { ruleA: new RuleA(), ruleB: new RuleB(), ... }; Then calling it like this: function doStuff(whichRule:String, someData:Object):* { return rules[whichRule].applyTo(someData); } Now, the rules follow a standard naming scheme, and they are all part of one package

Specifying a unicode range in an actionscript regular expression

老子叫甜甜 提交于 2019-12-05 20:21:50
I have been trying to write a regular expression that would match all unicode word character something like : /[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF\w]/gi But this completely fails and doesn't match anything. I have tried a variety of expressions and it seems that as soon as I try to specify a range it fails. As anyone been luckier than me? I wish actionscript would offer something like \p{L}, but if there's anything in the like, I couldn't find it in the doc. You can use String.fromCharCode with the unicode characters and then the ranges will work correctly in a regular expression. Here is

What is an elegant way to position 8 circles around a point

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 19:29:21
var circles:Array = new Array(); for(var i:int = 0; i < 8; i++) { var ball:Ball = new Ball(); ball.x = ??? ball.y = ??? circles.push(ball); } What is the best way to position balls around some point lets say in 5-10 distance of each other, is there some formula? for(var i:int = 0; i < 8; i++) { var ball:Ball = new Ball(); // Point has a useful static function for this, it takes two parameters // First, length, in other words how far from the center we want to be // Second, it wants the angle in radians, a complete circle is 2 * Math.PI // So, we're multiplying that with (i / 8) to place them

Automated testing (non-UI) for existing Flash component

妖精的绣舞 提交于 2019-12-05 18:22:52
I build and maintain a set of Flash components that is distributed to publishers and allows them to integrate with our system. Currently the component has no UI and simply contains compiled code for querying our system servers, parsing the response, and modifying the params sent in the query. There's an As2 version and AS3 versions for both Flex and CS3. Our typical workflow is like this: 1.) load the component 2.) set parameters on the component 3.) tell the component to query our system 4.) wait for an event saying the response has been received and parsed 5.) call methods on the component

how to call actionscript function from javascript

喜欢而已 提交于 2019-12-05 18:22:51
I have a function like this in actionscript3 private function uploadFile(event:MouseEvent):void { var uploader:URLRequest = new URLRequest(serverUploadFile); localFile.upload(uploader); } how can i call this function from javascript ? thx In AS3 Use ExternalInterface to add a javascript callback. ExternalInterface.addCallback("uploadFile", null, uploadFile); More details here Use ExternalInterface 来源: https://stackoverflow.com/questions/1674402/how-to-call-actionscript-function-from-javascript

how to read a global javascript variable from actionscript

这一生的挚爱 提交于 2019-12-05 16:10:23
Given that there is a global javascript variable on my web page named myVar, how can I access the value of the variable myVar from within my flash movie using javascript? I see plenty of examples of using external interface in order to execute javascript from actionscript, but I am unable to find examples of returning values back into the flash movie using actionscript. Thanks in advance. I hope my question is clear enough. ExternalInterface works by allowing JavaScript to invoke an ActionScript function in the movie, and vice-versa. You can optionally receive a return value back from the

Extracting Actionscript from .fla file, without Adobe Flash

北城以北 提交于 2019-12-05 14:48:59
Unlike this guy , I'm using MTASC 's Haxe to compile SWF from AS. Considering I don't have Adobe CS, what are our options to extract the action scripts from any FLA file? I mean different versions, like CS4, CS5, etc. Converting older versions to CS5 would also help. CS4 FLA container is Microsoft Structured Storage (like MS Word documents). You can open it with for example FAR Manager or OpenMCDF . Embedded AS3 code can be seen inside the objects in Unicode plaintext. You can open it with a text editor that supports Unicode encoding (2-byte UCS-2 Little Endian, not UTF8), and trim off binary

How to access top level package in ActionScript?

拥有回忆 提交于 2019-12-05 14:31:33
I would like to access an ActionScript 3.0 top level function from a class of mine, in which a symbol with the same name ( trace ) as the top level function is already defined: class A { public static function trace():void { } trace("Test"); } I would like to call the global ActionScript trace function with trace("Test") , but this is not possible as another symbol function trace() is defined. In a case where the external definition which I would like to access would be located in a package ( flash.utils or so), I could access that external definition with flash.utils.[definitionName] , as I

Flex: Basic expectations from a flex(actionscript) developer

别等时光非礼了梦想. 提交于 2019-12-05 08:27:37
问题 Knowledge has no limits but still in your opions, what are the basic requirements for an individual, where he can call himself a flex developer. To make it a bit concrete lets say after having a 2-3 years experience. In my perspective it should be something like below. It is a very (very) rough idea and please let me know your views and suggestions on this. BASIC: (1) Knowldge about basic GUI components like tab, vbox, etc. Their properties and the ability to decide which component suits

Singleton Class in Flex

百般思念 提交于 2019-12-05 08:10:33
I have a doubt,.... How would you create a Singleton class in Flex... Is there any convention like the class name should eb Singleton or it should extend any other class. How many Singleton class can a project have? Can anyone say the real time usage of a Singleton class? I am planning to keep my components label texts in a Singleton class... Is it a good approach. Can of worms asking about singletons! There are a few different options about creating singletons mainly due to AS3 not having private constructors. Here's the pattern we use. package com.foo.bar { public class Blah { private static