Tuesday, June 12, 2007

flash.media.Microphone.rate What are the acceptable bit rates (bitrates)?


Adobe appears to have forgotten to publish the acceptable values for the flash.media.Microphone.rate property in the ActionScript 3.0 edition of their documentation.

The Adobe documentation on the rate (bitrate) property is limited to the following,
“The rate at which the microphone is capturing sound, in kHz. The default value is 8 kHz if your sound capture device supports this value. Otherwise, the default value is the next available capture level above 8 kHz that your sound capture device supports, usually 11 kHz. “

But, what If you want a rate (bitrate) other than 8 or 11 kHz ? If you are looking for the acceptable bit rates look no further. I dug this out of a tech note.

Sampling rate

Approximate data rate

5

5.512 kHz

1378 bytes/sec, or 11.025 K bits/sec

8

8.000 kHz

2,000 bytes/sec, or 16 K bits/sec

11

11.025 kHz

2756 bytes/sec, or 22.05 K bits/sec

22

22.050 kHz

5,513 bytes/sec, or 44.1 K bits/sec

44

44.100 kHz

11,025 bytes/sec, or 88.2 K bits/sec

Labels: ,

Thursday, May 31, 2007

First Step in Migrating AS 2.0 to AS 3.0

When you first open an AS 2.0 application you wish to migrate to AS 3.0, in Flash CS3, you will probably go to the Publish Setting dialog box and change the ActionScript version to ActionScript 3.0.

After that, just to be masochistic, you will probably test your movie and expect to get an onslaught of errors. Unfortunately, you will get NO ERRORS and your application will simply fail to work!

So, when migrating an AS 2.0 application to AS 3.0, stay in the publish settings dialog box a bit longer and click on the “settings” button next to the “ActionScript version” dropdown. Once in settings make sure the “strict mode” check box is checked.

Now you will get your helpful list of errors and be able to begin the not too painful process of migration from AS 2 to AS 3.

Labels:

Wednesday, May 30, 2007

Color Code your ActionScript for HTML here....

Arul has been kind enough to create a little form on his site that takes actionscript as input and returns your actionscript color coded by html and css! Now, if you want to post some of your actionscript on the web, all you have to do is paste it here. And it will be HTML color coded for you.

Labels:

Sunday, May 27, 2007

JScript.NET is AS3, Why Not Use It?

Awhile back, I had a chance to speak about JScript.NET (supporting website). This language is based on the same ECMA standard as ActionScript 3.0 and has been a part of the .NET framework from the beginning. Unfortunately, it never found favor among .NET developers. Now many .NET developers are trying to use Python as "the dynamic language" for .NET applications. I think ActionScript 3 / JScript.NET is much more suited to application development than Python. What do you think?

Also, JScript.NET is a nice server side language for AS 3 programmers because the language is virtually identical to what we use all day in our Flash applications.

If you are not familiar with JScript.NET (not to be confused with the JScript in IE) check out the website I built to support my presentation, here.

Labels:

Thursday, May 24, 2007

Save JPEG or PNG in ActionScript 3.0.

In order to make the Apollo application APS LightTable practical, it had be able to modify images from the local hard drive and then send them to the server without increasing the image's file size. To do this I was required to perform PNG or JPEG compression within the LightTable application. The problem of JPEG/PNG encoding in the Flash Player appears to be solved by Adobe Labs as3corelib!

If you are looking for a way to send images that the user has created in the Flash Player without consuming huge amounts of bandwidth it is now possible! Also, if you need to save user created/modified images to disk from an Apollo application, it is now possible to save them in the formats your users are familiar with. I have posted links below:

Download the as3corelib which contains these encoder classes.
Warning: The as3corelib may NOT be as up to date as the direct links below which take you directly into the as3corelib svn.

Adobe ActionScript 3.0 JPEG encoder

Adobe ActionScript 3.0 PNG encoder

Labels: ,

Tuesday, May 22, 2007

Quick note on Penner's Easing in Flash

I just found that I had an old component using the com.robertpenner.easing library. I don’t know how the AS 2.0 version of that library got so popular. Most of the classes in Penner’s AS 2 easing library are included in the mx.transitions.easing package and always have been. Though, some of the classes have different names in mx.transitions.easing.


The code in the mx classes and Penner's classes is identical. The only difference is that the mx version has a Macromedia copyright text block above Penner's code. Following are the mx easing classes with their corresponding Penner classes.

Penner’s com.robertpenner.easing.Quad is renamed mx.transitions.easing.Regular, Quint is renamed Strong, Linear renamed None. The classes Back, Elastic, and Bounce were not even renamed.

You may still need to use the following Penner classes as they are not a part of the mx.transitions.easing package:
Cubic, Quart, Circ, Sine, and Expo.

Labels: