Local Loading in AS3 for Macs

It would appear that the 8.5 player for Mac doesn’t support local loading in AS3 (at least for Sound, I haven’t tested other objects yet). This makes a certain amount of sense, being that there is no dev environment yet, so local testing isn’t really expected. However, if you’re using my context menu plug-in, or one of the various other options to compile AS3 on the Mac, you’ll probably want to be able to test without uploading to a server.

The solution is simple, but it took me a while to narrow down the potential approaches before I found one that worked. You simply have to test your SWF through the webserver built into OSX.

To do this, turn on “Personal Web Sharing” in the “Sharing” control panel, place the SWFs you want to test in the “~user/Sites/” directory, and access them via “http://localhost/~user/SWFName.swf” from your browser. To make this a little easier, I added a “flCompile and httpTest” context menu workflow to the flCompile package, and updated the Read Me with instructions to get it working. While I was at it, I also cleaned up the flCompile scripts a bit, and made it a little easier to change the command line params for things like background color and swf dimensions. You can download the new package from the original post on flCompile.

Also be sure to check out the comments on the original post for other options for compiling AS3 on OSX.

Gallery Incomplet Updates for Dec

I’m going to keep a little log going on the blog to track what has been updated or added to Gallery Incomplet. [Note: Moved to incomplet.gskinner.com] This should help keep me motivated to continue updating it, and keep readers informed about my ongoing experimentation (because much of it won’t be blogged here on a real-time basis). Because of the holidays, I’m going to post the December log now.

Updates:

– Made the pod shadows dynamic based on y position (was previously always a 45 degree drop shadow)

– Added logic to track viewed items between visits using LSOs. Previously viewed items will now be displayed with a folded corner

– Minor updates to loading and transitions

Additions:

– Fluids. Playing with fluid simulation in a psuedo 3d environment.

– Clouds/Fog. Using multiple layers of perlin noise to simulate moving through clouds or fog.

– Transcendence. Building on clouds, transcend this mortal plane.

– LightningStrike. Dynamically generated lightning, thunder and lighting effects.

– ElectricJellyfish. Not quite sure where this is going, but it’s kind of neat.

Go to incomplet.org to view the Flash experiments. [Note: Moved to incomplet.gskinner.com]

Easily Compile AS3 and Flex2 on Mac OSX

[UPDATED Jan 3, 2006: Added “flCompile and httpTest”, updated workflows to make it easier to customize command line parameters like swf dimension and background color]

There are a lot of things I want to play with in AS 3 and Flex 2, but there’s one problem: I’m using Mac OS X, and FlexBuilder 2 is only available for Windows right now. Fortunately, I stumbled upon this page via this blog entry by Robin Hilliard, which explains how to compile ActionScript 3 and Flex 2 on the Macintosh using the command line.

I’m a Mac user though! Commandlines are for lesser OSes! Refusing to stoop to typing arcane commands into the Terminal, I instead spent my evening learning to use Automator and the rather eccentric AppleScript language to build a solution. The result is a contextual menu plugin that will compile AS3 and Flex 2 MXML files, then open them in Safari for testing. It’s still a little rough around the edges, and it’s nowhere near as nice as working in FlexBuilder2, but it works! I also fleshed out the instructions for getting command line compiling working on the Mac.

You can download it by clicking here (10kb). It requires Mac OS X 10.4. Please read the ReadMe file – the contents of which follows:

Disclaimer

I take absolutely no responsibility for any problems you experience or damages (direct or indirect, including but not limited to loss of data) caused by using these workflows. I have tried my best to make sure they are totally safe, but I am not an AppleScript expert or a command line guru. Use at your own risk.

Continue reading →

Flash 8 Bootcamp Coming to London

After a very successful run of my Flash 8 Bootcamp in Los Angeles (we oversold the event due to some very tenacious would-be attendees, and wound up having to reconfigure the venue to fit everyone), I have decided to bring the workshop to London in cooperation with FitC and the London MMUG. Every run gets a little bit more polished and fun to deliver, so I have high hopes for this next iteration.

One of the most popular aspects of the workshop so far has been the demo files that are included with it. Attendees receive the full source for over 30 pre-built demo files, which cover all of the major features (and most of the minor ones) in Flash 8. This includes source for the popular HumanTorch, SnowStorm and MagnifyingGlass experiments. I also provide the source code for another 15-20 mini-demos I build during the workshop.

In LA, I had a lot of fun at an evening event arranged by R Blank (LAFlash manager, and all round good guy) where attendees could go out for bowling, beer and a bite to eat with me. I’m planning on arranging something similar for the first night of the workshop in London – it was a great chance to meet and chat with attendees informally whilst whupping them in a (mildly) competitive sport. I love LA Flashers, but they apparently stink at bowling *grin* (Josh Davis will back me up here).

Anyway, if you’re interested in the workshop, you can find more info in my past posts, or on the official site. These workshops do sell out (as proven in LA), so you’re encouraged to register early if you want to guarantee a seat.

Also, if you’re a London MMUG member, you might want to chat with Tink (Stephen Downs) – he might have some other info that you’ll want before you sign up. If you’re not a member, why not? It’s free.

Source Code: Tracing ARGB (32 Bit) Hex Values

Many of the new features in Flash 8 use ARGB color values. This is great because it allows you to store your color value (RGB) and alpha (A) in a single 32bit integer. Unfortunately, debugging can be tricky because Flash’s built in Number.toString(16) method treats all numbers as signed integers. This can result in some unexpected results when tracing an ARGB value:

var RGB:Number = 0x99FFCC;
trace(RGB.toString(16)); // works fine, traces "99ffcc"
var ARGB:Number = 0xFF99CC66;
trace(ARGB.toString(16)); // not so good, traces "7fffffff"

Because Flash is treating the value as a signed integer, it can only use 31bits to represent the value (1bit represents the sign + or -). This forces Flash to truncate it to the maximum 31bit value, which is 7FFFFFFF.

Continue reading →

Source Code: SharpenFilter for Flash 8

As an experiment in extending existing filters, I decided to take a swing at creating a sharpen filter. It was very simple to do, and works exactly as you would expect. All I did was extend ConvolutionFilter and abstract the logic required to carry out sharpen operations with it. You can download it here to use in your own projects, or to learn from.

Using it is really easy:

import com.gskinner.filters.SharpenFilter;
// sharpen amount is between 0-100.
var sharpenF:SharpenFilter = new SharpenFilter(sharpenAmount);
myClip.filters = [sharpenF];
// change the amount:
sharpenF.amount = 50;
// get the amount:
trace(sharpenF.amount);

Continue reading →

XML2 Updated

In my rush to release the updated version of XML2, I managed to upload the wrong version, which had some issues. I didn’t have the proper version with me in LA, so it wasn’t until today that I was able to upload the proper version. My apologies to anyone who downloaded the prior version and was confused by it.

You can view all documentation, and download the proper version from my previous entry on XML2. You can tell if you have the latest version by looking at the comments at the top. The new version has a revision history, whereas the old version did not.

I also updated the demo FLA slightly to be a bit more straightforward.