actionscript-3

executing as3 code from a string

江枫思渺然 提交于 2021-01-29 02:55:42
问题 I'm working on a simple text rpg and I'm storing all of my data objects out as xml files but I need to be able to run some simple statements for many things. I have done some googling I havent come up with much. What I'm trying to do is take simple statements like: playerhp += 15; or if(playerisvampire == 1) {blah blah;} and embed them inside of the xml structure so that an item or conversation line can contain the checks and executable code leaving the rpg class as more of an interpreter and

executing as3 code from a string

别来无恙 提交于 2021-01-29 02:43:37
问题 I'm working on a simple text rpg and I'm storing all of my data objects out as xml files but I need to be able to run some simple statements for many things. I have done some googling I havent come up with much. What I'm trying to do is take simple statements like: playerhp += 15; or if(playerisvampire == 1) {blah blah;} and embed them inside of the xml structure so that an item or conversation line can contain the checks and executable code leaving the rpg class as more of an interpreter and

Get Object nested property using dot separated string

本小妞迷上赌 提交于 2021-01-28 14:24:50
问题 Is there in Flex any utility to get object nested property using dot separated string like this: SomeUtil.getObjectProperty(object, "child.property"); 回答1: You can roll your own, assuming object is a dynamic object : public function getObjectProperty(object:Object, property:String):Object { var parts:Array = property.split("."); if(parts && parts.length == 2 && object && object[parts[0]] && object[parts[0]][parts[1]]) { return object[parts[0]][parts[1]]; } return null; } Here is another one

Get Object nested property using dot separated string

久未见 提交于 2021-01-28 14:23:35
问题 Is there in Flex any utility to get object nested property using dot separated string like this: SomeUtil.getObjectProperty(object, "child.property"); 回答1: You can roll your own, assuming object is a dynamic object : public function getObjectProperty(object:Object, property:String):Object { var parts:Array = property.split("."); if(parts && parts.length == 2 && object && object[parts[0]] && object[parts[0]][parts[1]]) { return object[parts[0]][parts[1]]; } return null; } Here is another one

Does Flash pre-define any keyCode constants?

∥☆過路亽.° 提交于 2021-01-28 06:41:40
问题 I would have expected, given the way Adobe seems to do things, that you could reference some of the non-ASCII keycodes using a static constant, for example KeyCode.UP_KEY . Am I dreaming? Or do you just assume 38 will be the up key in perpetuity..? 回答1: I believe you are looking for the Keyboard class Keyboard.UP will refer to the up key, Keyboard.DOWN to the down key, and so on. See http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/ui/Keyboard.html for more key codes.

What's the difference between id and localId in Apache Royale?

扶醉桌前 提交于 2021-01-27 17:49:39
问题 In Apache Royale we can identify objects with " id " and " localId " properties. The problem is to know why we have two ways of doing the same apparently. 回答1: I found the Answer and sharing solution: HTML requires ID's that are unique, so by creating Royale components that internally use ID's to identify the inner sub-components this means the same ID will be used in all instances created and therefore generating a problem of lack of uniqueness . Solution : Use " localId " in the inner

Regex to search for 5 words before and after a given word

早过忘川 提交于 2021-01-01 06:39:55
问题 I need to write an AS3 program to search for a certain "keyword" in the rss of certain blogs. I've written logic using String.indexOf() but this is EXTREMELY slow, and not scalable. I've been looking to write a regular expression which looks for the keyword, but also returns 5 words before and after the keyword (to show the context of the search result). I suppose overlapping matches can be ignored. I've come up with (?:[a-zA-Z'-]+[^a-zA-Z'-]+){0,5}keyword(?:[^a-zA-Z'-]+[a-zA-Z'-]+){0,5} The

flash as3 check event listener

我的梦境 提交于 2020-12-29 12:13:51
问题 Is their a way to check if an event listener already exists to remove it? stage.addEventListener(MouseEvent.CLICK, clickdownfunction); Basically, I want to remove the listener, but sometimes it has already been removed, so I want to check if it exists and if it does, then remove it. Is this possible? 回答1: Check out the hasEventListener() function from https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/IEventDispatcher.html#hasEventListener() I am not really sure

flash as3 check event listener

≡放荡痞女 提交于 2020-12-29 12:05:39
问题 Is their a way to check if an event listener already exists to remove it? stage.addEventListener(MouseEvent.CLICK, clickdownfunction); Basically, I want to remove the listener, but sometimes it has already been removed, so I want to check if it exists and if it does, then remove it. Is this possible? 回答1: Check out the hasEventListener() function from https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/IEventDispatcher.html#hasEventListener() I am not really sure

Action Script - how to go to another scene from movieClip?

吃可爱长大的小学妹 提交于 2020-07-19 20:44:10
问题 I'm trying to go to another scene by clicking a button witch is placed in a mc and I got an error. This is my code below Play_btn.addEventListener(MouseEvent.CLICK,gotoScene2); function gotoScene2(evt:MouseEvent){ movClip.gotoAndPlay(1,"Scene 2"); } (this code is placed inside a movieClip witch is instantiated like "movClip", at frame 260 - may be this help to understand better). And this is the erorr i get: Symbol 'preloader26',Layer'Layer9',Frame 260,Line 4 1120:Access of undefined property