as3

AS3中 is,as,typeof的区别 .

瘦欲@ 提交于 2019-12-05 07:39:24
AS3中 is,as,typeof的区别 . var my_num:Number=9; trace(typeof my_num); var my_object:Array=["语文","数学","英语"]; trace(my_object is Array); trace(my_object as Array) //typeof 是用字符串形式返回对象的类型. //is 用于判断一个对象是否属于一种类型. //as 与is格式一致,但内容不同,如果一个对象属于一种类型.那么as返回这个对象,否则返回null. 来源: https://www.cnblogs.com/fengziwu/p/11914470.html

AS3 BitmapData to byteArray

匿名 (未验证) 提交于 2019-12-03 10:24:21
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to serialize a Bitmap to store in an XML file. My plan is to turn the BitmapData into a byteArray, but I haven't been able to fine an example of this. Other suggestions are also welcome. 回答1: The process should be: BitmapData > ByteArray > Base64 > XML Use the BitmapData getPixels() method to get a ByteArray of the pixels. Then you can use something like Hurlant's Base64 encoder to convert it to base 64. Then going the other way, "unbase64" it, then use BitmapData's setPixels to load it. 文章来源: AS3 BitmapData to byteArray

AS3: access variable when writing XML code directly in AS3

匿名 (未验证) 提交于 2019-12-03 09:06:55
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: how can I access the value of a variable when writing XML code in AS3? something like this: var myVar:Number = 3; var xml:XML = <myXML> <valueOfMyVar>???</valueOfMyVar> </myXML> what do I have to replace ??? with? 回答1: ActionScript 3.0 now treats XML as a native data type meaning its no longer parsed as a String. That does bring with it that the old methods of inserting variable values (e.g. “”+myValue+””) no longer apply. Just take a look at the following snippet of code: var myVar:Number = 3; var xml:XML = <myXML> <valueOfMyVar>{myVar}<

as3 - dispatchEvent from a parent swf to a child swf

匿名 (未验证) 提交于 2019-12-03 08:52:47
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have one main "parent" swf that loads several other swfs. If something happens in the main swf I need to tell one of the child swfs about it. This seems to work well the other way around. Any of the children can simply dispatchEvent(), and I can set up the main swf to listen for the event. However, I can't get the child swf to catch any events dispatched by the parent. How is it done? 回答1: OK, so if you know most of this already, my apologies... but it seems a pretty common issue and isn't immediately obvious. In AS3 events dispatched by

RegEx to modify urls in htmlText as3

匿名 (未验证) 提交于 2019-12-03 08:30:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have some html text that I set into a TextField in flash. I want to highlight links ( either in a different colour, either just by using underline and make sure the link target is set to "_blank". I am really bad at RegEx. I found a handy expression on RegExr : </?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)/?> but I couldn't use it. What I will be dealing with is this: <a href="http://randomwebsite.web" /> I will need to do a String.replace() to get something like this: <u><a href="http://randomwebsite.web" target="_blank"/><

AS3 - Access iPhone music library and return references to mp3(s)

匿名 (未验证) 提交于 2019-12-03 07:50:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I was just wondering if anyone had any ideas on how to read the music library on an iPhone from an AS3 Air application? Would it require an Adobe Native Extension, or is there a easier way to achieve this? Ideally what I'd like to do is just popup the phone's music player, to allow users to pick either a track, album or playist, and then return those songs to my app to add to my own playlist. (Also, possibly a separate question entirely, I will need to do this for Android, Windows and Mac too, if anyone has any useful tips on the most

Flex/AS3 Drag Drop - Custom Drop Feedback

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using a HorizontalList component to display a list of images, you can drag images from another component to join the list, this all works fine. If I do list.showDropFeedback(event) I get an unsightly black bar at the top of images in the HorizontalList - what I really want is a line to the left/right of the image, where the new one will actually sit. I guess I need to define a custom DropFeedback to override the default. Does anyone know if there there is a way to achieve this? Thanks! 回答1: Yuo can sove it by overriding showDropFeedback

AS3 tile map rendering (with 1000&#039;s of tiles)

匿名 (未验证) 提交于 2019-12-03 02:59:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Just first off I'll say that the context here is Actionscript 3.0 (IDE: Flashbuilder) along with the Starling Framework . So, I want to create a Tile Map that could be used for a platformer or something similar. I want to use 8x8 pixel tiles on an 800x600 pixel stage, and the problem I am having is that I don't know how to add these 7500+ tile objects to the stage without dramatically reducing the framerate. I've found that the drop in performance comes from adding each tile to the stage, not from initializing each Tile object. I know I'm

AS3 - Abstract Classes

匿名 (未验证) 提交于 2019-12-03 02:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How can I make an abstract class in AS3 nicely? I've tried this: public class AnAbstractClass { public function toBeImplemented():void { throw new NotImplementedError(); // I've created this error } } public class AnConcreteClass extends AnAbstractClass { override public function toBeImplemented():void { // implementation... } } But.. I don't like this way. And doesn't have compile time errors. 回答1: abstract classes are not supported by actionscript 3. see http://joshblog.net/2007/08/19/enforcing-abstract-classes-at-runtime-in-actionscript-3

AS3 [Event(name=“”, type=“”)], what is the significance?

匿名 (未验证) 提交于 2019-12-03 02:51:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I develop with FlashDevelop3 R2 and the Flex 3.3 SDK and there are many occasions where I must use the embed metadata tag as such: [Embed(source="path/to/file")] private var Asset:Class; I understand the above all well and good, and I am thankful it exists because I do not like to open the flash IDE too often. When I am going through other authors classes lately, I have found an interesting metadata tag that I do not understand: [Event(name="", type="")] I have yet to see a situation where I require this, and furthermore I really just do not