Tag Archive | "AS3"

Create A Flash Countdown Timer in AS3 Using A Class

Create A Flash Countdown Timer in AS3 Using A Class

Due to the popularity of one of my earlier posts, I’ve decided to extend the topic with a helpful Countdown Timer class. This handy utility provides a flexible and easy way to tie in countdown timer functionality into just about any design. It is designed to handle the grunt work of developing a Countdown Timer. It is not meant to replace the Countdown Timers available to the Flash community. It is purely meant to easily implement Countdown Timer functionality to you own custom design without reinventing the wheel.

Features Include:

  • Easily define a new Countdown Timer instance
  • Access to the countdown’s remaining days, hours, minutes and seconds
  • Easily update the target end date
  • Custom events that trigger upon Countdown updating and on complete

Getting started creating a fresh Countdown Timer

Implementing your new countdown timer design will require minimal ActionScript as the this utility will handle key events and updating of the remaining time.  All you need to implement this countdown functionality is a design and some time.  Enjoy!

Step 1: Importing the necessary classes

In order to use this utility within your Flash file, you would need to import the following two classes: CountdownTimer.as and CountdownEvent.as. Note: Make sure that the classes are local to your .fla file or if you are more comfortable modifying your ActionScript settings to accommodate the location of the classes, feel free doing so.

// Importing of the CountdownTimer Class
import com.flashspeaks.utils.CountdownTimer;
// Importing the CountdownEvent (used to update and notify upon countdown completion)
import com.flashspeaks.utils.CountdownEvent;

Step 2: Creating a new Countdown Timer Instance

Creating a new instance of the Countdown Timer is as easy as defining a new Countdown Timer instance and providing the target end date within the parameter. The values needed are the target year, month, and day. There are also optional hour and second values just in case you needed extreme flexibility in the target end date.

// This creates a new CountdownTimer instance and sets it target end date
var myCountdown:CountdownTimer = new CountdownTimer(year, month, day, hour(optional), second(optional));

Step 3: Retrieve the remaining days, hours, minutes, and seconds

In order to provide flexibility, I have provided public properties to obtain the days, hours, minutes, and seconds remaining separately allowing you to determine how you would like to display the remaining time. There is also a property called time that will return the remaining time as a whole number separated by colons. (00:00:00:00)

In order to retrieve the time, a new COUNTDOWN_UPDATE event listener needs to be established as it will be mapped to a function that will update upon every tick. It can be easily done like so.

myCountdown.addEventListener(CountdownEvent.COUNTDOWN_UPDATE, onCountdownUpdate, false, 0, true);

function onCountdownUpdate(e:CountdownEvent):void {
 // Update on screen visuals like text
}

Countdown has expired…what to do?

One of the requested key features was a way to easily determine when the countdown had expired. Some wanted to load a new timer, change on screen text to read 00:00:00:00 ,etc. Setting this up using CountdownTimer is fairly easy. To do so, you would essentially create a new COUNTDOWN_COMPLETE event listener and supplying what it is that you would like to occur within the event handler function. Check it out below!

countdown.addEventListener(CountdownEvent.COUNTDOWN_COMPLETE, onCountdownComplete, false, 0, true);
function onCountdownComplete(e:CountdownEvent):void {
 // Countdown finished...
 // HAPPY NEW YEAR
}

Change the target end date on the fly

Another huge request was to provide a solution to easily update the target end date via run-time. CountdownTimer provides a function called updateEndDate(new Date()) which allows you to simply provide a new target end date through its parameter. Your on screen visuals will automatically update to accommodate the new end date.

For example, let’s say you wanted to add a month to the target end date every time that it has expired you can to so by simply adding one month to current month within the onCountdownComplete event handler.

Complimentary Flash Countdown Timer design

What’s good Countdown Timer functionality without a good Countdown Timer design? Here’s a complimentary design that I will be providing with the download. It includes the example source and provides all of the source from this tutorial. Feel free to implement your own design! I’d love to see them!

Get Adobe Flash player

Download example files

Posted in Custom Classes, Flash TutorialsComments (0)

How To: Reverse Any Given String Using AS3

How To: Reverse Any Given String Using AS3

Reversing a string is not something you might implement on a daily basis, however, having a handy way of doing so is always a great go to option. Here is a function that allows you to input a string of any length and it will then be outputted being reversed. This is definitely one function to add to your Flash utilities.

