Archive

Posts Tagged ‘AS3’

AS3 liquid layout class

April 8th, 2009

I’m sure everyone has needed one of these at one time or another. I just decided to finally get one together for myself.

To use, you first call StageAlignTool.init() and pass in the stage, and optionally a minimum width and a minimum height (defaults to 1024×768).
Next, you call StageAlignTool.registerLocation() and pass in the displayObject you wish to register, which position you wish it to lock to (StageAlignTool .TL means Top Left, StageAlignTool.MC means Middle Center), and optionally if you want it to stay relative to where it is now (true) or snap to the edge of the stage (false).
The class automatically sets your stage scale mode to NO_SCALE and the stage align to TOP_LEFT. It also expects the display objects you pass it to have their registration points in the top left corner.

Download

Usage:


//StageAlignTool.init(Stage reference[, min width = 1024, min height = 768]);
StageAlignTool.init(stage, 1024, 768);

//StageAlignTool.registerLocation(a DisplayObject, position to lock to[, stay relative to current = false]);
//possible locations are [StageAlignTool.]TL, TC, TR, ML, MC, MR, BL, BC, BR

StageAlignTool.registerLocation(bg, StageAlignTool.MC);

Give it a try and tell me what you think.

Julian Work , , , ,

AS3 bitmap mosaic class

October 1st, 2008

This class will allow you to create a pixellated copy of any display object.

It allows for varying pixel sizes and caching of rendered pixels so you don’t have to redraw them every time.

mosaic

Usage is as follows:

var myMoz:Mosaic = new Mosaic(yourDisplayObj:DisplayObject, pixelSize:uint, useCache:Boolean);
addChild(myMoz);

or

var myMoz:Mosaic = new Mosaic(yourDisplayObj);
myMoz.pixelSize = 10;
myMoz.render();

Give it a try and let me know what you think.

Julian Personal Projects , , ,

Energizer – Plan Prepare Protect Weather Widget

August 22nd, 2008

This is a Desktop Weather Widget that connects to a custom web service and displays weather warnings and information for your area. It find your location automatically and will keep you up to date on the weather. It was created using Adobe AIR and Flash CS3 (AS3).

Visit widget download site

Julian Portfolio , , , ,

Chugging along on Fless, the WordPress Flash front-end

March 28th, 2008

I’ve spent a day or two reformatting and tightening up the code I left lingering on the Fless project I started.

Here is the example

It doesn’t look like much but it shows the ease of use of the framework.

Here is the code to create the basics:

public class Main extends MovieClip{

public function Main(){

var blog:Fless = new Fless();

blog.phpURL = “http://yourwebsite/getPost.php”;

blog.addEventListener(PostEvent.UPDATE, postsReady);
blog.getPosts(0, 20);

}

private function postsReady(e:PostEvent):void{
trace(“posts ready”);
trace(e.posts);

var curPost:CurrentPostView = new CurrentPostView(e.posts[0]);
curPost.x = 50;
curPost.y = 50;
curPost.width = (stage.stageWidth / 2) – 50;
curPost.height = stage.stageHeight – 100;
addChild(curPost);
}

}

I’m definitely looking for input from Flash devs that use WordPress to see what kind of features they would like.

Julian Personal Projects , ,

Web Services in AIR (Flash CS3)

March 19th, 2008

I have been banging my head against a wall for days. I am trying to get web services to work in an AIR app built with Flash CS3. My co-workers use a solution that works for Flash only http://labs.qi-ideas.com/2007/12/25/using-flex-compiled-code-within-flash

But every time I tried to use it with an AIR app it would crash.

I then found http://manmachine-tech.blogspot.com/

but after days of frustration I found a critical bug:

In the WSProxy class there is a variable _busyOnCall = true; that gets set within callMethod()

and it gets set to false in onComplete()

but it NEVER GETS SET IN onFault

After that it’s all good. I hope this helps anyone in the same boat as myself.

Julian Work , , ,

How do I use Yahoo! Maps API in Flash CS3?

February 14th, 2008

I was really excited about the new Yahoo! Maps API coming out for AS3 and I happily applied for a developer key and downloaded it. However, it’s compiled for Flex! How the heck am I supposed to use this? Is there some source repository I can get a hold of so I can use the classes in Flash CS3? There’s no apparent reason for it to be limited to Flex as far as I can tell. Anyone have any thoughts?

Julian Work ,

SWF Capture AIR app

December 7th, 2007

I’m currently working on an AIR app that will load a SWF, take screen grabs at a selected interval and then load the screen grabs back in and allow you to scrub back and forth through them.
The main purpose for this is that many things my coworkers and I do at RT is entirely dynamic and code based with very little on the timeline. This app allows for selecting a specific frame in any SWF, code or timeline based, and for playing back the animation many times repeatedly.
A side benefit to the app is that when creating backup GIFs for banner ads, if you run your banner through this app, will spit out cropped captures of your banner ad and may speed up the most boring part of banner ad creation.
If you’re feeling daring you can install this alpha version of SWF Capture and see how it works
I’ve got a lot of features left to build in but this does the basics.

Also, if you’re interested I’ve got my Flapture FLV Capture toolavailable too. It automates one screen grab per FLV for a folder full of FLVs and was how I learned the basics of AIR.

Julian Work , , , ,

fless v 0.00001 alpha

November 21st, 2007

It ain’t much but this is what 0 – 1 hr of PHP knowledge and 4 months of AS3 knowledge will get you in an afternoon.
fless

Julian Personal Projects , , , , ,

Latest project: save-my-relationship.com

November 8th, 2007

See my latest at:

http://save-my-relationship.com/

It is a landing page for a banner campaign for Energizer’s Energi To Go iPod charger. The concept was mocking ‘relationship aide’ products such as Viagra or even dating sites. One huge bug though is that something with the Tween class in ActionScript 3 makes some tweens just decide to up and stop when running in Firefox, which means that if you’re visiting with FF you’ll only see the HTML page :( If you would like to give me your feedback on the Flash version it’s directly linked here

Julian Work , , , ,