Tuesday, July 15, 2008

Working with Numbers (toFixed)

Ah, the joy of finding a simple method to make life easier.

Now I have always wanted the Ability to get just a few numbers from a number like 3.14567545645. I knew there must be a way to do this and now I just found it.

function toFixed(fractionDigits:uint):String

So You can do the following:

he following example shows how toFixed(3) returns a string that rounds to three decimal places.

var num:Number = 7.31343;
trace(num.toFixed(3)); // 7.313


The following example shows how toFixed(2) returns a string that adds trailing zeroes.

var num:Number = 4;
trace(num.toFixed(2)); // 4.00

The Wonders of Life in As3.

Monday, July 14, 2008

Clone functions in ActionScript 3

In AS3 it is a bit of a pain to duplicate an loaded SWF. There are a few ways to do this but they are a bit complicated. So from reading a Design Patterns Book, it gave me the idea of using a clone function on all objects that you are going to load into a flash Object.

The concept is pretty simple once you wrap your head around the concept.

Create a Class

After the constructor make a public function that creates a instance of itself.

Have that function then return that instance.



So it would look like this


Parent Movie:

var instanceMovie:ClonedMovieClass = new ClonedMovieClass();
var clone:ClonedMovieClass = instanceMovie.clone();

ClonedMovieClass:

public function ClonedMovieClass() {}

public function clone():ClonedMovieClass
{
return new ClonedMovieClass();
}


Thus you can have any number of copies of a loaded SWF or object. Now its not perfect and I will be adding more to this in a few days, but the basic concepts work.

Using Agile (SCRUMM) in a ActionScript Project

I am in the process of learning Agile Development here at the Groop. It is an interesting process to see Design, interface, business Development, and development all in the same room trying to figure out how a project will be designed and built.

I can see the worth of the system, but it can cause a lot of stress if you are the developer and you were not there at the start of the scrumm cycle. Agile systems really need for everyone who is working on the project to be there from the START of that sprint (2-6 week cycle). My Experience is that it breaks down when you have personal only coming in for a few weeks mid way through, but I understand that this is not always the case.

Anyway more to follow on the process of learning Agile in a flash development environment.

Saturday, July 12, 2008

The High Cost of Blue Ray Development (Why it will fail)

Why Blue Ray will fail

This has nothing to do with my preference in the now dead HD Wars, but it
does have to do with price, consumer apathy, technology, and the job market.

The Job Market you ask? I think the job market will have a critical impact on the Blue Ray Disks ability to be produced at a competitive cost. When I was at Technicolor, I was astounded by the lack of realization of the personal cost involved with hiring a large team of Java programmers needed for the more advanced features of BDJ.

Now a Blue Ray Author might get in the 70K range, but that is for an Author who is using bluePrint or Sonics Authoring suite. An Author does not need to have a Computer Science Degree. He Does not have to know Java.

Even if an Authoring Tool is developed to Allow for complex BDJ (Blue Ray Java) Like production (Technicolor was working on such a Tool as are others), you will still need to have Java Engineers on Staff to do the changes that always come up.

A Java Engineer with 3-5 years of experience in the Internet field can make a LOT more than 70K. I know that a AS3 Flash Developer (Which is very much like Java) with 3-5 years of Experience can make 90K to 130K range. So I can only assume that Java Engineers make more (A friend at Yahoo makes 110K with 5 years of Experience in web Java Development).

So the expense of the Personal is going to be more expensive. If they hire young programmers of Java, then once these Java Engineers figure out they are going to be paid much lower than the Internet field, they will leave. More experience personal likewise will be wanting the same sort of wages, thus large companies like SONY, Technicolor, and Deluxe will all have to rethink there staffing or not be able to keep there present staffing.

From Recruiters that call me wanting me to go back into this field, I know that the above companies are all trying to find personal to work in blue ray production. They have been for the last 2 years and they are having an extremly hard time finding works.

Personally, I think a developer would be nuts to go into such a narrow field. There are only 3-4 companies in the USA that are doing this type of work. That's It. There is no room to job hop, there is no bargaining with companies once you work there as everyone knows everyone. Once you are a BDJ Developer, then you are stuck doing that work. It would be far better for a developer to work in the Internet field with hundreds of companies to work for.

And I am not going to go into the fact (In my Thoughts) That physical Disk Media is on the way out. Just use the Netflix Direct to Your HD Feature. IT' s very close to DVD Quality and its a wonderful and convent way to watch a movie.

The Only Thing that is missing in the download to Disk market is some sort of Menu Structure. I tried to push for that development path at Technicolor in 2006, but no one was interested. Once that happens (with the Adobe AIR Media Player?) Then much of the reason to have a disk is gone.

But If the recruiters are anything to go by, then the tradition development companies are having a very hard time finding people to work on BDJ for the pay they are offering. Unless thoses companies realize that we are no longer doing disk development but software development, then I do not see any change in the market place.

Ta, Clive

Wednesday, January 23, 2008

Embedding an Font in Flash/Eclispe

I have had a interesting time of trying to get an embedded font (In the Library of Flash) to be dynamically assigned to a created Dynamic Text Field.

Now in Flash (CS3) it looks like this
(In the Library, the Fonts Linakge class name is "BradyBunchRemastered")

var rewardTxtNew:TextField = new TextField();
var _textFormat:TextFormat = new TextFormat();
var tEmdFont:BradyBunchRemastered = new BradyBunchRemastered();

_textFormat.font = tEmdFont.fontName;

rewardTxtNew.defaultTextFormat = _textFormat;
rewardTxtNew.embedFonts = true;

Well In Flex 3 it looks like this
[Embed(source="c:/windows/fonts/BradBunR.ttf", fontFamily="Brady Bunch Remastered", fontName="BradyBunchRemastered")]
private var BradyBunchRemastered:Class;

var rewardTxtNew:TextField = new TextField();
var _textFormat:TextFormat = new TextFormat();
var tEmdFont:Class = new BradyBunchRemastered();

_textFormat.font = tEmdFont.fontName;

rewardTxtNew.defaultTextFormat = _textFormat;
rewardTxtNew.embedFonts = true;

But Now we get some wonderful compile Time Errors. Since Eclipse does not know what BradyBunchRemastered is it will throw an Error.

If you add a var to reference the font
public var BradyBunchRemastered:Font;

Then the compile errors go away but it does not work in flex.

Now you might ask why not just compile this in Flash or Flex and be done with it. Well as the Container.swf file that holds this application has a reference to the applications class file for correct typecasting and the Container.swf must be complied in Eclipse. The application has a timeline so it must be compiled in flash.

So what I have is a issue with the difference in coding for Flex VS Flash.

Any Ideas?