Enjoy!

Reverse Any Given String

function reverseString(tString:String):String {
var tmp_array:Array=tString.split("");
tmp_array.reverse();
var tmpString:String=tmp_array.join("");
return tmpString;
}

Source Demonstration

Get Adobe Flash player

Download source

Posted in SnippetsComments (3)

FlashEff 2: Still The Most Innovative Flash Animation Tool

FlashEff 2: Still The Most Innovative Flash Animation Tool

With the high demand for quality Flash content in the market, finding a way to reuse ActionScript and animation styles is key to the success of quicker turnarounds. In my opinion, FlashEff is probably the most mature Flash tool to provide that heavy lifting in Flash projects.

Personally, there is no other tool available that can provide an instant boost in your Flash project work flow than FlashEff when it comes to custom animation/effects. Initially, when FlashEff was first released, I was extremely impressed with the tool. There was a little bit of a performance issue, but FlashEff was still worth every cent and nothing came close to it.

Out goes FlashEff 1, in comes FlashEff 2

Recently, the second version of FlashEff was released and once again my mouth drops in awwh! FlashEff 2 simply improves upon its previous features like speed, usability, effects, and customizability. New features that you can expect with the release of FlashEff 2 include:

  • Live Preview
  • Improved filter effects
  • Flash Player 10 features
  • Advanced Copy/Paste
  • Advanced Commands
  • FlashEff 2 Code Component
  • Better TweenLite performance
  • New Button mode
  • Save custom effects

Take it for a test drive

Pattern Showcase DemoPattern Showcase Demo

Here you can see a little bit of all Symbol, Text and Filter patterns that come with FlashEff 2.

FlashEff 2 Panel DemoFlashEff 2 Panel Demo

Take a quick online tour of FlashEff 2 Panel. Browse patterns and over 3000 effects to see exactly how the user experience got improved.

Overall Impression

When it comes to rapid application of custom,quality Flash animations and effects, FlashEff sets the bar really high. If you haven’t yet given FlashEff a try or are skeptical, download the free version and take it for a test run. You will be amazed on how easy it is to create custom quality Flash animations and effects.  Below are links to videos demoing FlashEff and more of its features in depth.  Enjoy!

New videos demoing FlashEff 2

FlashEff 2 Quick OverviewQuick Overview

A quick overview of what FlashEff 2 has to offer. Learn how to create show/hide animations, add filters and make flash interactive buttons in just a few clicks.

FlashEff2 What's NewWhat’s new in FlashEff 2

Find out what’s new in FlashEff 2. The basic new features and overall experience delivered by FlashEff 2.

Getting started with FlashEff 2Getting started with FlashEff 2

A complete step by step tutorial that will take you through all the most important features of the product, showing you how to obtain successful results using FlashEff 2.

Free Version of FlashEff 2Free Version of FlashEff 2

Find out what you can do with the FlashEff 2.0 free non-commercial license.

Posted in Featured, Flash ComponentsComments (2)

Understanding Adobe Strobe A Little Bit Better

Understanding Adobe Strobe A Little Bit Better

A few months ago, I was introduced to the concept of Adobe “Strobe” and quite honestly I was a bit confused on the reasoning behind the project. The confusion was built up due to Adobe’s efforts on the Open Video Player project and Strobe project. The two similar projects had intentions on standardizing the market’s video players. So why two?

With the release of new documentation on Adobe “Strobe”, I can now say that the confusion I once had is now gone and I can’t wait for the official release of Adobe “Strobe”. While these two projects are similar, they both serve two different purposes and look to standardize those efforts. Actually, the Open Video Player initiative will aid the development and standardization of the Adobe “Strobe” project as it leverages code from the Akamai’s Open Video Player.

More About Adobe “Strobe”, Now Called Open Source Media Framework

Late last month, Adobe announced that Adobe “Strobe” is going open source and being renamed to Open Source Media Framework. This is great news and indicates the extent of the efforts on this project. Once again, I have to say to thank you to Adobe and its partners for contributing their efforts to a great cause.

So what is the Open Source Media Framework

