actionscript-3

Dispatch Paste Event in AS3

南笙酒味 提交于 2020-01-15 10:29:21
问题 This is my AS3 code for a textbox with an instance name of myTextBox placed on stage -: import flash.display.*; import flash.events.*; myTextBox.text = 'Hello India'; myTextBox.addEventListener(Event.PASTE, onPaste) function onPaste(e:Event):void { trace("lol"); } But when i paste some text into the text box, nothing happens. Can't figure out the issue. Thanks for help... 回答1: According to the documentation http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/Event

error #1009 addChld() as3 with loop

耗尽温柔 提交于 2020-01-15 10:14:28
问题 when i try to addChild my class it says "Cannot access a property or method of a null object reference. at class_obj() at Main()" error #1009 i need to know how to have a class that has a gameloop for testing things like collision and stuff please help! and if i dont have eventlistener enter frame on the object ir works but i need the listener for the loop. Main class package { import flash.display.MovieClip; import flash.events.Event; public class Main extends MovieClip { var mc:class_obj;

Using the Menu, Back, Home buttons with AIR for Android, Flash CS6

北慕城南 提交于 2020-01-15 07:53:06
问题 I am looking to utilize and/or disable the hard "Home", "Back", "Menu" and "Search" buttons that are present on most Android phones and honestly don't know where to start. Using Flash Professional CS6 AIR for Android. I apologize if this is already answered somewhere but I cannot find any information on how to do this. Thank you in advance for all the help. 回答1: Looks like you can stop the default behavior of the back, search, and menu soft keys but not Home: http://www.adobe.com/devnet/air

super() in Flash Builder. WHY?

孤街浪徒 提交于 2020-01-15 06:58:26
问题 Every time I start a new actionscript class in Flash Builder it starts off the constructor with a line super() I have never seen this before, and it seems to have no purpose. Deleting it results in the exact same movie. Why is it inserted into my new class and what does it do? 回答1: super() calls the constructor from the class that you're inheriting (extending). If your inherited (base) class has no required parameters in it's constructor, you can omit it all together and flash will

Decode amf3 object using PHP

可紊 提交于 2020-01-15 06:06:16
问题 My flash code: var request=new URLRequest('http://localhost/test.php'); request.method = URLRequestMethod.POST; var data = new URLVariables(); var bytes:ByteArray = new ByteArray(); bytes.objectEncoding = ObjectEncoding.AMF3; //write an object into the bytearray bytes.writeObject( { myString:"Hello World"} ); data.data = bytes; request.data = data; var urlLoader:URLLoader = new URLLoader(); urlLoader.dataFormat = URLLoaderDataFormat.BINARY; urlLoader.addEventListener(Event.COMPLETE,

Saving string to text file in AS3

让人想犯罪 __ 提交于 2020-01-15 05:46:39
问题 I have a function for writing String to a text file. It works, but for some reason (encoding?) it adds some weird data to the beginning of the file. Here is the relevant code: var file:File = new File(OUTPUT_FILE_NAME); var stream:FileStream = new FileStream(); stream.open(file, FileMode.WRITE); stream.writeUTF("Hello World!"); stream.close(); When I open the file in Notepad++, it shows this: What am I doing wrong? 回答1: use this stream.writeUTFBytes("Hello World"); instead of stream.writeUTF(

Saving string to text file in AS3

随声附和 提交于 2020-01-15 05:46:06
问题 I have a function for writing String to a text file. It works, but for some reason (encoding?) it adds some weird data to the beginning of the file. Here is the relevant code: var file:File = new File(OUTPUT_FILE_NAME); var stream:FileStream = new FileStream(); stream.open(file, FileMode.WRITE); stream.writeUTF("Hello World!"); stream.close(); When I open the file in Notepad++, it shows this: What am I doing wrong? 回答1: use this stream.writeUTFBytes("Hello World"); instead of stream.writeUTF(

Force Download with Flash AS3

无人久伴 提交于 2020-01-15 05:18:05
问题 i want to have force download functionality only with Flash AS3, is it possible ?? i tried google but failed. here it is my as3 code...... var file_URLRequest:URLRequest = new URLRequest ("mp3gallery/" + url); var content_header:URLRequestHeader = new URLRequestHeader("Content-Type: application/force-download"); var attach_header:URLRequestHeader = new URLRequestHeader("Content-Disposition: attachment; filename=abc.mp3"); file_URLRequest.requestHeaders.push(content_header); file_URLRequest

ActionScript: Multiple public functions in one .as file?

泄露秘密 提交于 2020-01-14 15:06:50
问题 As I've been working with AS I've developed a collection of utility functions. For example: $ cat utils/curried.as package utils { public function curried(f:Function, ...boundArgs):Function { function curriedHelper(...dynamicArgs):* { return f.apply(null, boundArgs.concat(dynamicArgs)); } return curriedHelper; } } And I've found that, some times, I want to keep more than one public function in each file... But ActionScript restricts me to one public definition per file, if that file defines

ActionScript: Multiple public functions in one .as file?

心已入冬 提交于 2020-01-14 15:06:13
问题 As I've been working with AS I've developed a collection of utility functions. For example: $ cat utils/curried.as package utils { public function curried(f:Function, ...boundArgs):Function { function curriedHelper(...dynamicArgs):* { return f.apply(null, boundArgs.concat(dynamicArgs)); } return curriedHelper; } } And I've found that, some times, I want to keep more than one public function in each file... But ActionScript restricts me to one public definition per file, if that file defines