actionscript

AS3 Instantiate Class From External SWF

故事扮演 提交于 2019-12-29 07:52:20
问题 I was chatting with my buddy about this, he is convinced you can do this and says he has done it, but I cannot get this to work. I am wondering if it is even possible at all. I tried typing a var as a Class that is within the externally downloaded SWF and then making an instance but no can do. some code private static function onCompleteHandler(e:Event) { dashboardObject = e.target.content; // registerClassAlias("Dashboard", ); doesnt work var dash:Class = getDefinitionByName("Dashboard") as

Get and parse JSON in Actionscript

心不动则不痛 提交于 2019-12-29 07:42:29
问题 What I want to do is make a get request to this URL: http://api.beatport.com/catalog/3/most-popular, which should return some JSON and then parse out certain information from it. How would I go about doing this in Actionscript 3? I'm more concerned with figuring out how to get the data to feed to a JSON parser rather than parsing the JSON, since there seem to be plenty of questions about parsing JSON. The reason I want to do this in AS3 is that I have a 3D flash visualization set up and I

How can I get the background color of a loaded swf file?

£可爱£侵袭症+ 提交于 2019-12-29 07:22:10
问题 I'm loading an swf file into my main application using URLLoader, I want to get the background color of the loaded swf file. ( I heard that one solution wold be reading the byte code of the loaded swf ) 回答1: Yes, You need to look into binary swf data. Here is brief description of swf format. And this is a little detail about different kind of tags. Your requirement is to find out SetBackgroundColor tag(tag type = 9), which commonly is either first or second tag of the swf. Bytes in swf file

How can I get the background color of a loaded swf file?

笑着哭i 提交于 2019-12-29 07:21:31
问题 I'm loading an swf file into my main application using URLLoader, I want to get the background color of the loaded swf file. ( I heard that one solution wold be reading the byte code of the loaded swf ) 回答1: Yes, You need to look into binary swf data. Here is brief description of swf format. And this is a little detail about different kind of tags. Your requirement is to find out SetBackgroundColor tag(tag type = 9), which commonly is either first or second tag of the swf. Bytes in swf file

Fast or asynchronous AS3 JPEG encoding

天涯浪子 提交于 2019-12-29 07:05:31
问题 I'm currently using the JPGEncoder from the AS3 core lib to encode a bitmap to JPEG var enc:JPGEncoder = new JPGEncoder(90); var jpg:ByteArray = enc.encode(bitmap); Because the bitmap is rather large (3000 x 2000) the encoding takes a long while (about 20 seconds), causing the application to seemingly freeze while encoding. To solve this, I need either: An asynchronous encoder so I can keep updating the screen (with a progress bar or something) while encoding An alternative encoder which is

Sending HTTP request with multiple parameters having same name

痞子三分冷 提交于 2019-12-29 06:54:08
问题 I need to send a HTTP request (and get XML response) from Flash that looks similar to following: http://example.com/somepath?data=1&data=2&data=3 I.e. having several parameters that share same name, but have different values. Until now I used following code to make HTTP requests: var resp:XML = new XML(); resp.onLoad = function(success:Boolean) {/*...*/}; resp.ignoreWhite = true; var req:LoadVars = new LoadVars(); req["someParam1"] = 3; req["someParam2"] = 12; req.sendAndLoad("http://example

How do you load a bitmap file into a BitmapData object?

谁说我不能喝 提交于 2019-12-29 05:08:49
问题 In Flash, the BitmapData object can be used to store bitmaps in RAM, you can later draw them to a MovieClip using the beginBitmapFill() method. How do you load an external bitmap file (.jpg) into a BitmapData object? Even AS3 code would be helpful. 回答1: AS3 code to load a PNG and "get" its bitmapData var bitmapData:BitmapData; var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete); loader.load(new URLRequest("../lib/img.png")); function

POST Login with ActionScript 2.0

寵の児 提交于 2019-12-29 02:09:16
问题 I have created a pretty basic Flash website for a client and am having an issue programming a Client Login feature that he would like. Currently, if I navigate to the site and click Client Login, it takes me to a login page. The way I need this to work is -- within the Flash, using ActionScript 2.0 -- have the user enter their UserID and Password and click to login, which submits POST vars to the form action of the Client Login website. Is this possible/legal to do from a different domain?

How to decode Json using native JSON or actionjson in Flex 3

痞子三分冷 提交于 2019-12-28 12:45:22
问题 I have the below Json (wf.json) { "workflow":{ "template":"Analysis1", "start":{ "instance":"HDA_run1", "user":"symtest", "date":"3-Mar-2012", "timestamp":"1330948220475" }, "host":{ "name":"bartla", "user":"symtest1", "password":"symtest1", "installpath":"", "product":"" }, "javadump":{ "pid":"8989", "corefilename":"", "heapdump":"", "stack":"", "JAVA_HOME":"" }, "mat":{ }, "email":{ "to":"ars@gmail.com", "subject":"", "message":"" }, "end":{ } } } As you can see there are 7 items (or sub

Download a file with Adobe AIR

元气小坏坏 提交于 2019-12-28 05:34:52
问题 How do I download a file from the internet in a Flex based AIR application. I tried using a file with url set to the address, but I got a file does not exist error when I tried to save it. And it is really hard to google for help on this issue. 回答1: You want to choose from 2 api combos to accomplish this. Version 1 is URLLoader and FileStream Using this combination of class, you would load the file from your server in to air via the URLLoader object. This will download the file in to memory