actionscript-3

How do I delete a value from an Object-based associative array in Flex 3?

时光毁灭记忆、已成空白 提交于 2019-12-22 05:31:12
问题 I need to remove the value associated with a property in a Flex 3 associative array; is this possible? For example, suppose I created this array like so: var myArray:Object = new Object(); myArray[someXML.@attribute] = "foo"; Later, I need to do something like this: delete myArray[someXML.@attribute]; However, I get this error message at runtime: Error #1119: Delete operator is not supported with operand of type XMLList. How do I perform this operation? 回答1: delete doesn't do as much in AS3

AS3 disable editable/selectable for textInput inside of a Datagrid

我们两清 提交于 2019-12-22 05:26:10
问题 I am currently trying to disable the selectable / editable / or change the textInput to dynamic to get my desired result. I've got a custom datagrid with dropdowns and text input areas. However, if there is no data in my Model # column, I do not want to allow for any entry in the corresponding PurchasePrice cell. col1 = new DataGridColumn("Model"); col1.headerText = "Model #"; c2.consumables_dg.addColumn(col1); col1.width = 60; col1.editable = false; col1.sortable = false; col1.cellRenderer =

Actionscript-3 random numbers between max and min

≡放荡痞女 提交于 2019-12-22 05:05:20
问题 I'm generating a random number between min and max with this code: return min + (max - min) * Math.random(); And it works. However, the random numbers are very little usually between "1 or 3" even if the max is 80. How can I better distribute the random numbers over all range ? thanks 回答1: I am very sure that the code you posted, return min + (max - min) * Math.random(); , should return an evenly distributed random number between min (inclusive) and max (exclusive). There is no reason why it

Find out the character pressed key

雨燕双飞 提交于 2019-12-22 04:43:21
问题 If I add a listener to KeyboardEvent.KEY_DOWN, I can find out the keyCode and the charCode. The keyCode maps to a different character depending on the keyboard. The charCode is just as useless, according to the help: The character code values are English keyboard values. For example, if you press Shift+3, charCode is # on a Japanese keyboard, just as it is on an English keyboard. So, how can I find out which character the user pressed? 回答1: You left out a pretty important part of the quote or

Does ExternalInterface work on the file: protocol?

放肆的年华 提交于 2019-12-22 04:38:10
问题 Can anyone confirm that ExternalInterface works on the file: protocol, or point to some docs that say that it will not? 回答1: It's starting to look like this will not work.. this page says: Scripting in either direction between local HTML files and local SWF files--for example, using the ExternalInterface class--requires that both the HTML file and SWF file involved be in the local-trusted sandbox. This is because the local security models for browsers differ from the Flash Player local

How to do Flex date deduction and addition

左心房为你撑大大i 提交于 2019-12-22 04:36:09
问题 In flex, I am trying to do date deduction and addition, but couldn't find a way to do it. e.g.: public var dateNow:Date=new Date(); How can I get the Date 3 months earlier than dateNow? Thanks!!! 回答1: You can use the Date constructor for this. The first argument to Date's constructor takes either a year or a timestamp. You can use the Date.time property to get the timestamp from a date object. Once you have the timestamp you can add/subtract some number of seconds from it, and then pass it to

How do you combine X, Y, and Z rotations in a model's local space (not global)?

房东的猫 提交于 2019-12-22 04:18:05
问题 I am starting out on Molehill and am having a lot of problems grasping Matrix3D. My first problem is how to manage a Matrix3D that describes a single model's orientation. I use Matrix3D.appendRotation() to do this. But depending on the order I append in I get a different result (obviously, since I am rotating one at a time in the global space). I know this is a common problem, I have run into it with 3d software modeling. But this time, I have to fix it programtically. This is where I need

Are ints always faster than Numbers/Floats in AS3?

ぃ、小莉子 提交于 2019-12-22 04:16:18
问题 Flash is known to behave in very unpredictable ways ways when it comes to manipulating data. I'm curious that if there is any performance/memory benefit to using Numbers instead of ints aside from values that need precision. I have heard that some basic operations in Flash may convert multiple times between the two type to resolve the expression. I've also heard that Flash runtime, under the hood, actually maps ints to non-precision Numbers/Floats during runtime. Is any of this true? 回答1:

Check if value is a number

拈花ヽ惹草 提交于 2019-12-22 03:46:39
问题 How can i simply check if a returned value of type int or uint is a number? 回答1: Simple: if(_myValue is Number) { fire(); }// end if [UPDATE] Keep in mind that if _myValue is of type int or uint , then (_myValue is Number) will also equate to true . If you want to know if _myValue is a number that isn't an integer(int) or unsigned integer (uint), in other words a float, then you can simply modify the conditional as follows: (_myValue is Number && !(_myValue is int) && !(_myValue is uint)) Let

inner class in AS

岁酱吖の 提交于 2019-12-22 01:58:38
问题 for example: package{ public class A { var test:String; public function A() } } class B{ } the code is in the same file, we call B is inner class, then how to call the constructor of class B 回答1: package { public class A { var test:String; public function A() { var b:B = new B(); } } } class B { public function B() { trace('class B'); } } 来源: https://stackoverflow.com/questions/3594013/inner-class-in-as