actionscript

Using 'File' to save scene object locations to rebuild later in AS3

我是研究僧i 提交于 2019-12-17 10:09:40
问题 I am attempting to use the 'File' function in ActionScript 3 to save the following information: I have varying draggable display objects in the scene, the amount and type can vary. I want to save the amount and their position and then load them back in a future session. I am struggling to use File to save anything, I have searched the Adobe documentation and cannot get my head round how to use it. I have not yet developed any code using it. Any help would be appreciated. Thank you. 回答1: You

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 *

Flash Movies and ActionScript - Stop the video from working offline

北城以北 提交于 2019-12-14 03:59:17
问题 I posted a question on superuser which seems to have a code related answer, so here it goes. I have a problem; I need to share videos online, but need to find a way to either completely stop, or at least make it hard for people to download them and view them online. I'm aware that if it was possible, Hollywood would have done it already, but I have an idea... Some years ago I stumbled across a video on newgrounds.com, a site for flash animators to post their content for users to rate,

How to get CPU usage in flash?

你离开我真会死。 提交于 2019-12-14 03:54:17
问题 I tried to find out but Google didn't help. Is there some way to get the cpu usage in flash or adobe AIR? I'm using ActionScript 3.0 and flash CS5. 回答1: In Flash, there is no way. In AIR, only native helper could do it. Flash platform has tough time with system programming, it's not its strength. 来源: https://stackoverflow.com/questions/5120270/how-to-get-cpu-usage-in-flash

iOS TextInput displayAsPassword doesn't displayAsPassword

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-14 03:42:33
问题 I'm building an app to launch across Android, iOS, and desktop simultaneously. The app includes a login that is attached to a vBulletin system and I've run into a significant issue (that the client is adamant must be fixed). On iOS, if you are typing in a TextInput that has its displayAsPassword set to true, it will show plain text while typing. Once you click out of the TextInput, it displays properly. Here is the code I am using within Flex <s:TextInput id="inputField" width="100%"

AS3 create a trail of movieclips following each other

北城以北 提交于 2019-12-14 03:14:11
问题 So, I'm trying to get a few movieclips to follow it's precursor and have the last one follow the mouse. The problem is I'm creating them from code instead of using the interface and, since I'm not an expert, I can't get them to work. All I have in the library is a MovieClip(linkage:"LETRA") which contains a textField inside(instance name:"myTextField"). Here's what I have: import flashx.textLayout.operations.MoveChildrenOperation; import flash.display.MovieClip; import flash.events.Event; /

key_down delay action script 3

血红的双手。 提交于 2019-12-14 02:53:22
问题 When you hold down the key After first pressing the next press is delaying but I don`t know why. public function KeyboardControl(event:KeyboardEvent):void { keySpeed=5 if(event.keyCode==Keyboard.RIGHT||event.keyCode==Keyboard.D) { if(_Vx<0) { _Vx=0; } _Vx += (keySpeed/mass); } if(event.keyCode==Keyboard.LEFT||event.keyCode==Keyboard.A) { if(_Vx>0) { _Vx=0; } _Vx -= (keySpeed/mass); } } 回答1: For more responsive behaviour, structure it like this: private var _Vx:Number = 0; private var keySpeed

ExternalInterface gives me an option of stopping the script when using multiple parameters. Why?

自闭症网瘾萝莉.ら 提交于 2019-12-14 01:47:05
问题 First version: ExternalInterface.call("$(document).trigger", "opened_file_chooser"); Second version: ExternalInterface.call("$(document).trigger('opened_file_chooser')"); If I use the first version, it's much, much slower than the second. Also, the browser blocks, and after a few seconds Firefox shows me the dialog with "A script is not responding ... " and it offers me the possibility of stopping it. If I use the 2nd version, the call to Javascript is instantaneous. Is there a way I could

Webcam Stream to CDN FMS

风格不统一 提交于 2019-12-13 21:25:33
问题 I don't have my own Flash Media Server. I can however use the Highwinds CDN. They run FMS on their CDN. When you schedule a live event, Highwinds gives you two urls: the "server" and "stream name". Examples: server: rtmp://fli003.am4.hwcdn.net/XXXX/ definst stream name: fli/00000-streamname?encoderuser=XXX&encoderpassword=YYY These two urls can be pasted into the Flash Media Live Encoder application to stream the live event. The respective field names in Flash Media Live Encoder are "FMS URL"