actionscript-3

Optionally use Flash 10.2 cursors, while still being compatible with Flash 10.0?

随声附和 提交于 2020-01-01 14:34:39
问题 I have a Flash application that requires Flash version 10.0 to run. I want to add native mouse cursors, which were introduced in Flash 10.2, but I don't want to require all my users to upgrade, and I don't want to have to compile two separate versions of my app. Is there any way at runtime I can detect if the cursors are available, and then use them? It seems like if you only compile for Flash 10.0, it marks the SWF version header "10", and you have no access to the new APIs. And if you

How do I ping from Flex - AIR?

霸气de小男生 提交于 2020-01-01 10:53:17
问题 I'm bored cause my development server is down and I'm running the command prompt to ping the server indefinitely so that I'll see when they stop timing out and know that I can work again. In the meantime I wanted to make an Air app that will do this for me, so I can have it chirp or alarm or do something when it starts to be able to connect to the server. So I need to start with having AIR do the ping, does anyone know how to do this? I can't find any help on it. I can't use the HTTPService

How to get the final length on a Sound object that is still loading?

大憨熊 提交于 2020-01-01 10:50:58
问题 I'm creating a basic MP3 player in ActionScript 3. I have a basic progress bar that indicates how much of the song has played. The progress is calculated as a decimal percentage normalized between 0 and 1 as such: var progress:Number = channel.position / sound.length; The problem is, if the audio is still loading/buffering the sound.length is incorrect. This causes my progress bar to skip around and even travel backwards until the sound has completely loaded and the sound.length isn't

Is it possible to do lightweight REST calls in Flex?

时光总嘲笑我的痴心妄想 提交于 2020-01-01 07:00:08
问题 We are converting a Flex application to use some REST APIs. When adding the mx.rpc.http.HTTPService class to the code, the SWF binary output grew from 175KB to 260KB. This is an unacceptable hit. Is there any better way to do lightweight REST calls from a Flex app? Are we better off using an external interface JS just to make the calls from there? 回答1: flash.net.URLLoader is built into the runtime and won't cause any increase in filesize. I've used it as a JSON client before, so you shouldn't

Sending data from flash to node.js server with socket.io

眉间皱痕 提交于 2020-01-01 05:51:31
问题 I have a simple socket.io based server in node.js that listens to a socket in port 81 (for example) I have no problem connecting and passing data between clients written in Javascript But after a lot of tries I can't get my Flash app to connect to the server and pass data to it (I found some examples in the web - but all of them are flex based and use classes that aren't parts of the basic AS3 libraries) when I'm trying to connect to the socket using a XMLSocket - I get Security Sandbox

AS3 - Event listener that only fires once

折月煮酒 提交于 2020-01-01 05:43:06
问题 I'm looking for a way to add an EventListener which will automatically removes itself after the first time it fires, but I can't figure a way of doing this the way I want to. I found this function (here) : public class EventUtil { public static function addOnceEventListener(dispatcher:IEventDispatcher,eventType:String,listener:Function):void { var f:Function = function(e:Event):void { dispatcher.removeEventListener(eventType,f); listener(e); } dispatcher.addEventListener(eventType,f); } } But

1D multiple peak detection?

孤街醉人 提交于 2020-01-01 05:42:07
问题 I am currently trying to implement basic speech recognition in AS3. I need this to be completely client side, as such I can't access powerful server-side speech recognition tools. The idea I had was to detect syllables in a word, and use that to determine the word spoken. I am aware that this will grealty limit the capacities for recognition, but I only need to recognize a few key words and I can make sure they all have a different number of syllables. I am currently able to generate a 1D

Why Sytem.totalMemory keeps increasing?

和自甴很熟 提交于 2020-01-01 05:17:06
问题 I have this blank project, just to check out System.totalMemory variable. As far as I can see, i get this values: 3076 3092 3096 3088 3092 3096 3100 3104 3108 3112 3117 3121 3125 3129 3133 3137 3141 3145 3149 ... And so on I had no Flash open, no Internet Browser, no other instance of flash. The project is blank, only one static text, and one dynamic text, called 'memory'. One *.as file, that contains this code: package{ import flash.display.Sprite; import flash.events.Event; import flash

Add days to Date in ActionScript

僤鯓⒐⒋嵵緔 提交于 2020-01-01 04:33:07
问题 We have an application in which the user has to enter a date who's value is no more than 30 days after the the current date (the date on which the user uses the application). This is a Flash application, therefore I need a way to add 30 days to the current date, and get the right date. Something like in JavaScript: myDate.setDate(myDate.getDate()+30); Or in C#: DateTime.Now.Add(30); Is there such a thing in ActionScript? 回答1: While the other answers will work im sure, it is as easy as doing:

Flash SWF not initializing until visible - can I force them to initialize?

天涯浪子 提交于 2020-01-01 03:53:05
问题 I have an application that needs to render about 100 flash graphs (as well as other DOM stuff) in a series of rows that vertically extend many times beyond the current visible window - in other words, the users have to scroll down see see all the different graphs. This application is also dynamic and when a user changes a value in the DOM (anywhere on the page) it will need to propagate that change to all the Flash graphs at the same time. So I setup all the externalInterface callbacks and