Now that the confusion is out of the way,let’s talk about what this framework will be able to do. Adobe’s new media player framework simplifies the development of media players by enabling developers to assemble pluggable components, creating high-quality, full-featured playback experiences. Its open framework enables collaborative development for future web video monetization, with lower costs and faster turnaround. To learn more, visit the home of this new Open Source Media Framework.

Features (To name a few):

  • An Open and standard framework
  • An open plug-in architecture
  • Drag and drop component architecture
  • Flash Media Server integration/support
  • Content delivery network integration
  • Skinnable
  • Custom measurement/analytical reporting
  • Many more…

Video: The Adobe Ones Answer Some Questions

Additional Resources:

Posted in Industry NewsComments (0)

ActionScript 1:1 – Getting Intimate With ActionScript 3.0

ActionScript 1:1 – Getting Intimate With ActionScript 3.0

Struggling to get our foot off the ground with getting more intimate with ActionScript 3.0?

Doug Winnie has kicked off a series, ActionScript 1:1, which is designed for animators and designers using Flash CS4 who want to take their work to the next level but need some guidance adding custom interactivity using ActionScript 3.0.

These videos are aimed at Flash Designers looking to strengthen their knowledge of ActionScript 3.0.  We all have to start somewhere when learning to use ActionScript 3.0 and this series is great way to get that train moving along.

Below are all the episodes in the series.  You can also find Doug’s videos as a channel on Adobe TV and iTunes.  Enjoy!

Welcome to ActionScript 3

Welcome to ActionScript 3.0

Doug Winnie gives an overview of his new series in which you will learn the fundamentals of ActionScript 3.0. Get up and running in Flash Professional using ActionScript 3.0.

Working with the Actions Panel

Working with the ActionScript Panel

Understand how to use the Actions panel and use the trace statement. Doug Winnie walks you through the code to control objects created in Flash.

Accessing Object Parameters

Accessing Object Parameters

Doug Winnie demonstrates how to access properties of an object such as size and location by using instance properties with ActionScript, sending messages to the output console.

Changing Object Parameters

Changing Object Parameters

In order to manipulate objects, Doug Winnie uses the assignment operator in ActionScript 3.0 to instantaneously overwrite values initially assigned in Flash.

Exploring Named Library Assets

Exploring Named Library Assets

Dive deeper with the Library panel and learn more about how to name instances on the stage, and how to use the Linkage panel to name objects in the Library panel.

Adding Named Objects to the Stage

Adding Named Objects to the Stage  // Image

In this video, Doug Winnie teaches you how to use ActionScript to dynamically add objects to the stage using code and the DisplayStack.

Working with Comments

Working with Comments

You can use comments to document your ActionScript code for other Developers to use. Doug’s tutorial sums up the benefit of building up good coding practices.

Fundamentals of Functions

Fundamentals of Functions

Doug Winnie provides an introduction to functions and explains how to efficiently use them in ActionScript by grouping commonly used tasks together as a named function.

Accepting Values in Functions

Accepting Values in Functions

Doug continues his tutorial on how to efficiently use functions with ActionScript. With functions you can customize their functionality by assigning parameters and values.

Returning Values from Functions

Returning Values from Functions

Doug Winnie wraps up his lesson on functions by explaining how to retrieve results for the output panel with the return statement.

Mathematical Operators

Mathematical Operators

Doug Winnie teaches the basics of calculating mathematical operations in ActionScript code, including commonly used shortcuts to save coding time.

Order of Mathematical Operations

Order of Mathematical Operations

In this video, Doug Winnie reviews how Flash calculates math based on a specific order of operations.

Events and MouseEvent Handlers

Events and MouseEvent Handlers

Discover the power of events and how you can quickly and easily build event handlers. In this episode, Doug covers how to use events to build interactivity with the mouse.

Create a Timer

Create a Timer

Using your advanced knowledge of ActionScript, Doug Winnie walks you through on how to combine time events with event listeners to create and control time-based events.

Create a Clock

Create a Clock

See Doug build a clock in Flash using ActionScript to manipulate objects’ properties and add mouse and timer events. Everything you’ve learned from his tutorials is combined into one project.

Posted in Flash TutorialsComments (1)

Becoming An Experienced Flash Developer

Becoming An Experienced Flash Developer

With the Adobe Flash Platform expanding into more markets indicates the need of ActionScript/Flash Developers to expand their knowledge to the match the growth of the industry.  So what might one be benefited in knowing to becoming a better ActionScript/Flash Developer?

