Posts Tagged ‘as3’
An endlessly repeating thumbnail panel with Milkbox support and easy to use? Yes! As I previously posted something about Inertia-Movements I (and some people who have mailed me – thanks for that) had the idea to continue this article and show an example of the repeating thumbnails. The code (for repositioning the thumbnails) is not as easy to understand as the movement itself so I decided to write an own article for it. Furthermore I am working with Milkbox at the moment so I thought of integrating it to that panel as well. In the end I came up with a this pretty long article showing all the code and files needed to realise the example above. Another little feature you might have seen is, that the Flash is informed about when the Milkbox is closed. This will be one topic in the article as well.
I know what you’re thinking. Not again one of these Webcam server articles.. and you’re right! I thought the same and decided to quit any upcoming search for this topic and write a 100% working solution by myself.
Lately I was having some troubles with saving an image sent from Flash to my server. I found a lot about sending the BitmapData to a PHP file and then (god knows why..) directly navigate to this URL, so PHP displays the image in the browser as a JPG-Stream. I really took some time to think about any scenario when this could be useful but yea.. anyways, I needed to save my bitmaps on the server and each file has to have a unique filename. So each time I press “Save” in my Flash-Application an image is uploaded to my server.
I recently had to deal with Inertia-Movements again and had a look for some older scripts to re-use. I found two which I quickly wanted to share. Inertia movement is an effect you may know from many galleries or navigations. It’s the “move your mouse left and the clip will slide smoothly to the right” – thing. The example above shows it as well – thanks to Danny for these great pictures.
The first script I’m going to show is used for infinite looping, means, the movement will not become slower as you reach the end of the clip. It rather works like “The more the mouse is away from the horizontal center the faster the movement is”, so having an infinite loop of thumbnails is pretty cool then. An example can be found here: Hugo Boss Gallery
The other version is like the opposite – the clip is limited to the left and to the right, which basically means: The more the clip gets to it’s “end” the slower the movement becomes. This effect was used on depotVisuals or the example above.
I’m talking of a Timeline-Tween which gets broken when changing the clip’s properties while tweening.
As ord(character) is somehow a privilege of Flash Light and AS1 here's a small AS3 workaround to get the ASCII code number of a specific character.
var charCarry:String = "C";
var asciiConvert:int = charCarry.charCodeAt(0);
trace(asciiConvert); // 67
You can look up the complete ASCII code table here.
in the last chapter we made it to load a SWF and unload it on demand. Let's continue here and imagine that we're having three SWFs, each of them having some content which should be shown on click. A typical usage would obviously be a Flash Website consisting of multiple SWFs. Read more »
Just a quick snippet to determine the visitor's Flash Player Version (incl. OS and Version RC) in Actionscript 3. The detailed trace of all information covers Operating System, Major Flash Version and up to the 4th release version, e.g. 10.0.42.34 - the latest release yet.
Recently I've benchmarked the difference between a multi- and a procedural-loading. I've taken images with a size ranged between 500kb and 1mb. Here are the results...
|multiload||619 ms||2821 ms||6253 ms||17189 ms|
|procedural||488 ms||2545 ms||6153 ms||16260 ms|
...and here are the source files. The zip file is without any images!
We're all used to the fact that the Flash IDE doesn't support soft masks for any reason. Everyone needing soft / alpha gradient masks must use Actionscript to realize that. Just add a PNG (you want to use as map) with transparency to your library (or load it), export it for Actionscript (in our case it's MaskPNG) and then use the following code (mcToBeMasked is already on stage). What's essential is the cacheAsBitmap - property which will dither the png with transparency:
var png:MaskPNG = new MaskPNG(200, 200);
var maskBitmap = new Bitmap(png, PixelSnapping.AUTO);
maskBitmap.cacheAsBitmap = true;
mcToBeMasked.cacheAsBitmap = true;
mcToBeMasked.mask = maskBitmap;