23 April 2009

ActionScript Elevator System

My latest project belongs to '100% Useless Creations' category. It's an Elevator system which simulates how elevator works (imagine that!).

For start, I don't have stage independent elevator, but when project is finished it will be implemented. Instead I have whereIsIt function which locates elevator position based on elevator movie clip position.


function whereIsIt():Number {
var elPos = Math.floor(Math.abs(elevator_mc._y - 350));
return elPos;
}


I have 2 Boolean values 'up' and 'down' for elevator movement direction. Array calls holds values representing floors where elevator is heading next. When it reaches its destination, calls.shift() is called and than wait function. This function stops the elevator for given number of frames, in this case 36.


function wait() {
if (waitCounter > 0) {
waitSemaphore = true;
waitCounter -= 1;
}else{
waitSemaphore = false;
waitCounter = 36;
}
}


When system starts, variable waitSemaphore is set to false. This variable and wait function are basically simple counter, command which tells the elevator to stop for 36 frames before it goes to the next floor.

Besides gotoFloor function only function left is onEnterFrame function for elevator movie clip.


elevator_mc.onEnterFrame = function() {
if (calls.length > 0) {
gotoFloor(calls[0]*50);
}
if(up) {
this._y -= 2;
}
if(down) {
this._y += 2;
}
// trace("elevator is at: "+whereIsIt()+" floor.");
}


flash actionscript elevator system image preview

.

14 April 2009

ActionScript3.0 Open Source Flash Charts

If you need to reduce coding time in your Flex / Flash / RIA projects most common solution is to use some open source framework or previously coded stock Flash files. Just a few of those offer such a great option to work with like Open Flash Charts 2 does, with LGPL license.

Version 2 of Open Flash Charts is recoded to ActionScript 3.0 and compiled with Adobe Flex. Data format used is simple to use and widespread JSON. Libraries for other languages already exist if you are more into Ruby, .net, Perl, Java, Pyton, GWT, SmallTalk or Pentaho.

as3.0 open source flash charts logo
Many already use Open Flash Charts and one of the latest is publishing service Triond. They have implemented it just recently as user dashboard information element for tracking visitors and referrals. Really cool addition to their service.

.

09 April 2009

AS3.0 in less than 140 characters #tweetcoding

If you have somehow missed #tweetcoding contest like I did you may wonder who the winners are and who won Flash CS4 or AdvancED ActionScript 3.0 Animation book.

Here are my favorites:


Since contest's name suggests there will be more than one round, I hope I'll catch next one.

.

06 April 2009

Good Usage of Flex Open Source Component

Ability to be familiar with and to make use of already published open source flex components is very important. This can save time (and money) in developing process to extremes.

Take a look at Flex Image Cropping Component by Paul Whitelock. This useful component is licensed under the MIT license.

flex open source component preview
Another developer has used this crop tool functionality for his own ImageSizer AIR application. Component works perfectly with app idea and instead of building it from the scratch developer (James Ford) has reduced significantly time needed to upgrade his great app.

ImageSizer Adobe AIR application preview
There is no need to start from blank sheet. In fact, reusing existing code, open source components and frameworks is a must, but be careful and try to calculate time needed for mastering those assets. Sometimes it's maybe more productive to build something on your own, but that depends on developer(s) quality and project demands.

How much open source code do you use in your projects and how do you feel about it?

.

02 April 2009

Flanture is now open for Guest Bloggers - get extra exposure

When to allow guest posting? This question requires some analysis about what goals blogger wants to achieve and my goal is simple. While I want to see more Flash Platform related posts on this blog I think it's also important to allow others to get some extra exposure for their ideas. Helping others and injecting some freshness in this blog at the same time.

One of the motives for allowing guest posting on this blog is my recent insight about steady traffic growth over the past few months. Last month (March 2009) Flanture finally reached 10.000 visits and 15.000 page views per month. It's a good milestone to start with something new.


What you'll get? Do the math for yourself, if your post stays on home page for only 10 days, that's at least 3.000 impressions. Plus, additional views many months later. I will never delete your post.


What kind of posts? Anything Flash. This includes but is not limited to: Flash tutorials, ActionScript2.0 or ActionsScript3.0 posts, Flash Authoring Tool posts, Flex, posts about your new cool Flash Template (why not), widgets, Adobe ramblings, news and events, etc ...

Only original thoughts please, no copy/paste techniques and no affiliate links. My idea here is to give back to community and I will not allow free backlink service. You will get single (OK, maybe two) links and that's it.

How? Leave comment, contact via flanture [at] gmail or via twitter.

Share this info, someone may find it useful.
Thanks.
.

 

template by blogger templates