Posts Tagged 'wonderfl'

How to check if URL is not MP3 ?

Since flash player can’t send HEAD requests, you have to resort to dirty tricks if you want to check URL content type. In this example, we are going to try and figure out if some URL points to playable sound. Since we’re dealing with unknown URL, chances are that its domain does not permit us to access raw data, so we can’t really use URLLoader – we need to actually load whatever URL points to into Sound object. However, if you thought that you could just catch i/o error 2124, like you would do with image Loader, for example, you’re in for big surprise: it does not fire. Instead, Sound object fires progress and complete events, and is even happy to play (although you will not hear any noise, or anything at all).

So, how do we detect that our Sound object is actually broken? First thing you’ll notice is that even after complete event it is still buffering. Unusual, but the same thing happens with really short sounds, so this check is not reliable. The other thing is that extract() method obviously fails to return any samples. This in itself is again not enough, since it does happen with partially loaded sounds too. However, the combination of the two seems to hit the nail:

private function onComplete(e:Event):void {
   var s:Sound = e.target as Sound;
   if (s.isBuffering && (s.extract(new ByteArray(), 1, 0) < 1)) {
      // url does not point to playable sound
   }
}

See this method in action at wonderfl.net :)

Less than two weeks left to enter COLT contest

Last chance :)Just to remind you all, free COLT license + a chance to win some Apple hardware are only available until June 25. So download COLT, make your video, upload to youtube, send us the link. Do it now! While you still can :)

No, seriously. We’re very curious to see what kind of crazy ideas people can come up with. Check out this latest submission going wild with Kinect API and Away3D.

By the way, huge thanks goes to wonderfl.net for spreading the word free of charge:

we love Flash and Web developers community… so we’re gonna show your ads for Free (Masakazu Ohtsuka, KAYAC Inc)

Flash and Web developers, we at Code Orchestra love you too! And we hate when you waste your time compiling stuff. In fact, we hate it so much that next COLT release will build your projects up to 3 times faster (and we are talking both livecoding and production builds here). While these news are relevant to Windows users only, I’m sure there are lots of FlashDevelop users out there who will enjoy faster builds OOTB (if they install my COLT plugin).

[ᴘᴏʟʟ] Left or right?

What is better way to fill Mandelbrot exterior? Colors were intentionally left dull, please vote for best geometry:

left or right?

In case you want to check more locations, click here.

Picking random points in elliptic arc or sector

This was the result of random flashkit thread encounter and has no much real life value, probably. The closest thing I found to what that guy was asking for was this 2009 post explaining the trick to pick random point in the circle, but it is remarkably easy to extend it to the ellipse, or even arbitrary elliptic arc or sector. It is interesting in that you pick correct point on 1st try versus, for example, 4/π ≈ 1.27-th try if you simply select random point in ellipse bounding box and reject outliers – and some extra Math.xxx calls pay for that.

How to draw numbered billiard balls

This blog desperately needs more posts, but I hardly have any subjects to write at length about. And this is where wonderfl comes to the rescue – some of those codes are so complicated that one could give two hours talk about them. This code is that kind of code, and tonight I am going to explain just one small part of it – drawing numbered billiard balls. Continue reading ‘How to draw numbered billiard balls’

Radial blur in AGAL

Because blog posts do not write themselves :) Once upon a time someone posted this demo called “zoom blur” to wonderfl that did radial blur by averaging discrete number of samples along radius vector. This approach causes noticeable ghosting with small number of samples. At the time I had no idea how to improve that, but recently I came across its spin-off and there I remembered this:

It was a side effect of sub-optimal zoom filter implementation I did two years ago. Basically, source image gets radially compressed and then decompressed back, and corresponding data loss looks like a blur. So today I decided to give it another try – this time with stage3d/agal. Unfortunately my GPU renders it like this:

The ghosting is gone – enter the aliasing :( After some head scratching, I must admit I have no idea where does it come from. So if anyone reading this has any idea how to fight it and why there is no aliasing issue in pixel bender – please leave a comment or fork the code, thanks.

Grab my balls

So, I have started cross-engine 3D primitives project at github. Just like as3dmod, it plugs seamlessly into your favorite engine to help you out whenever you feel limited by it. Initial commit supports Alternativa3D 8.12, Away3D 4 Alpha, Minko 1 and contains two spheric primitives: UniformSphere and Globe.

UniformSphere is a mesh built from the spiral of vertices uniformly distributed across the sphere. You have two options here: Rakhmanov formula (default, the spiral joins sphere poles) or Bauer formula (the spiral does not contain poles). This primitive was ported from my 3D metaballs code.

Globe is a mesh that minimizes texture distortions for classic plate carré projection. It does so by placing equilateral triangles along the equator and gradually compressing triangles towards each pole (where high triangle density is actually good property in terms of texture distortions). This primitive was ported from my globe component for FP9, which is now also hosted at github.

I plan to add few more primitives over time, both useful and not really, and maybe more engine proxies if there will be any interest.


Old stuff

February 2017
M T W T F S S
« Jan    
 12345
6789101112
13141516171819
20212223242526
2728  

Oh, btw…