actionscript-3

AS 3 | Cloning Png image data

断了今生、忘了曾经 提交于 2019-12-24 09:58:03
问题 I need to clone .png image data loaded from server in AS3, so that I am not required to load same data again and again from server. After a search on cloning image data in AS3 I was able to find following code over internet clone = new Bitmap(Bitmap(this._loader.content).bitmapData.clone() ) By using this code I am able to clone bitmap data but the problem which I am facing is that my png background is transparent. If I typecast loaded png data to bitmap my icons background becomes white. Any

AS 3 Flash Countdown Timer For Game Over Screen

非 Y 不嫁゛ 提交于 2019-12-24 09:43:58
问题 I am currently in a Flash game programming class with action script 3 and can't seem to find a clock anywhere that counts down and then does an action. I've been using Lynda tutorials and that hasn't been helpful and I have also Google searched quite a bit, but no luck. I have a Countdown clock and have been try "if" statements, but no luck. Can someone guide me in the right direction on what I am doing wrong? //game timer var count:Number = 60; // amount of time var myTimer:Timer = new Timer

How can I define what a layer a child is created onto when using Flash CS5 AS3?

风流意气都作罢 提交于 2019-12-24 09:37:07
问题 I need to display a child on layer 2. How would I, using AS3, dynamically create a child on frame 2? 回答1: "Layer 2" isn't specific enough. What layer of what display object container? Here is a good article on display list programming that should prove enlightening. To answer your question, you would identify the parent displayObject and call its addChild method, with your targeted child displayobject as the parameter. If your parent displayObject is the containing class (a class that extends

Detect if camera is capturing in Flash

喜欢而已 提交于 2019-12-24 09:33:43
问题 I'm having trouble with Camera.getCamera() in Flash AS3. If there are multiple camera drivers, it does not necessarily pick the correct one. If the default is the correct, the program works fine; however, if another driver is selected as the default then LED on the webcam does not come on and no video is captured. I can cycle through the available cams and select an arbitrary one. I don't, however, know how to determine if the selected camera is correct. It is not returning null. I considered

Is there a way to check if DisplayObject A is a descendant of DisplayObject B?

北城余情 提交于 2019-12-24 09:30:49
问题 I would like to be able to quickly check if a given DisplayObject is a descendant (not in the inheritance sense - ie. child, grandchild, great-grandchild, great-great-grandchild, etc.) of another DisplayObject. There doesn't seem to be a native way to do this and I can only think of two ways to achieve it: Create the mother of all nested loops. Seems a bit, I dunno, wrong? Dispatch a bubbling event at the 'child' and check if the potential 'parent' receives it. Am trying the latter now, but

Java plugin in a Flex HTML component

孤街醉人 提交于 2019-12-24 09:29:11
问题 Anyone have an idea how to access through HTML component a page that requires Java plugin? I am using this new samsung android camera and I would like to open the link where the camera is streaming the video in a html component. If I make a browser like the one in tour de flex using the html component, it opens the page where the video should be seen. But then how do I access the Java plugin to play it. Thanks, David 来源: https://stackoverflow.com/questions/18758738/java-plugin-in-a-flex-html

Use regular expressions to remove HTML tags in Flex/AS3

巧了我就是萌 提交于 2019-12-24 09:27:46
问题 I'm writing a HTML parser in Flex (AS3) and I need to remove some HTML tags that are not needed. For example, I want to remove the divs from this code: <div> <div> <div> <div> <div> <div> <div> <p style="padding-left: 18px; padding-right: 20px; text-align: center;"> <span></span> <span style=" font-size: 48px; color: #666666; font-style: normal; font-weight: bold; text-decoration: none; font-family: Arial;">20% OFF.</span> <span> </span> <span style=" font-size: 48px; color: #666666; font

Flash AS3 Read Text File

こ雲淡風輕ζ 提交于 2019-12-24 09:17:14
问题 I simply need to read a text file from my computer, or a website. I've tried everything, and nothing so far has worked. It should be extremely simple, just reading a text file from a website, like http://foo.com/foo.txt/, but I've tried everything, and nothing I have seen on Google comes even close to working. I don't care how I get the problem solved, as long as I can do it. 回答1: To read the content of a file, just use a URLLoader : // Define the path to the text file. var url:URLRequest =

How to use remote SharedObject in AS3 and Red5

谁说我不能喝 提交于 2019-12-24 08:57:39
问题 I wish to use remote SharedObject so I created a simple script to test out the techniques. When I ran the following code as two instances of SWF, both instances output 1, which was incorrect because the second instance was supposed to output 2. import flash.net.SharedObject; import flash.events.SyncEvent; var nc:NetConnection; var so:SharedObject; nc = new NetConnection(); nc.client = { onBWDone: function():void{} }; nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus); nc.connect(

Flash Range Slider Component

浪子不回头ぞ 提交于 2019-12-24 08:53:35
问题 Is there something similar to this jquery component in flash or are there any ready examples on how to do that? Thanks. 回答1: I do not know of any built-in (or third party, for that matter) components of that sort. I'm sure that some third-party ones must exist, however, but they are unlikely to be free. You can create your own without too much trouble. I have created a basic working version that you can build on if you want: // Main class, shows how to use other classes: import flash.display.