Grant Skinner has put together a solid checklist of skill sets that an experienced ActionScript/Flash Developer should consider having.  It’s not the bible but it is definitely a great model for success as a ActionScript/Flash Developer.

Grant’s Checklist

Skills I would expect any experienced Flash Developer to have include:

  • ActionScript development (obviously)
  • OOP experience
  • Some experience with architecture / design patterns
  • Code standards
  • Data services integration: XML, JSON, SOAP, etc.
  • Problem solving
  • Debugging
  • Optimization, both code and graphics
  • Quality testing
  • Reasonable understanding of UX and interaction design
  • Basic graphic design and motion graphics skills (enough to understand and implement designer concepts)
  • Graphics import
  • Basic skills with Photoshop, Illustrator, and Fireworks (for tweaks / exporting art)
  • Basic understanding of video / audio compression
  • Programmatic motion
  • Writing (for team / client communication, documentation, comments, etc)
  • Verbal communication and interpersonal skills for team / client interaction
  • Experience working with Flash and the timeline
  • Experience with an external code editor (ex. FlexBuilder, FDT, FlashDevelop)
  • High level understanding of Flex, FMS, Remoting, FlashLite, AIR and other core Flash platform products / libraries
  • High level understanding of server development and databases (not necessary an ability to implement anything, but a small amount of experience / understanding of the models)
  • Basic understanding of HTML, JS, CSS
  • Integration with HTML, JS
  • Community awareness (online resources, frameworks, etc)
  • Basic math – understanding and combining +, -, /, *, %, exponents and basic trigonometry (sin, cos, atan2, etc)

Hmmm…

Personally, I’ve always felt to become a reliable experience ActionScript/Flash Developer, you have got to know the ins and outs of Flash and how it can interact with the outside world.  Without that knowledge, you potentially strip the use of Flash of what it is most capable of doing with its diverse integration.  In other words, I think that the list that Grant provides is pretty spot on.

But hey that’s my opinion.  How do you feel?  Do you agree with the checklist that Grant has put together?  Feel free to express your opinion below or head over to Grant’s blog and join the controversy there.

Posted in Industry NewsComments (10)

Smart SWF Optimization with Custom Framerates

Smart SWF Optimization with Custom Framerates

Over the years, the Flash Player has received such a bad rep for hogging computer system resources even while displaying static content. There were many times in which I would wonder “What the heck is Flash processing?”. As for Flash Developers/Designers, there was only so much we can do to optimize the SWF via runtime. That was then, this is now! In Lee’s latest video tutorial, he demonstrates how you can dynamically change your movie’s framerate to use only the resources it needs.

With its introduction in AS3, you can dynamically change the framerate of your SWF movie. In an earlier tutorial, I demonstrated how you can change the framerate of your SWF and how it will effect a frame by frame animation.

By leveraging the ability to dynamically change the framerate of your SWF, it will allow you to take advantage of idle moments in your Flash applications by changing the the framerate based on the content being displayed. It’s a simple, yet great concept.

Check out Lee’s video, SWF Framerate Optimization, to learn more on how to implement such a concept. Enjoy!

Posted in Flash TutorialsComments (2)

Debugging Your Flash Applications With De MonsterDebugger

Debugging Your Flash Applications With De MonsterDebugger

Debugging your Flash applications can take some getting used to.  Especially, if you’ve never used a debugger before. Having the right tool to aid in debugging your Flash Applications can save a boat load of time.  Also when debugging, the debugging tool used should provide easy access to your ActionScript data with little of a learning curve. An innovative debugging tool that I have been pretty fond of lately has been De MonsterDebugger.

De MonsterDebugger

What is De MonsterDebugger?

These days my ActionScript 3.0 debugger of choice has been De MonsterDebugger.  De MonsterDebugger is an easy to use open source debugger for Adobe Flash,Flex, and AIR created by the guys over at De Monsters.  Not only does it provide an Adobe-styled familiar interface, but it comes in a convenient Adobe AIR Application.  It’s impressive list of features make it a tough debugger to compete with.

