actionscript

AS3 Event listeners when data is changed?

99封情书 提交于 2019-12-24 12:06:34
问题 Hopefully you will excuse me if this is a simple/silly question. I started learning action script about 6 days ago and already working on a small project :D Anyways, there is a property that changes occasionally to reflect the name of a level in a game (object._I._M.text). It could take a minute to change, or a max of two minutes, depending on how fast all players are able to finish the level. I want to be able to listen for the change in this property to fire off another function. I have

Get a static property from class in actionscript

旧巷老猫 提交于 2019-12-24 10:49:15
问题 I have this class package somePackage { public class SomeClass { public static const FOO: SomeClass = new SomeClass("0"); public static const BAR: SomeClass = new SomeClass("1"); } } I want to be able to get those static property given it's name. Example: public static function getProperty(propertyName: String): SomeClass { //don't know what goes here } var property1:SomeClass = SomeClass.getProperty("FOO"); // property1 == SomeClass.FOO var property2:SomeClass = SomeClass.getProperty("BAR");

Flex: Custom Item Renderer For Combobox controls truncates text

偶尔善良 提交于 2019-12-24 10:31:25
问题 I've implemented a custom item renderer that I'm using with a combobox on a flex project I'm working on. It displays and icon and some text for each item. The only problem is that when the text is long the width of the menu is not being adjusted properly and the text is being truncated when displayed. I've tried tweaking all of the obvious properties to alleviate this problem but have not had any success. Does anyone know how to make the combobox menu width scale appropriately to whatever

ExternalInterface.addCallback fails in local environment

浪子不回头ぞ 提交于 2019-12-24 09:59:00
问题 I thought this question would answer my question, but I have applied the following fixes: .as Security.allowDomain("*"); Security.allowInsecureDomain("*"); .html param name="allowScriptAccess" value="always" /> .js params.allowscriptaccess = "always"; And I am still seeing the ExternalInterface.addCallback method fail locally. It works on a web server, or in the dev folder . But not in an arbitrary local folder. 回答1: Add as a trusted location the folder where your swf/html reside. Right click

How to use remote SharedObject in AS3 and Red5

谁说我不能喝 提交于 2019-12-24 08:57:39
问题 I wish to use remote SharedObject so I created a simple script to test out the techniques. When I ran the following code as two instances of SWF, both instances output 1, which was incorrect because the second instance was supposed to output 2. import flash.net.SharedObject; import flash.events.SyncEvent; var nc:NetConnection; var so:SharedObject; nc = new NetConnection(); nc.client = { onBWDone: function():void{} }; nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus); nc.connect(

Asynchronism in Action Script 3.0

ぐ巨炮叔叔 提交于 2019-12-24 08:29:02
问题 I wonder, how is asynchronism implemented in AS3? Lets take the Timer class. A timer runs asynchronously and dispatches some events. Seems like it creates a new thread for himself. And how are the functions, called when timer event occurs, being thread safe? How is thread safety implemented in AS3? 回答1: AS3 now supports multi threading using "ActionScript Workers" in the latest build. You can see how it is used here in this preview... http://www.bytearray.org/?p=4423 回答2: AS3 [used to be] not

Lost in dates and timezones

倖福魔咒の 提交于 2019-12-24 08:22:47
问题 I'm working on an application that stores conferences with their start and end date. Up until now, I was developing in Belgium and my server is in France, so everything is in the same timezone, no problem. But today, I'm in San Francisco, my server is in France and I noticed I have a bug. I'm setting dates from a Flex client (ActionScript automatically adapts date display according to client local timezone, which is GMT-8 for me today. My server runs on Hibernate and MySQL in France (GMT+1).

Draw a Hand Signature in Flex 4

我的未来我决定 提交于 2019-12-24 08:22:12
问题 I am creating an application that requires a user to draw their hand signature on a tablet. Does anyone the best way to do this on Flex mobile 4.5? What do I draw on to, a Sprite, canvas? Also, I would need to save the signature as a .jpg, could this be done? 回答1: Have a look on the following: http://www.jamesward.com/2010/03/22/flex-paint-updated-to-flex-4/ It may give you some hints. 回答2: The BlackBerry-provided sample signature capture app ought to be a good starting point. 来源: https:/

HMAC-SHA-512 implemention for ActionScript

丶灬走出姿态 提交于 2019-12-24 07:43:55
问题 As mentioned by the title, I would like to find an implementation for HMAC-SHA-512 written for ActionScript. I was able to find a library that provide HMAC-SHA-256 with other functions, however, I am looking for HMAC-SHA-512 specifically. Thank you Edit: Or, since actionscript and javascript have the same origin, can some one port this javascript version into actionscript? http://pajhome.org.uk/crypt/md5/sha512.html Edit 2: I already ported the code from javascript to actionscript. The code

Displaying movieclips from an array in sequential order

不打扰是莪最后的温柔 提交于 2019-12-24 07:31:16
问题 Here is what I am trying to do: Establish an array of movie clips in the library Randomize the order within the array On enter frame, display the first movie clip in the randomized array When a "next" button is clicked, the existing clip with unload and the next move clip in the array order will load Once the last movie clip in the array has been displayed and the "next" button has been clicked, the first movie clip in the array will load. this will repeat over and over if the user keeps