actionscript

Flex/actionscript snapshot with clipping rectangle and scaling matrix

ε祈祈猫儿з 提交于 2019-12-10 11:35:13
问题 var snapshot:ImageSnapshot = ImageSnapshot.captureImage(someSprite); var file:FileReference = new FileReference(); file.save(snapshot.data,'abc.png'); In the above code I am able to capture an image. But I also want to apply a scalingMatrix(for zoomIn/Out) and a clipping rectangle to it. How to do it? I tried capturebitmapdata too, but with that I can't even get a proper image. See here. So I don't want to use that. 回答1: sw = someSprite.stage.stageWidth; sh = someSprite.stage.stageHeight; var

How to get the visible items on a Spark List with virtual layout

你。 提交于 2019-12-10 11:28:39
问题 I have: an ArrayCollection of Numbers; a List using the above ArrayCollection as it's dataprovider, and virtualLayout=true; a custom ItemRenderer that shows a label with: a) the number b) an y position depending on the number AND the highest number visible In another words, if I have 10 numbers in the AC, and only 5 appear on the screen, the y position of those 5 will depend on the value of the maximum number for those 5. When the user scrolls, of course those 5 elements change so the

How to restrict the drag and drop area in a canvas

不问归期 提交于 2019-12-10 11:07:08
问题 I have a canvas,lets say of dimensions 500x600.I have some controls inside that canvas.User can rearrange the controls by drag and drop.But I want to restrict the drag and drop within that canvas. For example:There is a button in the canvas.User can drag and drop the button anywhere inside the canvas.But if the user tries to drag the button out of the canvas boundaries,it should stick in the canvas boundary. How to achieve this? 回答1: The signature for startDrag() is public function startDrag

ActionScript: Package-level introspection? Or some other pluggable loading scheme?

人走茶凉 提交于 2019-12-10 09:46:37
问题 I'm coding up some delicious business logic and I've come to a situation like this: There are a bunch of rules ( ruleA , ruleB , etc...) which all follow a standard pattern. I've created a Rule interface, and implemented it in RuleA , RuleB , and so on. So now I just need a way to load them. Right now I'm using a map: var rules:Object = { ruleA: new RuleA(), ruleB: new RuleB(), ... }; Then calling it like this: function doStuff(whichRule:String, someData:Object):* { return rules[whichRule]

how to read a global javascript variable from actionscript

只谈情不闲聊 提交于 2019-12-10 09:24:02
问题 Given that there is a global javascript variable on my web page named myVar, how can I access the value of the variable myVar from within my flash movie using javascript? I see plenty of examples of using external interface in order to execute javascript from actionscript, but I am unable to find examples of returning values back into the flash movie using actionscript. Thanks in advance. I hope my question is clear enough. 回答1: ExternalInterface works by allowing JavaScript to invoke an

Singleton Class in Flex

一个人想着一个人 提交于 2019-12-10 04:34:01
问题 I have a doubt,.... How would you create a Singleton class in Flex... Is there any convention like the class name should eb Singleton or it should extend any other class. How many Singleton class can a project have? Can anyone say the real time usage of a Singleton class? I am planning to keep my components label texts in a Singleton class... Is it a good approach. 回答1: Can of worms asking about singletons! There are a few different options about creating singletons mainly due to AS3 not

How to do Automated UI testing for Flash [closed]

不问归期 提交于 2019-12-09 18:36:28
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I have an actionscript 2 application that I'd like to write automated UI testing for. For example I'd like to simulate a mouse click

Test Webcam via Flash

て烟熏妆下的殇ゞ 提交于 2019-12-09 13:38:07
问题 I am looking for a "test your webcam" flash movie like this one that is free and OK to use in a closed environment. I need the camera testing only, no server side processing of the video stream. It is thought as a small online tool for a client. Is this possible? Does anybody know a freely usable solution? 回答1: http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/media/Camera.html#includeExamplesSummary shows a simple example for how to use the camera class. i've also uploaded an example here

Handle VerifyError: Error #1014 when loading swfs using AS3

我只是一个虾纸丫 提交于 2019-12-09 07:16:36
问题 We are making a system that has a main swf for the application, and loads separate tools from separate swfs -- there will be versioning issues in the future since the separate swfs are coming from a cms (especially now since we're still developing, but also in the future when other developers might create an incompatible tool). I'm trying hard to prevent them as much as possible but I'd really like to be able to display a message to the user of the system when an incompatible swf is loaded.

AS3 - How can I get an array of constants of a class?

喜夏-厌秋 提交于 2019-12-09 06:40:04
问题 static public const CONST_1 :String = "CONST_1"; static public const CONST_A :String = "CONST_A"; public var constantsArr :Array; Is it possible to get an array of the class constant values without adding them manually like this: constantsArr = [ CONST_1, CONST_A ]; 回答1: Using describeType it should be possible : public class Constants { static public const CONST_1 :String = "CONST_1"; static public const CONST_A :String = "CONST_A"; } var xmlList:XMLList = describeType(Constants).child(