DeMonster Debugger comes with an impressive set of features:

  • Can be used with Adobe AIR applications
  • Can be used with Adobe Flex applications
  • Can be used with full screen Adobe Flash applications
  • Trace strings, numbers, objects, arrays, XML and even custom classes
  • Trace the complete structure of multilevel objects
  • Trace messages in custom colors
  • Explore your live application
  • Edit properties at runtime
  • Run methods and get the results at runtime
  • Application is lightweight
  • Auto update
  • Look and feel of Adobe CS4
  • Customizable interface
  • Highlight display objects
  • Client class included
  • Example application included
  • FDT templates included

The one feature that is probably missing from it’s feature set is probably the ability to step through break points, but hey, I won’t be picky. :) It is still a great debugging tool and best of all it is open source!

Check out the video rundown on De MonsterDebugger!

Debugging with MonsterDebuggerBe sure you check out this video created by Lee Brimelow as he demonstrates some of the coolest features this slick debugging tool has to offer.

Additional Resources:

Posted in Adobe AIR Applications, Featured, Flash ToolsComments (0)

TxEff2: An Improved Update To An Already Impresive Tool

TxEff2: An Improved Update To An Already Impresive Tool

The guys over at Jumpeye have recently released an update to their exiting flash text effects component, TxEff.   This is an update which targets improved performance, quality, and Flash integration.  The great thing about TxEff is that it allows you to create quality effects and transitions with little effort and time and saving time is huge when dealing with multiple Flash projects.  Learn more about TxEff2 below.

What is TxEff2?

TxEff2 is a Flash CS3/CS4 AS3 component created for easing the text animation process. TxEff2 is also a framework based on patterns, a large collection of classes, which enable cool show/hide and swap transitions on texts.

TxEff2 comes with cool new features

  • Better architecture (based on the FlashEff engine)
  • Improved performance (thanks to TweenLite)
  • Lower file-size
  • Seamless pattern import
  • More patterns (100+)
  • Filters (like reflection, glows, stripes)
  • Compatible with FlashEff effects and patterns
  • Cool new visual User Interface
  • Swap through different texts (not only show & hide)

TxEff2 vs FlashEff

If you’ve ever heard of or used FlashEff before you might be asking yourself what is the difference.  Well TxEff is based off of the FlashEff engine which takes advantage of the FlashEff Panel and FlashEff patterns, however, there are some limitations.  While FlashEff allows you to apply the effects to MovieClips along with TextFields, TxEff2 is limited to just effects on TextFields.  Here is a chart that compares the both TxEff2 and FlashEff.

Note: Be sure to subscribe to the RSS feed as there will be a contest giveaway of TxEff2 very soon.  Stay tuned!

Posted in Featured, Flash ComponentsComments (0)

CopperCube: A New 3D Engine That Doesn’t Require AS Knowledge

CopperCube: A New 3D Engine That Doesn’t Require AS Knowledge

3D engines that take advantage of the Flash Player seem to sprouting about very frequently.  Whether or not these new 3D engines effectivly target a specific market can be left for debate.  One new 3D engine that has caught my eye is CopperCube as it targets individuals that are not familiar with ActionScript but can provide the 3D knowledge that many of us just don’t have.

What is CopperCube?

CopperCube is a 3D engine with deployment targets for Flash (.swf) and Windows(.exe).   You can create simple interactive 3D scenes without the need to write one single line of code (=no programming necessary), or even create whole games with the help of a little bit scripting magic.

It includes an easy to use 3D editor which imports 17 different 3D file formats and is able to create interactive 3D .swf files with physics, lighting and more or even single standalone Windows .exe files with a built-in high speed, hardware
accelerated 3D engine
from your interactive 3D scene, which are easy to distribute and do not need an installer.

CopperCube was created by Ambiera, a game middleware and custom game solutions software development company.

So what is CopperCube capable of?

CopperCube Panorama Demo

CopperCube Panorama Demo

CopperCube Game Demo

CopperCube Game Demo

CopperCube Lighting Demo

CopperCube Lighting Demo

Is it Open-Source or Free?

Unfortunately, CopperCube is not free nor open-source however, there is a plan to offer a basic and pro editions of this application.  Also, CooperCube is free for 30 days, and there is a discount for people who decide to buy a license while it is in beta testing phase.

Interested?

Ambriera is currently looking for some active testers who can provide feedback during the product’s beta phase.  If you are interested, you can download the beta an give it a shot.

Posted in 3D EnginesComments (0)

Page 1 of 912345...Last »