actionscript

As3 printing problem, blanks swf after print or cancel

眉间皱痕 提交于 2019-11-29 16:49:10
ok back at another issues in as3 printing //Function to print entire screen function printFunction(event:MouseEvent):void { var myPrintJob:PrintJob = new PrintJob(); var oldScaleX:Number = root.scaleX; var oldScaleY:Number = root.scaleY; //Start the print job myPrintJob.start(); //Figure out the new scale var newScaleX:Number = myPrintJob.paperWidth/root.width; var newScaleY:Number = myPrintJob.paperHeight/root.height; //Shrink in both the X and Y directions by the same amount (keep the same ratio) if(newScaleX < newScaleY) newScaleY = newScaleX; else newScaleX = newScaleY; root.scaleX =

What is a RELIABLE way to detect a client's browser and its version number?

爱⌒轻易说出口 提交于 2019-11-29 16:44:14
What is a reliable way to detect someone's browser and its version number? From what I've seen, things like the navigator object in JavaScript simply do not work toward this end, and neither do a lot of these really hacked-together solutions I'm coming across. There are one or two currently functional JavaScript code snippets I've come across that'll tell me whether someone is using Firefox, Chrome, etc., but they don't describe the version number of each browser. How can this be found, and how can it be done reliably? (The front-ends are a couple of Flex applications.) EDIT This question has

Syntax Highlighting library in ActionScript

走远了吗. 提交于 2019-11-29 15:22:08
问题 I let user enter some code in my Flex3 (Flash 10) app and I want to do syntax highlighting. Is there any open-source library that would help me? I'll need a Lua syntax support, but I can add it myself if library has a resonable interface to do this. 回答1: Update on 21 Jan, 2009: Check out Anirudh's port of google-code-prettify to ActionScript3, it has a very good example app as well. 回答2: I guess this wasn't even feasible till now. With the new Flash Text Engine, maybe such text-based features

Vector.<> vs array

左心房为你撑大大i 提交于 2019-11-29 13:26:49
What are the pros and contras of using a Vector.<> instead of array ? From the adobe documentation page : As a result of its restrictions, a Vector has two primary benefits over an Array instance whose elements are all instances of a single class: Performance: array element access and iteration are much faster when using a Vector instance than when using an Array. Type safety: in strict mode the compiler can identify data type errors such as assigning a value of the incorrect data type to a Vector or expecting the wrong data type when reading a value from a Vector. Note, however, that when

Should I Abandon Adobe Flash for HTML5 and <canvas>?

孤者浪人 提交于 2019-11-29 12:25:59
问题 I'm currently looking into developing Facebook applications and was planning on using Flash as the basis of my application, I have test built some simple PHP Facebook applications and I know enough about action-script 3 to start me on my way, but the API for Facebook development in AS looks far more tedious than the PHP one. my question is would I be able to create interactive graphics (games) like we see across the web in the HTML5 canvas class? and which would be simpler? 回答1: HTML5 doesn't

Get and parse JSON in Actionscript

故事扮演 提交于 2019-11-29 10:40:34
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 want to get this data, parse out the relevant bits, and then display the parsed bits in the visualization

Get ExternalInterface definitions in Javascript

可紊 提交于 2019-11-29 09:08:48
问题 Is there a way to get a list of the exposed functions from a Flash object? For example, you could get a list of all methods in an object by executing: for (var i in object) { if (typeof object[i] == "function") { console.log(i); } } The only issue is that this won't expose any methods registered through the ExternalInterfaces API. I can try and see if the function exists ( object['method'] ) and it tells me it is a function, but I would have to guess every existing method in this manner. NOTE

Get size of ActionScript 3 Dictionary

时间秒杀一切 提交于 2019-11-29 09:04:01
var d:Dictionary = new Dictionary(); d["a"] = "b"; d["b"] = "z"; How to get the length/size of the dictionary (which is 2) ? There is no built-in method to get the size/lenght/count of an AS3 dictionary. There are workarounds: for example, you can create a custom dictionary class which extends or wraps the flash.utils.Dictionary class, adding the counter functionality. You can manage the count as entries are added/removed, or count on-demand using a simple For loop iteration: public static function countKeys(myDictionary:flash.utils.Dictionary):int { var n:int = 0; for (var key:* in

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

我的未来我决定 提交于 2019-11-29 08:48:12
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 ) 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 follows little endian order, so you need to be careful while reading the data. And mostly they will be

Flash connecting to a WCF service

梦想的初衷 提交于 2019-11-29 08:07:59
I would like ask for guidance on the proper endpoint configuration for my WCF service to enable a Flash app to consume it. Thanks, Keith Rull Well you should start with a webHttpBinding and naturally you need to apply the webHttp behavior as well. Then you just need to figure out what serialization format you want to work with. Flash can do JSON or XML, so you need to decide which you prefer and then you set the ReqeustFormat / ResponseFormat properties of the WebInvokeAttribute which are applied to your operations. 来源: https://stackoverflow.com/questions/1614157/flash-connecting-to-a-wcf