actionscript-3

Event Bubbling, and Stop Propagation

你离开我真会死。 提交于 2019-12-17 20:08:32
问题 What is the difference between event.bubbles to false for any event, and setting event.stopPropagation() or stopImmediatePropagation() while handling event? I'm using Flex4 with AS3. 回答1: Setting bubbles to false means the event does not bubble up the display list at all. stopPropagation() and stopImmediatePropagation() make the current event listener the last to process an event. The difference between stopPropagation() and stopImmediatePropagation() is that stopImmediatePropagation() will

AS3 - Clone an object

百般思念 提交于 2019-12-17 20:06:16
问题 I have a game with a variety of ship types. My Ship class has a static array holding one of each of the types in it. Whenever I make a new Ship (other than when initializing this array), I want to make it a clone of one of the existing Ship objects in my prototype array. 1 - How can I run through all the properties in one Ship object and assign them to a second Ship object? 2 - How can I see if a property is an object or a basic type like String or int ? Some of the objects in my Ship class

Flash parallel programming

这一生的挚爱 提交于 2019-12-17 19:54:39
问题 Since Flash doesn't support thread, how does it manage to deal with multiple animations ? Is it only internally that Flash uses threads but which are not accessible to the programmer ? How on the principle can you implement parallel tasks in flash like what's described here: http://books.google.fr/books?id=1OJ8EhvuPXAC&pg=PA352&lpg=PA352&dq=FLASH+PARALLEL+TASK&source=bl&ots=iTQIolYXCy&sig=edGCy1YYAZYJfxAMhrfUBkiggwo&hl=en&ei=94WgTfGWCMmxhAfgkNGQBQ&sa=X&oi=book_result&ct=result&resnum=1&ved

Can I use apply() with constructor to pass arbitrary number of parameters

寵の児 提交于 2019-12-17 19:44:40
问题 I've got a function wich can accept a varible number of parameter with a rest operator. I want create an object passing the argument collected with the rest operator directly to a constructor without create an object and call an initializing function and without passing the entire array but the parameters ah I do with apply() function. Is it possible ? Using apply doesn't work. public function myFunc(...arg) { // something link "new MyClass.apply(args)" return new MyClass(); } 回答1:

Actionscript - Obtain the name of the current function

∥☆過路亽.° 提交于 2019-12-17 19:18:46
问题 I want to get the name of a function from inside that function. e.g.: function blah() { //I want to get the string "blah" here, from the function's name } Or at least the Function object? 回答1: Use arguments.callee to get a reference to the current function. I you want to get the function name, it is a bit trickier: All functions are treated as method closures (pieces of code which can be passed around as an argument), so they do not own a reference to an enclosing class type, nor do they have

Howto embed images in Actionscript 3 / Flex 3 the right way?

时光总嘲笑我的痴心妄想 提交于 2019-12-17 18:37:48
问题 I'm creating a game where a lot of images are being used in Actionscript / Flex 3 (Flash). Now that I've reached the designer stage, I have to work out a structural way of using embedded images (which have to be manipulated with rotation, color, etc.). Unfortunately, after investigating a bit, it looks like you have to manually embed images before you can use them. I currently have it setup like this: Resource.as class file: package { public final class Resource { [Embed (source="/assets

How can I get list of properties in an object in Actionscript?

喜欢而已 提交于 2019-12-17 18:14:10
问题 I have a dataprovider and a filterfunction for my array that's assigned to my dataprovider. How can I get a list of the properties that are in each row of the dataprovider (item.data) as it gets passed to the filterfunction? For instance, if my object contained: Object name email address Then I would want, in my filterfunction to be able to look at name, email and address. Unfortunately, I don't know what these properties will be before hand. Any ideas? 回答1: If it's a dynamic object I believe

Suggestions for (semi) securing high-scores in Flash/PHP game

不羁岁月 提交于 2019-12-17 17:59:28
问题 ...I have read a few threads on here that have discussed various methods and was just looking for some feedback on a proposed solution we came up with. In one of the threads a comment was posted recommending a public/private key which sounded great, this is what we were thinking... Client Side - 1. Key is stored inside of Flash swf which is encrypted using 3rd party tool. 2. High score is hashed along with high-score value (EX: md5 ('ourSecretKey' + 200)) 3. This value is sent via AMF to a

How do I create a custom event class in Javascript?

混江龙づ霸主 提交于 2019-12-17 17:44:46
问题 How do I create a custom event class similar to ActionScript? What I mean by that is a class that I can use to fire off my own events, send the necessary data. I don't wanna use third-party libraries like YUI or jQuery to do it. My goal is to be able to send a event that looks like this. document.addEventListener("customEvent", eventHandler, false); function eventHandler(e){ alert(e.para1); } document.dispatchEvent(new CustomEvent("customEvent", para1, para2)); Please no third-party library

AS3 Vector of Arrays

五迷三道 提交于 2019-12-17 16:58:36
问题 Is there any performance benefit in storing Arrays in a Vector of type Array? e.g Option 1 private var _arrays:Vector.<Array> = new Vector.<Array>(2); _arrays[0] = new Array(10); _arrays[1] = new Array(10); Option 2 private var _arrays:Array = new Array(2); _arrays[0] = new Array(10); _arrays[1] = new Array(10); Also can I have a Vector or Vectors? private var _vectors:Vector.<Vector> = new Vector.<Vector>(2); _vectors[0] = new Vector.<String>(10); _vectors[1] = new Vector.<String>(10);