actionscript-3

How can I know when a Button in a Flex DataGrid itemRenderer is clicked?

天涯浪子 提交于 2019-12-19 08:52:32
问题 I have a DataGrid component that displays a few columns of data. It has one additional column that displays a Button that allows the user to take an action with regard to the record. <mx:DataGrid dataProvider="{myData}"> <mx:columns> <mx:DataGridColumn dataField="firstName" headerText="First Name" width="75" /> <mx:DataGridColumn dataField="LastName" headerText=" Last Name" width="150" /> <mx:DataGridColumn dataField="phone" headerText="Phone" width="120" /> <mx:DataGridColumn headerText=""

as3 function pointer

百般思念 提交于 2019-12-19 08:28:48
问题 private function myFunction(numIn:Number){ trace ("numIn " + numIn); } var plan:Object = { "theFunctionName": "myFunction" } // now use the function plan.theFunctionName(5); // should trace out: "numIn 5" This won't work, but can you see what I'm trying to do? It's kind of like a function pointer, or when you pass a function name into an event listener. Thanks. 回答1: What you need is: var plan:Object = { theFunctionName: myFunction } 回答2: Either do what Jacob suggested, or you can even just do

Arrange (z) order of objects in Flash with ActionScript 3?

ぃ、小莉子 提交于 2019-12-19 05:59:36
问题 Is it possible to arrange (z) order of objects in Flash with ActionScript 3? e.g. I have 3 symbol instances on a given layer, and I want to perform the equivalent of 'Bring to Front', 'Bring Forward', and/or target a certain z position. 回答1: You can change the z-index (stacking order) of a movie clip within a same layer using action script like this. parent.setChildIndex(childObject, i) Change childObject to the name of the movie clip you want to change the z-index, change i to an integer

AS3 Fastest way to merge multiple arrays

…衆ロ難τιáo~ 提交于 2019-12-19 05:49:29
问题 I'm trying to write a function where I can specify any amount of array, and the return value will be an array containing the contents of all of the specified arrays. I've done this, but it seems like a really slow and ugly way of doing it: var ar1:Array = [1,2,3,4,5,6,7,8,9]; var ar2:Array = ['a','b','c','d','e','f','g','h']; function merge(...multi):Array { var out:String = ""; for each(var i:Array in multi) { out += i.join(','); } return out.split(','); } trace(merge(ar1, ar2)); Is there an

AS3 Fastest way to merge multiple arrays

风格不统一 提交于 2019-12-19 05:49:19
问题 I'm trying to write a function where I can specify any amount of array, and the return value will be an array containing the contents of all of the specified arrays. I've done this, but it seems like a really slow and ugly way of doing it: var ar1:Array = [1,2,3,4,5,6,7,8,9]; var ar2:Array = ['a','b','c','d','e','f','g','h']; function merge(...multi):Array { var out:String = ""; for each(var i:Array in multi) { out += i.join(','); } return out.split(','); } trace(merge(ar1, ar2)); Is there an

Timer vs setTimeout

半城伤御伤魂 提交于 2019-12-19 05:29:47
问题 The docs for flash.utils.setTimeout() state: Instead of using this method, consider creating a Timer object, with the specified interval, using 1 as the repeatCount parameter (which sets the timer to run only once). Does anyone know if there is a (significant) advantage in doing so? Using setTimeout is a lot easier when you only need to delay 1 call. 回答1: setTimeout actually uses a Timer subclass, the SetIntervalTimer , which is an internal class. You can check by doing setTimeout(function ()

Getters/setters in Java

泄露秘密 提交于 2019-12-19 05:04:31
问题 I'm new to Java, but have some OOP experience with ActionScript 3, so I'm trying to migrate relying on stuff I know. In ActionScript 3 you can create getters and setters using the get and set keywords, meaning you create a method in the class and access data through a property of an instance of that class. I might sound complicated, but it's not. Here's an example: class Dummy{ private var _name:String; public function Dummy(name:String=null){ this._name = name; } //getter public function get

AEC in Flash, getEnhancedMicrophone

旧城冷巷雨未停 提交于 2019-12-19 04:58:14
问题 Have next problem: var mic:Microphone = Microphone.getEnhancedMicrophone(); mic.setLoopBack(true); And I don`t hear any sound... What is it? When I write Microphone.getMicrophone() all work right and I hear sounds. 回答1: To work around it, try the following steps: 1) install debug player 10.3 or higher It's very likely that you run it with NOT debug version of flash player, that is why you miss important warnings and exceptions. 2) allow users to accept access to the microphone: Security

MovieClip(root) Not working. How to access root variable from movieclip? Flash AS3

家住魔仙堡 提交于 2019-12-19 04:38:15
问题 Ok Ive got a simple flash file, since im trying to accomplish accessing a variable from the main stage inside a movie clip. All the things Ive found from google point to MovieClip(root). But its not working for me. On the main timeline: var MyName:String; MyName = "kenny"; Then I have a movieclip called MyBox, its code: trace(MovieClip(root).MyName); And I get this error: TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Stage@2d2df089 to flash.display.MovieClip. at

Encrypt/Decrypt Image in ActionScript 3

守給你的承諾、 提交于 2019-12-19 04:03:27
问题 I am developing a mobile app that involves (essentially) picture messaging as a feature. I need the images to be encrypted/decrypted with a simple, plain-text password. Due to the nature of the images being captured, it is /critical/ that the encryption and decryption processes happen on the device. After sitting through a presentation on mobile development in Flex, I have decided to create my app with the Flex SDK, which means I will be implementing the client application in ActionScript 3