actionscript-3

AS3 knowing how many arguments a function takes

五迷三道 提交于 2020-01-11 06:10:28
问题 Is there a way to know how many arguments an instance of Function can take in Flash? It would also be very useful to know if these arguments are optional or not. For example : public function foo() : void //would have 0 arguments public function bar(arg1 : Boolean, arg2 : int) : void //would have 2 arguments public function jad(arg1 : Boolean, arg2 : int = 0) : void //would have 2 arguments with 1 being optional Thanks 回答1: Yes there is: use the Function.length property. I just checked the

maximum size of a sprite in as3?

*爱你&永不变心* 提交于 2020-01-11 04:13:12
问题 Is there an upper bound to the size of a sprite in as3 / flash 10? I know bitmapData has limitations... 回答1: it seems, that xScale and yScale may not exceed 0x8000 ... size itself also seems to be bound ... i found a limit 0x6666660 ... here the code: package { import flash.display.*; public class Main extends Sprite { public function Main():void { var size:Number = 1; var s:Shape = new Shape(); s.graphics.beginFill(0xFF00FF); s.graphics.drawRect(0, 0, size, size); var old:Number = 0; while

actionscript 3 and JSON

 ̄綄美尐妖づ 提交于 2020-01-11 00:46:18
问题 I've been trying to get JSON working with AS3 for a while now, but to no avail. I keep getting the following error when I get the JSON back: TypeError: Error #1034: Type Coercion failed: cannot convert Object@26331c41 to Array. I've tried changing the datatype of the variable "jsonData" to object, which fixes the error, but I'm not entirely sure how I can parse the data. package { import flash.display.Sprite; import flash.net.URLRequest; import flash.net.URLLoader; import flash.events.*;

is it possible to value store cookies in Flash or Flex?

蹲街弑〆低调 提交于 2020-01-10 20:01:12
问题 In PHP there is a setcookie function based to store it. In Flash is it possible ?. If it is possible then how? I want to store value. 回答1: First off: PHP runs on the server and therefore can send the necessary HTTP header to set a cookie, Flash runs in the client's browser and thus can not do the same. However, there is a way to access and store cookies from flash/flex by using the flash.external.ExternalInterface and calling JavaScript functions to get and set cookies. I've developed a class

.NET and AMF

大兔子大兔子 提交于 2020-01-10 19:55:08
问题 How can I get a ASP.NET (inc MVC) application talking to a Flex UI over AMF. I am wanting to push approx 100+ records around at a time and AMF would appear to be the way forward, but there doesn't appear to be anything obvious. 回答1: If you're pressed for time, you can just use the RemoteObject to hit a compiled DLL (like WebORB - its free for .NET, but you need a VS copy above Express to compile your classes that you want to expose to Flex) and Retrieve the object that way... Obviously your

How to play sound from library in AS3?

孤人 提交于 2020-01-10 19:33:24
问题 In Flash 10/AS3, I added some sound and it seems to be working alright, but I think I'm doing it wrong. I imported the sound into the library, but I believe that it's reloading it from the folder with the swf/sound. I'm loading them like so: var request1:URLRequest = new URLRequest("CLICK8C.mp3"); clickSound = new Sound(); clickSound.addEventListener(Event.COMPLETE, completeHandler); clickSound.load(request1); Is there a way to get it to just load it from the library? 回答1: You need to make

How to play sound from library in AS3?

时间秒杀一切 提交于 2020-01-10 19:32:11
问题 In Flash 10/AS3, I added some sound and it seems to be working alright, but I think I'm doing it wrong. I imported the sound into the library, but I believe that it's reloading it from the folder with the swf/sound. I'm loading them like so: var request1:URLRequest = new URLRequest("CLICK8C.mp3"); clickSound = new Sound(); clickSound.addEventListener(Event.COMPLETE, completeHandler); clickSound.load(request1); Is there a way to get it to just load it from the library? 回答1: You need to make

stopping on the last frame (flash)

安稳与你 提交于 2020-01-10 02:59:32
问题 I want my movieclip to play once and stop on the last frame. I use the following code in the loop of my movieclip class. (this is as3) if(currentFrame == 120) stop(); 120 is the last frame. It plays once. but the problem is it goes back to frame 1 again. is there a better method of stopping a movieclip on a particular frame. 回答1: If you want to do it with actionscript and not add a stop() to the last frame on the timeline manually, then you can use the undocumented addFrameScript() method. mc

Changing fill color of MovieClip Actionscript 3

﹥>﹥吖頭↗ 提交于 2020-01-09 10:28:50
问题 i want to ask, how to change only fill color of an instance on the stage - i can do it by using ColorTransform object, but it changes color of the whole instance, not just the fill. I want to change only the fill color, not the stroke color. can anybody help me? this is my code: function paint(){ var myColorTransform:ColorTransform = new ColorTransform(); myColorTransform.color = someColorNumber; coloredObject.transform.colorTransform = myColorTransform; } 回答1: This cant be done once you've

as3 how to change a number by a class?

拜拜、爱过 提交于 2020-01-07 09:20:35
问题 The following code isn't working: package { public class num { public function num() { } public function numto(num1:Number) { num1 = 47; } } } when I use in my main timeline: import num; var n:Number = 17; numto(n); trace(n); // must be 47 instead of 17 It gives me different error messages such as: access of undefined property numto; 回答1: You should try to learn basics of Actionscript language. Read some general books, it will help you to understand what is going on. As to your question