actionscript-3

Flex: How to call an actionscript function from htmlText anchor

元气小坏坏 提交于 2020-01-02 08:39:08
问题 Is there any way to call an action script function from an anchor which defined in TextArea component's htmlText property. Thank you 回答1: If this anchor is an href from an tag, you can dispatch events and handle them like that: <mx:Script> <![CDATA[ private function linkHandler(e:TextEvent):void { if (e.text == "test") trace("test called") } ]]> </mx:Script> <mx:creationComplete> <![CDATA[ textArea.htmlText="<a href='event:test'>Link!</a>"; ]]> </mx:creationComplete> <mx:TextArea id="textArea

atom feed xmlns attribute messes up AS3's XML-parsing?

纵然是瞬间 提交于 2020-01-02 08:34:44
问题 Wanna see something interesting? var xml:XML = XML(<feed><entry /><entry /><entry /></feed>); trace(xml.entry.length()) // returns 3 Makes sense, right? Now let's add this attribute... var xml:XML = XML(<feed xmlns="http://www.w3.org/2005/Atom"><entry /><entry /><entry /></feed>); trace(xml.entry.length()) // returns 0 Well that can't be right. Let's try it with a different attribute. var xml:XML = XML(<feed test="okay"><entry /><entry /><entry /></feed>); trace(xml.entry.length()) // returns

Having trouble with insertChildBefore and insertChildAfter in AS3

大兔子大兔子 提交于 2020-01-02 07:33:19
问题 I have an XML document: var xml:XML = new XML(<rootNode> <head> <meta name="template" content="Default" /> </head> <mainSection> <itemList> <item> <video src={this.videoURL} /> <img src={this.src}></img> </item> </itemList> </mainSection> </rootNode>); What I'd like to do, is when certain conditions are me, insert another at the beginning of itemList. var newNode:XMLList = new XMLList("<item><video src=\"" + _videoSource + "\"></video></item>"); I'm able to generate and trace newNode just

Text links in Flash AS3

天涯浪子 提交于 2020-01-02 07:28:39
问题 So I've taken it upon myself to make a 'wiki'-esque application for some friends that works over Dropbox, which means that all the files are stored locally and updated by everyone. Every file is a .txt pulled in by the flash and then displayed using a simple navigation and search tool. Now I am trying to take this a step further and link articles from their content. Example: Article 1 is called 'Apples'. Its content: 'Apples are delicious.' Article 2 is called 'Bears'. Its content: 'Bears

Record h.264 video in Flash without streaming server?

无人久伴 提交于 2020-01-02 06:44:19
问题 Is it at all possible to save h.264 video from the Flash/Actionscript Camera (i.e. webcam) without needing a streaming server (like fms/wowza/red5)? Where I'm also going with this is, I'd like to take the sampleData from Microphone, and transcode it client-side so that a user can record h.264/aac (or mp3) and store it locally or remotely for easy viewing in a mp4 container.... Any tips before I re-invent the wheel or run into a roadblock? 回答1: Adobe made sure that you need a streaming server

How to connect and send data to Bluetooth form AS3?

a 夏天 提交于 2020-01-02 06:16:08
问题 I need to connect and send data to Bluetooth from Action Script 3 (AS3) if there is any idea I'll be glad for your help Thanks in advance , 回答1: Nice question! Wiimotes connect/send data through bluetooth. I had a quick look through the WiiFlashServer java source. It uses a ServerSocket and it seems to send binary data to flash via the Socket class. You could either adapt some of that code to suit your needs, or build a Socket server in your language of choice and send the data to flash

How to connect and send data to Bluetooth form AS3?

眉间皱痕 提交于 2020-01-02 06:15:33
问题 I need to connect and send data to Bluetooth from Action Script 3 (AS3) if there is any idea I'll be glad for your help Thanks in advance , 回答1: Nice question! Wiimotes connect/send data through bluetooth. I had a quick look through the WiiFlashServer java source. It uses a ServerSocket and it seems to send binary data to flash via the Socket class. You could either adapt some of that code to suit your needs, or build a Socket server in your language of choice and send the data to flash

AS3 Function to start download after clicking a button!

孤街醉人 提交于 2020-01-02 06:10:12
问题 I need an actionscript 3 function for my website, that lets people download a document after they have clicked on a button. Couldn't find this anywhere on the net. Thanks! Jennifer 回答1: FileReference::download() btn.addEventListener(MouseEvent.CLICK, promptDownload); private function promptDownload(e:MouseEvent):void { req = new URLRequest("http://example.com/remotefile.doc"); file = new FileReference(); file.addEventListener(Event.COMPLETE, completeHandler); file.addEventListener(Event

Dynamically instantiate a typed Vector from function argument?

我与影子孤独终老i 提交于 2020-01-02 04:10:08
问题 For a game I'm attempting to develop, I am writing a resource pool class in order to recycle objects without calling the "new" operator. I would like to be able to specify the size of the pool, and I would like it to be strongly typed. Because of these considerations, I think that a Vector would be my best choice. However, as Vector is a final class, I can't extend it. So, I figured I'd use composition instead of inheritance, in this case. The problem I'm seeing is this - I want to

How to sort an ArrayCollection in Flex

戏子无情 提交于 2020-01-02 03:53:06
问题 I want to sort an Arraycollection by fieldName as ascending. Here's my code and I want to know whether it's right. Do you have any suggestions? public static function arrayCollectionSort(ar:ArrayCollection, fieldName:String, isNumeric:Boolean):void {var dataSortField:SortField = new SortField(); dataSortField.name = fieldName; dataSortField.numeric = isNumeric; var numericDataSort:Sort = new Sort(); numericDataSort.fields = [dataSortField]; arrCol.sort = numericDataSort; arrCol.refresh();}