actionscript-3

Changing dyanmic text field in MovieClip added to stage by AS3 is not working?

与世无争的帅哥 提交于 2019-12-22 08:29:45
问题 When I change the text value of a dynamic text field, the text field is just going blank, not showing the new value. I have a MovieClip titled "game_board" that is added to the stage dyanmically by AS3. (stage is blank to begin with.) I have another MovieClip titled "stage_2" that is added as a child to "game_board" dynamically by AS3. "stage_2" contains a prebuilt board with different dynamic text fields on it. They all have instance names. For example "text_1". The original value of this

Flex - Custom Component - Percentage Width/Height

心不动则不痛 提交于 2019-12-22 08:26:13
问题 I am trying to create a Custom Flex Component using the Flex Component framework: http://www.adobe.com/livedocs/flex/3/html/help.html?content=ascomponents_advanced_3.html. All good components allow you to define their dimensions using percentage values using: MXML: TextInput width="100%" or Actionscript at runtime: textinp.percentWidth = 100; My question is how do you implement percentage width/height in the measure() method of your custom component? More specifically, these percentages are

Draw cubic bezier curves in Actionscript?

爷,独闯天下 提交于 2019-12-22 08:05:26
问题 What's the best way to draw cubic bezier curves programmatically in AS3? The Graphics class only seems to support quadratic curves. :( I want to be able to do something like: var startPoint:Point = new Point(0, 0); var endPoint:Point = new Point(5, 5); var control1:Point = new Point(5, 0); var control2:Point = new Point(0, 5); var myBezier:Sprite = getBezier(startPoint, control1, control2, endPoint); For a performance target, I'm planning on having ~50 of these on the stage at once. 回答1: Note

Local Timer Object Event Handler

允我心安 提交于 2019-12-22 07:07:47
问题 I have the following code in a class function : public function foo():void { var timer:Timer = new Timer(10000,1); timer.addEventListener(TimerEvent.TIMER_COMPLETE,onTimerComplete); timer.start(); } public function onTimerComplete(e:TimerEvent):void { // do stuff } The above code works most of the time but my concern is what happens if timer gets garbage collected? Is it possible that onTimerComplete will never fire because there are no other references to timer? I know timer has an internal

Local Timer Object Event Handler

荒凉一梦 提交于 2019-12-22 07:07:39
问题 I have the following code in a class function : public function foo():void { var timer:Timer = new Timer(10000,1); timer.addEventListener(TimerEvent.TIMER_COMPLETE,onTimerComplete); timer.start(); } public function onTimerComplete(e:TimerEvent):void { // do stuff } The above code works most of the time but my concern is what happens if timer gets garbage collected? Is it possible that onTimerComplete will never fire because there are no other references to timer? I know timer has an internal

Extracting “filename” from full path in actionscript 3

女生的网名这么多〃 提交于 2019-12-22 06:56:47
问题 Does AS3 have a built in class / function to extract "filename" from a complete path. e.g. I wish to extract " filename.doc " from full path "C:\Documents and Settings\All Users\Desktop\filename.doc" 回答1: For Air, you can try using File Class to extract file name var file:File=new File("path_string"); //path_string example "C:\\Windows\\myfile.txt" var filename:String = file.name; 回答2: First you want to find the last occurrence of / or \ in the path, do that using this: var fSlash: int =

building small GUI engine: visible vs. addChild/removeChild

蹲街弑〆低调 提交于 2019-12-22 06:48:50
问题 Currently, i'm experimenting with a very simple GUI drawing ... "engine" (i guess you could call it that). The gist of it: there is a FrontController that gets hit by user requests; each request has a uid each uid (read "page") has a declaration of the components ("modules") that are present on it components are Sprite subclasses and, in essence, are unique Naturally, i need a way of hiding/showing these sprites. Currently, i have it pretty much like Flex has it by default - in the way "if we

Get IP address using Action Script?

淺唱寂寞╮ 提交于 2019-12-22 06:31:45
问题 Is it possible to get client IP address through Flash (swf) Action Script 3 and then pass it to php file to store it in database? 回答1: No need to do it in flash, just do it on your server in php "$ip=@$REMOTE_ADDR;" 回答2: No, the client IP address is not available in ActionScript 3. The recommended approach is to have it reflected by server-side code. See http://www.actionscript.org/forums/showthread.php3?s=&threadid=20123 回答3: function GetUserIP() { var js="function get_userIP(){return java

Get IP address using Action Script?

可紊 提交于 2019-12-22 06:31:02
问题 Is it possible to get client IP address through Flash (swf) Action Script 3 and then pass it to php file to store it in database? 回答1: No need to do it in flash, just do it on your server in php "$ip=@$REMOTE_ADDR;" 回答2: No, the client IP address is not available in ActionScript 3. The recommended approach is to have it reflected by server-side code. See http://www.actionscript.org/forums/showthread.php3?s=&threadid=20123 回答3: function GetUserIP() { var js="function get_userIP(){return java

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

大兔子大兔子 提交于 2019-12-22 05:31:54
问题 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