as3

AS3 Object To JSON

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to convert an array of objects (nested) to JSON string. Here is my JSON output: [{ "Width": 570, "SessionID": 2003404006158805, "Price": "69,90", "PageCount": 24, "Pages": [{ "ID": 1, "TemplateID": 0, "PageType": "cover", "TextContainers": [], "ImageContainers": [] }, { "ID": 2, "TemplateID": 1001, "PageType": "single", "TextContainers": [], "ImageContainers": [] }, { "ID": 3, "TemplateID": 0, "PageType": "double", "TextContainers": [], "ImageContainers": [{ "Width": 570, "IsBG": true, "Brightness": 0, "Contrast": 0, "PosX": null,

AS3 - gotoAndStop with immediate action

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm moving from AS2 to AS3 and probably as many ppl before found this incompatibility: I used quite often code like: gotoAndStop(5); trace(box); //where box is a movie on 5th frame What is the easiest way how to do it in AS3. 回答1: There is an easy way to solve this, but it is undocumented: addFrameScript(1, update); gotoAndStop(2); function update() { trace(box); // outputs [object MovieClip] } Please note that the first argument for addFrameScript is the frame number but it's 0-based, i.e. 0 is frame 1, 1 is frame 2, etc... The second

AS3 Passing and getting data to ASP

匿名 (未验证) 提交于 2019-12-03 02:13:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've been researching for days on the issude but till now I still haven found a solution yet. I have 0 knowledge on ASP. And I just want to able to pass and get var/text from ASP. Anyone kind enuff to guide me how I can furthur from here? private function loadASP():void { var aspSend:URLRequest=new URLRequest("testASP.asp"); var aspLoader:URLLoader = new URLLoader(); aspLoader.load(aspSend); trace("did send"); //aspLoader.addEventListener(Event.COMPLETE, processASP); } private function processASP(e:Event):void { } 回答1: Why have you commented

as3 updateAfterEvent的作用

我与影子孤独终老i 提交于 2019-12-03 02:08:24
转载链接:https://blog.csdn.net/cruelchen/article/details/9308989 flash中一共有三个类具有该属性,这三个类分别是:KeyboardEvent,MouseEvent,TimerEvent。调用updateAfterEvent 属性的事件,可强制立即执行呈现操作,而不是等到呈现阶段。但是,如果 updateAfterEvent 频繁导致性能问题,应避免使用它。 1.updateAfterEvent怎么用? 有很多人做鼠标追随效果的时候,总是发现鼠标移动不流畅,不知该如何解决。 其实方法很简单,你只需要加上一句updateAfterEvent()就ok了。 2.先来看看帮助中是怎么解释as3的updateAfterEvent的: 在 onClipEvent() 处理函数内调用updateAfterEvent函数时,或将其作为传递给 setInterval() 的函数或方法的一部分进行调用时,将更新显示(与为影片设置的每秒帧数无关)。如果对 updateAfterEvent 的调用不在 onClipEvent() 处理函数内,也不是传递给 setInterval() 的函数或方法的一部分,则 Flash 将忽略该调用。此函数只对某些 Mouse 和 MovieClip 处理函数起作用:Mouse 类的 mouseDown

AS3 How to startdrag only on x-axis?

匿名 (未验证) 提交于 2019-12-03 02:03:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a red square that I want to drag only on the x-axis. I've worked out a simple script, which theoretically should work, but it's not behaving properly. It's a bit hard to explain..the square keeps starting at the wrong position and the stage position seems to be changing so sometimes you can't drag the square all the way to the right... red . buttonMode = true ; red . addEventListener ( MouseEvent . MOUSE_DOWN , dragHandler ); function dragHandler ( e : MouseEvent ): void { var ypos : Number = e . currentTarget . y ; var xpos

AS3 using Workers

匿名 (未验证) 提交于 2019-12-03 01:45:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: IDE: FLASH CS6 Professional SDK: AIR 18 for Android I'm trying to use Workers for my app. The problem is, it doesn't work that it suppose to be. public class Main extends Sprite { private var worker:Worker; public function Main() { var ba:ByteArray = this.loaderInfo.bytes; if(Worker.current.isPrimordial){ worker = WorkerDomain.current.createWorker(ba); worker.start(); trace("Created Main"); }else{ trace("Created Worker"); } } } It should output Created Main Created Worker but i'm only getting [SWF] Test.swf - 2831 bytes after decompression

Error 1009 in AS3

匿名 (未验证) 提交于 2019-12-03 01:33:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have TextField instance called inputWord which contains no text on the first frame. On the same frame, on the actions layer, any time when I refer to inputWord in any way, there is an error: TypeError: Error #1009: Cannot access a property or method of a null object reference. at DC/frame1()[DC::frame1:19] //DC is the name of document class that I created. at flash.display::MovieClip/gotoAndStop() at DC()[C:\Users\nikkka\Desktop\flash\DC.as:25] 19 is the number of line where my code that involves inputWord is located. It works, I mean I

Flash AS3 calling a function from a class within a seperate class

匿名 (未验证) 提交于 2019-12-03 01:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've been searching around trying to work this out for a while now. There's been various ideas popping up, like dispatchEvent etc but nothing that seems to be a clear, simple way of doing this. What I'm trying to do is call a function from a class seperate (but in the same folder as) my document class. Specifically, I want to 'spawn' an object and run a function within that object's class from my Main.as. The snippet I have at the moment is as follows; In Main.as: var object:class_Object = new class_Object(); object.spawn(); addChild(object)

How can I use XPath with AS3 and get a result that still reffereced to the XMLDocument object?

匿名 (未验证) 提交于 2019-12-03 01:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm parsing a XML string into XMLDocument object. I want to search for a specific node using XPath technology by using XPathQuery.execQuery() - this function returns new XML object which means I need to convert it to a different XMLDocument object and lose the reference, how can I do that without loosing the reference? I'm using this XPath library of AS3. 回答1: Amarghosh has a good point. why aren't you using e4x ? here is the livedocs documentation for it http://livedocs.adobe.com/flex/3/html/help.html?content=13_Working_with_XML_01.html

AS3: How to convert a Vector to an Array

匿名 (未验证) 提交于 2019-12-03 00:46:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: What's the nicest way to convert a Vector to an Array in Actionscript3? The normal casting syntax doesn't work: var myVector:Vector. = new Vector(); var myArray:Array = Array(myVector); // calls the top-level function Array() due to the existance of the Array function. The above results in an array, but it's an array with a single element consisting of the original Vector. Which leaves the slightly more verbose: var myArray:Array = new Array(); for each (var elem:Foo in myVector) { myArray.push(elem); } which is fine, I guess, though a bit