actionscript

Re-dispatching event in FLEX

泪湿孤枕 提交于 2019-11-30 12:35:02
In a FLEX app, I am trying to "re-dispatch" a custom event. I.e. component1 does dispatchEvnet(event), component2 registers a handler for the event, the only function of the handler being, again, dispatch(event). Finally, component3 listens for the event coming out of component2. What I am trying to do is similar to the concept of "re-throwing" exceptions (and for similar reasons). The difference is that re-dispatching does not seem to work in AS3 (Flash 10). In IE, nothing happens, and in FF3 there is an exception saying that the type cast failed while trying to coerce the Event type to my

WebSockets vs raw TCP sockets in Flash

浪子不回头ぞ 提交于 2019-11-30 11:03:58
问题 What WebSockets add to raw TCP connection? Why should I use WebSockets? I'd like to hear cons and pros like: Good: WebSockets add some useful things like autoreconnection, session ids, etc. Bad: WebSockets add a lot of overhead I'll have only Flash clients, no need to support Javascript clients. 回答1: You can't do raw sockets from a web application in a browser. Even "raw" socket connections from Flash are not really raw because you have to answer a policy file request to get CORS security

Syntax Highlighting library in ActionScript

泄露秘密 提交于 2019-11-30 09:48:29
I let user enter some code in my Flex3 (Flash 10) app and I want to do syntax highlighting. Is there any open-source library that would help me? I'll need a Lua syntax support, but I can add it myself if library has a resonable interface to do this. Swaroop C H Update on 21 Jan, 2009: Check out Anirudh's port of google-code-prettify to ActionScript3 , it has a very good example app as well. I guess this wasn't even feasible till now. With the new Flash Text Engine , maybe such text-based features will start showing up, and hopefully open source libraries that work like the FlashEff library. I

How can I calculate shades of a given hex color in actionscript 3?

让人想犯罪 __ 提交于 2019-11-30 09:43:48
I need a way to calculate lighter hex color(s) based on a provided one. I realize I could use a color transform, but I need the actual value in order to generate a gradient. Here's some stuff pulled out of my Color utils. Sounds like makeGradient might be useful to you. /** * Return a gradient given a color. * * @param color Base color of the gradient. * @param intensity Amount to shift secondary color. * @return An array with a length of two colors. */ public static function makeGradient(color:uint, intensity:int = 20):Array { var c:Object = hexToRGB(color); for (var key:String in c) { c[key]

Get size of ActionScript 3 Dictionary

眉间皱痕 提交于 2019-11-30 08:53:19
问题 var d:Dictionary = new Dictionary(); d["a"] = "b"; d["b"] = "z"; How to get the length/size of the dictionary (which is 2) ? 回答1: There is no built-in method to get the size/lenght/count of an AS3 dictionary. There are workarounds: for example, you can create a custom dictionary class which extends or wraps the flash.utils.Dictionary class, adding the counter functionality. You can manage the count as entries are added/removed, or count on-demand using a simple For loop iteration: public

Should I Abandon Adobe Flash for HTML5 and <canvas>?

[亡魂溺海] 提交于 2019-11-30 08:46:17
I'm currently looking into developing Facebook applications and was planning on using Flash as the basis of my application, I have test built some simple PHP Facebook applications and I know enough about action-script 3 to start me on my way, but the API for Facebook development in AS looks far more tedious than the PHP one. my question is would I be able to create interactive graphics (games) like we see across the web in the HTML5 canvas class? and which would be simpler? HTML5 doesn't truly exist yet outside of the basic support in the various browsers. We're a couple of years off from true

How does [RemoteClass] work in Flex Actionscript can I use it for custom data-binding?

时间秒杀一切 提交于 2019-11-30 08:23:11
问题 Actionscript supports a [RemoteClass] metadata tag that is used in BlazeDS to provide data-binding hints for marshalling AMF binary objects from Java to BlazeDS. For example: Java: package sample; public class UserInfo { private String userName; public String getUserName() { return userName; } public void setUserName(String value) { userName = value; } } Actionscript: [Bindable] [RemoteClass(alias="sample.UserInfo")] public class UserInfo { public var userName:String=”"; } How exactly is the

extending AS3's Array access operators to 'wrap' out-of-bound index values

痴心易碎 提交于 2019-11-30 07:44:24
I'd really like to be able to make Flash's array access syntax 'wrap' over the array's bounds. Lengthy explanation - var array:Array = ['a','b','c','d','e','f']; To keep things simple, the first index is 0, and its value is the first letter, 'a'. To get that value, we'd do this - array[0]; // returns 'a' As long as the index you're using to access the array is between 0 and array.length (6 in our example,) everything works fine - but if you use an index outside of those bounds, you're shut down. array[-3]; array[9]; // both return 'undefined' Sometimes that's a good thing - sometimes you

How can i on button press execute a command in the command prompt and get back the output in ActionScript?

北城余情 提交于 2019-11-30 07:44:00
I have a GUI using Flex. I have a condition like i need to execute some command line arguments in the local machine and get the results back or output back to a textbox area. How can i do a button on submit, execute command in the local machine and return the output? Command to execute example: echo logfile.log | grep username Code: button1.onRelease = function () { // in this computer, it will now run a command, please wait. } My reference from the answer: https://gist.github.com/993905 You're not going to be able to do this using actionscript 2 and you're not going to be able to do this

javascript to actionscript keypress passing utility?

試著忘記壹切 提交于 2019-11-30 07:16:58
问题 Is there an existing javascript library for relaying key press events in the browser (or certain divs) into flash? I am hoping there might be a library kind of like this one for mousewheel events ? Something like this handles javascript keyboard shortcuts great. I suppose I could just listen for those events and pass the ones I want into flash? EDIT: These are great examples, however, if flash has focus, then javascript keystrokes are lost. How can you ensure that all key events go through