I don’t have time to go over the specifics of what is different, but here is the modified code to Lee Brimelow’s ‘Dynamic Sound’ tutorial that covers how to create sound dynamically in Flash 10. This code will work with the new Flash Player 10 Beta 2, but not with any prior version.
I can tell you that the main difference is in the Sound API, specifically with how the SampleDataEvent class is used. Also, we now invoke the ‘writeFloat’ method on the event object rather than an instance of the Sound class.
In addition, we will pass in a value of 8192 to the ‘for’ loop rather than 512. This results in superior sound quality, as indicated in the updated API documentation on the SampleDataEvent class:
Dispatched when the player requests new audio data.
Use this event when you want to manage dynamically generated audio. In this environment, the Sound object doesn’t actually contain sound data. Instead, it acts as a socket for sound data that is being streamed to it through the use of the function you assign to this event.
In your function, you use the ByteArray.writeFloat() method to write to a ByteArray object (event.data) that contains the sampled data you want to play.
When you call Sound.play(), the player starts calling your event handler, asking for chunks of data that contain sound samples. The player continues to send events as the sound plays back until you stop providing data, or until SoundChannel.stop() is called.
The latency of the event varies from platform to platform, and could change in future versions of Flash Player. Don’t depend on a specific latency, calculate it instead. To calculate the latency in ActionScript, use the formula: ((SampleDataEvent.position/44.1) - SoundChannelObject.position).
Provide between 2048 and 8192 samples in a SampleDataEvent object. For best performance, provide as many samples as possible. The fewer samples you provide, the more likely it is that clicks and pops will occur during playback. This behavior can differ on various platforms and can occur in various situations - for example, when resizing the browser. You might write code that works on one platform when you provide only 2048 samples, but that same code might not work as well when run on a different platform. If you require the lowest latency possible, consider making the amount of data user-selectable.
If you provide fewer than 2048 samples, Flash Player plays the remaining samples and then stops the sound as if the end of a sound file was reached, generating a SoundComplete event.
You can also use the Sound.extract() method to extract data from a Sound object, which you can then write to the dynamic stream for playback.
When you use this event with a Sound object, the only other Sound methods that are enabled are Sound.extract() and Sound.play(). Calling any other methods or properties results in an “invalid call” exception. All methods and properties of the SoundChannel object are still enabled.
Anyway, here’s the modified code to use in Lee’s tutorial:
Adobe has released the Beta versions of Dreamweaver, Fireworks, and Soundbooth CS4. Personally, I’m really chewing at the bit to get my grubby paws on Flash CS4, but these new releases look pretty fun.
R Blank, the CTO of Almer/Blank (where I work ;)) and founder of LAFlash and the RMX has a conversation about RIA technologies and the future of Flash video with Lee Brimelow at FITC Toronto. Enjoy!
Adobe just announced that they are opening up the development specs of the SWF and FLV/F4V specs, among other steps to adhere to an open development community.
This is a big change, especially where distribution of Flash content on devices that cannot currently run Flash. (read “iPhone…?”). I see this as a huge step towards “Flash on all screens” as more and more mobile devices are capable of giving a user the true “internet experience”.
Yes! I’ve accepted a position as a Flash Platform Developer with Almerblank, located in Venice, CA. I’ll have the great honor of working with some great talent, such as: R Blank, Omar Gonzales, Hasan Otoume, and many others. And tomorrow is my first day!
I’m very excited to be working with Almerblank, as they do have a history of developing some of the most outstanding Rich Internet Applications around. In addition, R Blank founded and runs the LA Flash group, which is comprised of some awesome members in the LA area and beyond. They also run live training sessions regularly, and make a very large contribution to the training and development of aspiring Flash and Flex developers.
In this new job, I will be learning more about the Flex framework as well, as the company does a substantial amount of work in Flex. This will of course open even more doors for me in the future, and I’m looking forward to bettering myself with other technologies that are in high demand.
This is actually a pretty big leap for me, as the new job is located in Los Angeles, and I’m currently 160 miles south of that. So for the first 2-3 months, I’ll be commuting there once a week and working out of my home the rest of the time. After that, then LA here I come! One of the biggest hurdles is that I am raising my 11 year old son full time. So I’ll also have to uproot his life and pull him away from his friends and our family. But I’ve been waiting years for the right opportunity, and I really do feel that this is it.
It has been my goal over the last few years to eventually break into an industry that I am truly passionate about. I guess that I’m living proof that if you truly want something in life, and work hard to get it, it will happen.
I just ran across this video interview with Narciso Jaramillo by Ryan Stewart, which goes into some pretty good detail on the designer/developer workflow of Adobe’s Thermo. Enjoy!
“Flash Player 9 has a very dirty secret. It doesn’t even try hide this dirty secret, but it’s still not that widely known. You see, Flash Player has severe problems with separation anxiety - once it’s loaded some content, it has a really hard time ever letting it go. Technically speaking, it is extremely difficult to make Flash Player 9 unload ActionScript 3 content.”….
I’ve recently been working on a photo gallery project that will use Flickr as a sort of CMS, pulling the image data from a user’s feed. Doing some research, I came across SWX, which is basically a service API framework that assists in data binding with Flickr, Twitter, and other social networking sites using AMFPHP. The service is actually pretty easy to use, and the “get started” documentation is straightforward and easy to understand. However(!), the service is made for use with AS2 only. If you try to use it with AS3, you’ll get an AVM1Movie object created from a loaded .swf containing the native data, and you cannot directly access the necessary methods and properties of it to retrieve the queried data.
What to do, oh what to do?!
Answer - LocalConnection.
If you want to use AS3 as your driving force behind the application, and would like to use the SWX Flickr API service, you’ll need to do a little finagling using the LocalConnection class and an AS2 “connector”. This is possible because both the AVM1 (AS1 & AS2) and AVM2(AS3) shells handle LocalConnection objects the same way, so you can access methods and properties from an AVM1 object indirectly through the LocalConnection. Using the basic tutorial on the SWX website as a starting point, here’s how you can use the service and retrieve the data:
First, create an AS2 file and name it “connector.fla”. On frame 1 of the timeline, enter this code:
Now, go ahead and test that movie. You might get a series of sandbox errors, but that’s OK for what we’re doing.
Next, create your AS3 file and name it whatever you want, just be sure to save it next to the “connector.swf” file. In my example, I just place the code on Frame 1 of the timeline. Obviously, if you use a document class, then you’ll need to adjust the syntax to suit. Here’s the code:
var flickr_lc:LocalConnection;
var myArray:Array = [];
var loader:Loader = new Loader();
loader.load(new URLRequest("connector.swf"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);
function onLoaded(evt:Event):void{
flickr_lc = newLocalConnection();
flickr_lc.client = this;
flickr_lc.connect("myConnection");
}function parseData(info:Array):void{
myArray = info;
trace(myArray[0].src);
}
Now when you test this, it may take a few seconds for the data to be returned (if you set the “loader.debug” property to ‘false’ in your connector.swf file, it will be much faster). Once the connection is made and the data is parsed out, you may again get some pesky sandbox errors. But you should also get the src attribute for the first item in the returned photos array, which will look something like this: http://farm3.static.flickr.com/2135/2401896830_078680fe5f.jpg
So there you have it! This was just a quick example of how you can use the SWX service with AS3, but be sure to check out the SWX Service Explorer for all the possible services and methods.
Application developers who want to create cross-platform, data-centric applications need the power of Flex 3. In Flex 3 Essential Training, Adobe Certified Instructor David Gassner starts with the basics of understanding Flex, its projects, and its related programming languages. He explores the intricacies of the development platform and the Flex Builder 3 integrated development environment, then gives in-depth, hands-on tutorials on creating, designing, customizing, and publishing dynamic web and desktop applications in Flex 3. Exercise files accompany the course.
In AIR Essential Training, instructor David Gassner shows how to use the Adobe Integrated Runtime (AIR) and associated development tools to create dynamic applications. David demonstrates how to build and deploy desktop applications that run equally well on Windows and Mac OS X. He covers creating applications in Flex Builder 3, Dreamweaver CS3, and Flash CS3; working with HTML and PDF documents; creating a seamless installation experience; and more. Exercise files accompany the course.
AS3 Particle Effects-Now 1000% Extra Free! is a recording of the live presentation given by Seb-Lee Delisle at the FlashForward 2007 conference in Boston. Please note that since this presentation was recorded live, the audio and video quality may vary from our regular course offerings.
Session Description: Creating a particle system may sound scary, but it’s not rocket science. With some very simple programming, you can produce a variety of effects, including smoke, explosions, bubbles, and even fire. In this updated version of Seb Lee-Delisle’s popular presentation, these simple programming techniques and the basics of physics will be covered in a very clear and easy-to-understand way. Plus, our code has been converted to ActionScript 3. This gives us ten times as many particles as version 2–that’s 1000% extra!
Subscription to Lynda.com is about $25 a month (with NO exercise files), and is more than worth the money if you need to keep up with breaking web or design technologies. I highly suggest trying it out for yourself if you aren’t already a subscriber.
The guys that brought us SWFObject have just released an updated version.
Quote from the SWFFix Blog:
We have made a few small updates to both the SWFObject 2.0 library and the generator.
SWFObject 2.0 generator 1.1 is now updated to support AIR 1.0 and includes a missing value for the allowScriptAccess parameter.
SWFObject 2.0 rc4 includes a couple of file size optimizations, resulting in another 7.5% reduction; the library’s file size is now only 8.5Kb! Further we have made a few small code enhancements, e.g. consistent typing for internal version numbering.
And we finally have a release planning: if no big issues arise in the coming weeks, we will release the final version of the library around Friday March 14th!