actionscript

Soft Paint Bucket Fill: Colour Equality

末鹿安然 提交于 2019-12-01 01:28:08
I'm making a small app where children can fill preset illustrations with colours. I've succesfully implemented an MS-paint style paint bucket using the flood fill argorithm. However, near the edges of image elements pixels are left unfilled, because the lines are anti-aliased. This is because the current condition on whether to fill is colourAtCurrentPixel == colourToReplace , which doesn't work on the blended pixels at the lines. (the colours are RGB uints) I'd like to add a smoothing/treshold option like in Photoshop and other sophisticated tools, but what's the algorithm to determine the

How to make an AS3 Flash video player?

廉价感情. 提交于 2019-12-01 00:20:50
I would like to make a Flash video player that takes a URL as an attribute when you embed it and loads the video based upon that attribute. All I need for the moment is a play/pause button. How can I do this is AS3? It needs to be able to play F4V files. If it's simple to make other features, like full screen, showing how much of the video has been loaded on the timeline, or being able to click at any point in the timeline yo jump to that point in the video, please tell how! Thank you so much! Making your own from scratch is inventing the wheel. if your doing it as a side project, that's fine

filling in (…rest) parameters with an array?

廉价感情. 提交于 2019-12-01 00:08:19
问题 Some as3 functions handle overloading by allowing for an arbitrary number of parameters using the convention: public function doSomething( ... rest ):void; I am in a situation where I need to pass all the values of an array (of arbitrary length) into this type of function... I am not sure how to do this. Suggestions? Here is a hack solution, but it is not extensible: switch (args.length) { case 0: doSomething(); break; case 1: doSomething(args[0]); break; case 2: doSomething(args[0], args[1])

How can I remove youtube logo from the youtube player for use in other application?

↘锁芯ラ 提交于 2019-11-30 23:57:29
I want to use the Charmless youtube player in my application and I want to remove youtube logo from the Player. How can i achieve this thing? My application is developed using AS3. Simply add ?modestbranding=1 to the end of your URL. See more here . modestbranding (supported players: AS3, HTML5) This parameter lets you use a YouTube player that does not show a YouTube logo. Set the parameter value to 1 to prevent the YouTube logo from displaying in the control bar. Note that a small YouTube text label will still display in the upper-right corner of a paused video when the user's mouse pointer

Realtime update and Push Data in AS3

空扰寡人 提交于 2019-11-30 23:51:19
i want to make a real-time update for my flash application. Instead on making it refresh each 30secs, i would prefer the push technology. What is the best way to push data in Actionscript 3 ? There are two popular options for implementing real-time updates: sockets and RTMP. There are advantages and disadvantages to each, but the primary deciding factor is usually your server infrastructure. Sockets Sockets provide the lowest-level functionality. This means you will need to implement a protocol in code on the client and on the server. However, the biggest advantage of this approach is that the

Cleanly merge two arrays in ActionScript (3.0)?

徘徊边缘 提交于 2019-11-30 22:45:12
问题 What's a nice way to merge two sorted arrays in ActionScript (specifically ActionScript 3.0)? The resulting array should be sorted and without duplicates. 回答1: To merge (concatenate) arrays, use .concat() . Below are two examples of how you can concatenate arrays and remove duplicates at the same time. More convenient way: (you can use ArrayUtil.createUniqueCopy() from as3corelib) // from as3corelib: import com.adobe.utils.ArrayUtil; var a1:Array = ["a", "b", "c"]; var a2:Array = ["c", "b",

Using logical bitshift for RGB values

删除回忆录丶 提交于 2019-11-30 22:11:21
I'm a bit naive when it comes to bitwise logic and I have what is probably a simple question... basically if I have this (is ActionScript but can apply in many languages): var color:uint = myObject.color; var red:uint = color >>> 16; var green:uint = color >>> 8 & 0xFF; var blue:uint = color & 0xFF; I was wondering what exactly the `& 0xFF' is doing to green and blue. I understand what an AND operation does, but why is it needed (or a good idea) here? The source for this code was here: http://alexgblog.com/?p=680 Appreciate the tips. Alex In RGB you have 8 bits for Red, 8 bits for Green and 8

ActionScript code to convert bytes to kb, mb, gb etc

不问归期 提交于 2019-11-30 21:07:22
I have a utility function that will display a filesize in an appropriate form like Windows Explorer does, i.e; convert it to nearest KB, MB, GB etc. I wanted to know if the code that i wrote is correct, and if it can be made simpler. The function that i wrote is as follows : public static function formatFileSize(bytes:int):String { if(bytes < 1024) return bytes + " bytes"; else { bytes /= 1024; if(bytes < 1024) return bytes + " Kb"; else { bytes /= 1024; if(bytes < 1024) return bytes + " Mb"; else { bytes /= 1024; if(bytes < 1024) return bytes + " Gb"; } } } return String(bytes); } While it

Soft Paint Bucket Fill: Colour Equality

落花浮王杯 提交于 2019-11-30 20:20:10
问题 I'm making a small app where children can fill preset illustrations with colours. I've succesfully implemented an MS-paint style paint bucket using the flood fill argorithm. However, near the edges of image elements pixels are left unfilled, because the lines are anti-aliased. This is because the current condition on whether to fill is colourAtCurrentPixel == colourToReplace , which doesn't work on the blended pixels at the lines. (the colours are RGB uints) I'd like to add a smoothing