actionscript

Why when I Update a 2 dimensional Array it give an “Error #1010”

久未见 提交于 2019-12-18 09:39:44
问题 In my programming class, I need to create a Tiles game with AS3 (like zelda). On a map, the tiles are initialised black in an array and, after that, they are changing randomly each time the leftpick of a song reach a certain value. When the tiles change, I need to update the Array with the new value. Actually, I always get an Error #1010: A term is undefined and has no properties. This is how the tiles are initialised: variable private var grid: MovieClip; private var nbRow: int = 6; private

calling a Flash ExternalInterface with JavaScript

空扰寡人 提交于 2019-12-18 09:22:24
问题 I'm trying to call a function declared with ExternalInterface in a Flash swf, using JavaScript. It worked once, but all of a sudden, it stopped working. I have a debug version of the Flash Player, but no errors occur in Flash. Not even a "Security Sandbox Error" or something. The only error I get is the following error in JavaScript Error: Error in Actionscript. Use a try/catch block to find error. I'm using AS3, exporting for Flash Player 10 and testing on Firefox 3/Safari 4, on a Mac. Any

can an actionscript function find out its own name?

Deadly 提交于 2019-12-18 03:35:43
问题 given the following function A(b:Function) { } If function A(), can we determine the name of the function being passed in as parameter 'b' ? Does the answer differ for AS2 and AS3 ? 回答1: I use the following: private function getFunctionName(e:Error):String { var stackTrace:String = e.getStackTrace(); // entire stack trace var startIndex:int = stackTrace.indexOf("at ");// start of first line var endIndex:int = stackTrace.indexOf("()"); // end of function name return stackTrace.substring

can an actionscript function find out its own name?

冷暖自知 提交于 2019-12-18 03:34:04
问题 given the following function A(b:Function) { } If function A(), can we determine the name of the function being passed in as parameter 'b' ? Does the answer differ for AS2 and AS3 ? 回答1: I use the following: private function getFunctionName(e:Error):String { var stackTrace:String = e.getStackTrace(); // entire stack trace var startIndex:int = stackTrace.indexOf("at ");// start of first line var endIndex:int = stackTrace.indexOf("()"); // end of function name return stackTrace.substring

Is it possible to create a 'command line' swf?

China☆狼群 提交于 2019-12-18 03:23:30
问题 I'd like to be able to write a .swf file that is runnable as a command line app. In other words, I would be able to create actionscript classes which can interact with stdin and stdout, and could then execute that .swf directly in the command line. I suspect that this isn't really possible. Can anyone confirm that? EDIT: A couple of the answers pointed out that using Flash for command line work probably isn't the best choice. I wholeheartedly agree in most situations. The reason I am asking

Flex: Render an unrealized UIComponent to BitmapData?

点点圈 提交于 2019-12-18 02:55:07
问题 What is the best way to render to a UIComponent which hasn't been added to the stage? (I'm using UIComponents as renderers for objects, and want to render new copies for image export, filtering, etc.) Two strategies I've seen/used so far include realizing the component to ensure it calls all the lifecycle methods: Add the component to Application.application , render with BitmapData.draw(), remove component. This is similar to what I've seen done for printing unrealized components as well.

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

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

Flash AS3 Global Variables?

耗尽温柔 提交于 2019-12-17 14:54:05
问题 HI i have a main class //main.as package { public class main { public var testGlobal:string = "testValue"; } } //pop.as package { public class pop { function pop():void { trace("testGloabl from main.as" + testGlobal); } } } How can i get the testGlobal value on pop.as width out using a main class Object. Is there any method of Global variables?? How to use global variables in AS3 . 回答1: If you absolutely positively have to have a global variable in as3, you could always create a file in the

Flex's FileReference.save() can only be called in a user event handler — how can I get around this?

非 Y 不嫁゛ 提交于 2019-12-17 10:59:22
问题 I need to call FileReference.save() after a web service call has completed, but this method has a restriction: "In Flash Player, you can only call this method successfully in response to a user event (for example, in an event handler for a mouse click or keypress event). Otherwise, calling this method results in Flash Player throwing an Error exception." (from the documentation here) This restriction is a bit vague. Does it mean that I can only call the FileReference.save() method from within