Flash Lite 1.1 “Function Clip” and a little trick we learned from the Mobile XD MAX session
November 3rd, 2005 by Scott JanousekBravo for the folks who put on the XD-mobile session at MAX this year. Not only was informative, but it was the kind of info you can’t normally pick up from a book, site, etc. Therefore it was invaluable.
For those of you who skipped the XD sessions thinking they were all theory and no substance, dead wrong. Macromedia more XD please.
One little trick that I found useful was naming your layers and pinning AS when working with function clips.
If you don’t know what a function clip is … basically it’s what Macromedia termed a movieclip that can be targeted with call() commands. The whole mc acts as a function library. This is actually well documented in the Flash Lite 1.1 authoring guidelines that ships with Flash 8 nowadays. Anyways it’s flash 4 terminology. I called it a library clip, they call it a function clip. Same thing. Here’s an example:
//– calls the setTitle label (fn) within the library mc (the fnclip)
call( “library_mc:setTitle” );
One little tip that I picked up from mobile XD session (John Ulm’s material I believe?), was to name each of your layers in the functionclip to correspond with the function label names you assign in your function clip. Doing this alone doesn’t have much benefit, but when you start pinning actionscript then you’re able to immediately see what function name you’re working with (while debugging). A small tip, but it adds to the workflow and makes sense once you start using it within FL.
Working with function clips and/or pinning AS wasn’t something I was doing a regular basis with FL, but I’ve definiately seen the value in them in dealing with 1.1. So basically each project I do here forward will include a “library” clip. This will contain a good amount of reusable routines … similiar to the FL-API that is floating around.
I know a lot of you are saying, why bother when FL 2 is just around the corner. Well, FL 1.1 isn’t going away. And, if we’ve learned anything from the browser wars, is that once something is deployed (and used) it tends to stick around for a bit.
Phones are an exceptional case, since it is quite an involved process to get software on a device. Maybe “some day” we’ll be able to push the latest FL player down to a device, but for now it’s a somewhat rigorous process.
Anyways, I digress, back to function clips.
I’ve posted a sample .fla below that shows you a fn clip, etc.
Here is the main timeline. Note the layer for the function clip. I named it “library_mc”.

If you look in the library you’ll see the sample library clip. Explore that.

Note how the timeline is setup. There is a lot of space to take care of readability, plus each layer is named correpsonding to the function label. It is a 1-1 mapping. Notice how much better it looks than trying to cram all your AS into one layer? Having all your AS sit in one layer doesn’t make much sense now does it? Use multiple layers, that’s why they are provided.

Now if you’ve never noticed or used pinning, it’s at the bottom of the AS panel. You can toggle it on/off as you work. Here it is off, so accessing another function label would load the AS for that frame. Pinning essentially holds the current AS so you can go elsewhere and work, very handy in FL development.

With the pin enabled, the AS stays the same even if you move about within the FL app. This makes it easier when debugging or expanding functionality. And now since you’ve named the layer as well as the label, you can see what routine you’re working on (immediately).

I’m not sure if the XD group will be sharing their MAX preso online or not, but I might post some additional tips later from the notes I took … and thanks for the tip John.
Print This Post




November 3rd, 2005 at 7:25 pm
Great work Scott !!
thanks for sharing your tricks !
November 3rd, 2005 at 10:15 pm
Ciao Scott,
pretty cool functionalities !
Alessandro
November 4th, 2005 at 5:11 pm
Grande Scoot,
Really good to improve the workflow!
David