actionscript-3

How to solve “Native methods are not allowed in loaded code” error

北城以北 提交于 2019-12-24 10:47:54
问题 I want to let my app to run sound while the playbook in standby mode, I put this statement in the start up QNXSystem.system.inactivePowerMode = QNXSystemPowerMode.THROTTLED; Now when I debug the app on the simulator (not desktop debugger) I got this error VerifyError: Error #1079: Native methods are not allowed in loaded code. And this error I got also when using AlertDialog. Note: I am using Flash builder, and I have put the qnx SWC in the libraries path. .... so to solve these problems? 回答1

Generate random postive/negative Number

喜你入骨 提交于 2019-12-24 10:42:01
问题 How do you generate a Number that is randomly postive or negative? 回答1: Provide your low and high numbers as parameters to this function function randomNumber(low:Number=0, high:Number=1):Number { return Math.floor(Math.random() * (1+high-low)) + low; } 回答2: Generate a random number in the range [0, n] and subtract n/2. 回答3: private function randomize( amount:Number ):Number { return ( ( Math.random() - .5 ) * 2 ) * amount; } 回答4: var no1:Number; var no2:Number; no1 = Math.random() - .5; if

Best way to be able to pick multiple colors/designs of symbols dynamically from flash

两盒软妹~` 提交于 2019-12-24 10:38:22
问题 Sorry the title's so convoluted... I must've tried for ten minutes to get a good, descriptive title! Basically, here's the scenario. Let's say a user can pick fifty different hat colors and styles to put on an avatar. The avatar can move his head around, so we'd need the same types of movements in the symbol for when that happens. Additionally, it gets which hat should be on the 'avatar' from a database. The problem is that we can't just make 50 different frames with a different hat on each.

AS3 retrieving xml from aspx page

坚强是说给别人听的谎言 提交于 2019-12-24 10:38:04
问题 I'm an AS3 noob on training wheels... I have an XML Loader class which is doing what it's supposed to with a test.xml file, however I need the flash to read the xml written by an aspx file. So I tried: var urlRequest:URLRequest = new URLRequest("../xml/CaseStudyFlashAssets.aspx"); I get error #1090 (which I gather is because the aspx is not xml and it doesn't like it) Can anyone help me get to the xml written by the aspx file? Thanks Mikey 回答1: A frequent problem with xml being supplied from

Best way to be able to pick multiple colors/designs of symbols dynamically from flash

混江龙づ霸主 提交于 2019-12-24 10:36:23
问题 Sorry the title's so convoluted... I must've tried for ten minutes to get a good, descriptive title! Basically, here's the scenario. Let's say a user can pick fifty different hat colors and styles to put on an avatar. The avatar can move his head around, so we'd need the same types of movements in the symbol for when that happens. Additionally, it gets which hat should be on the 'avatar' from a database. The problem is that we can't just make 50 different frames with a different hat on each.

flex dictionary bug?

懵懂的女人 提交于 2019-12-24 10:22:37
问题 I was testing a HashMap implementation in AS3 . I have tried the following code: var map:IMap = new HashMap(); map.put("a", "value A"); map.put("b", "value B"); map.put("c", "value C"); map.put("x", "value X"); map.put("y", "value Y"); map.put("z", "value Z"); Then I called the clear() method: map.clear(); The size of the hashmap didn't become 0, but it was 1. The problem is that when the key is "y", it doesn't get removed. The corresponding code is as follows: protected var map:Dictionary =

Blur Tween in AS3

寵の児 提交于 2019-12-24 10:15:02
问题 I wish for a movie clip to slowly blur over a couple of seconds. Is there some way to do this without using Tweener or some other external class? I only wish to use the tween class. The code I use at the moment is below, but this doesn't do it gradually, just turns the blur on like a switch: var blur : BlurFilter = new BlurFilter(); blur.blurX = 4; blur.blurY = 4; blur.quality = BitmapFilterQuality.HIGH; chrNicky.filters = [blur]; I need the blur to happen over the course of two seconds.

CPU usage in AS3

做~自己de王妃 提交于 2019-12-24 10:08:31
问题 I have a large project with lots of classes. It takes 40% CPU when it is running. What is the best way to find out what operations and functions are responsible for the load? I am using Flash Builder 4.5 AS3 Project. Built-in profiler doesn't help me much. Thanks 回答1: You can try SWFWire Debugger. Check the box that says Show method entry . If you also check Show method exit , it will tell you how long each function took to execute. The object graph might also help if you are creating and

Export flex chart and datagrid to excel

扶醉桌前 提交于 2019-12-24 09:59:15
问题 I need to export a pie chart and a datagrid in flex 4.5 to Microsoft Excel format. I was able to export the datagrid using as3xls. But it doesn't allow to export any chart or even add an image to excel file. Can anyone recommend me a way of doing this? 回答1: As far as I know there is no way to export a chart to Excel by means of existing libraries. I would like to suggest you one specific way to do it. We all well know that current Office files are stored as collections of XML structures. The

ExternalInterface.addCallback fails in local environment

浪子不回头ぞ 提交于 2019-12-24 09:59:00
问题 I thought this question would answer my question, but I have applied the following fixes: .as Security.allowDomain("*"); Security.allowInsecureDomain("*"); .html param name="allowScriptAccess" value="always" /> .js params.allowscriptaccess = "always"; And I am still seeing the ExternalInterface.addCallback method fail locally. It works on a web server, or in the dev folder . But not in an arbitrary local folder. 回答1: Add as a trusted location the folder where your swf/html reside. Right click