March 21, 2011 - 2 comments

Root content is missing from package

With the release of Air 2.6 today I decided to venture back into the world of Air for IOS development just to see how good the improvements were. Using the Air SDK and my Ant scripts I ran into an issue when trying to compile my swf for IOS. The compiler was returning the following error...

Root content FlashIOS.swf is missing from package

Read more

December 11, 2010 - No Comments!

TypeError: Error #1006: value is not a function

A small issue that came up in my debugger today, where the following error was triggered by a Rich Text Editor.

TypeError: Error #1006: value is not a function.
at mx.controls::RichTextEditor/setComboSelection()
at mx.controls::RichTextEditor/getTextStyles()
at mx.controls::RichTextEditor/systemManager_mouseUpHandler()

The error is due to the way the font size drop down is set. We are able to set the values of the drop down via the following method.

richTextEditorInstance.fontSizeArray = [10, 20, 30];

However this format will create the error as the component is expecting a string based array, so to fix our issue we would declare our array as...

richTextEditorInstance.fontSizeArray = ["10", "20", "30"];

December 8, 2010 - No Comments!

Flash Tracking within a Facebook Tab

A recent issue I ran into involved the stats tracking of a swf within a Facebook tab using the fb:swf fbml tag. Facebook's markup language doesn't allow you to include the .js files normally associated with many tracking frameworks. The simple way to get around this is to use Google Analytics Tracking for Adobe Flash. The component makes it easy to track page views and events as the business usually handled by your .js files in handled within the component itself.

December 6, 2010 - No Comments!

Scale Bitmap with BitmapData and Matrix

Ran into small issue this morning where I needed to scale a bitmap. This was a shot of another movieclip, problem is if you scale the displayobject before taking your shot through bitmapData it doesn't scale the contents you are taking a shot of. In order to get round the issue we use the Matrix class... example code below.

Read more

October 18, 2010 - No Comments!

Available Font List AS3

Quick little tip for displaying the fonts you have loaded into your AS3 project. Once the fonts have registered run this small script to trace out the fonts available to your application.

var fontArray:Array = Font.enumerateFonts(false);
for(var i:int = 0; i < fontArray.length; i++) { var font:Font = fontArray[i]; trace(“name: “ + font.fontName); trace(“typeface: “ + font.fontStyle); }

August 13, 2010 - 2 comments

Embedding Fonts in Flex Rich Text Editor

Over the last couple of days I've been playing with the Rich Text Editor component in Flex, however when trying to use embedded fonts the editor seemed to switch to a default font. It appears that if you want to want to use custom/ embedded fonts in your project you also need to include the default Flex font (Verdana) in your styles declaration.

The reasoning is that if Flex tries to use a font that is not embedded, it will automatically switch to the use of system fonts. By default the Rich Text Editor uses Verdana, so in turn if you don't embed or locate Verdana, Flex will ignore your embedded fonts and switch to default system fonts, now for the code...

@font-face
{
src: url("assets/fonts/times.ttf");
font-family: Times;
advancedAntiAliasing: true;
unicode-range:
U+0020-U+0040, /* Punctuation, Numbers */
U+0041-U+005A, /* Upper-Case A-Z */
U+005B-U+0060, /* Punctuation and Symbols */
U+0061-U+007A, /* Lower-Case a-z */
U+007B-U+007E; /* Punctuation and Symbols */
}

Read more

June 13, 2010 - No Comments!

Unit Testing with Flash Builder and Flex Unit 4

Over the last couple of days I've had some time to look into a few features of Flash Builder, one of the exciting ones being the inclusion of unit testing. After having a quick look at online examples I was running into a few issues finding a complete example using Flex Unit 4 within Flash Builder, so here is a quick overview to get you up and running based on a mixture of examples I have been playing with.

We start by building a new flex project, >File >New >Flex Project. For this example I will just name it UnitTestDemo, keep the other settings as default (i.e. Application type: web, SDK:Flex 4), hit Finish. Now lets create a class we will perform our tests on. Here is my example class, named TestObject.

package
{
public class TestObject
{
public function TestObject()
{
}
public function returnNumberOne():int
{
return 1;
}
public function returnString(value:String):String
{
return value;
}
public function returnTrue():Boolean
{
return true;
}
}
}

This is just a simple class with a few example functions which we will run our tests on, ok... now for our test class. >File >New >Test Case Class. Create a name for your class, in this case I have named it as TestClass, Flash Builder will create folder to place these into named flexUnitTests.

Read more

June 7, 2010 - No Comments!

Posting to Social Media – An Actionscript Perspective

As more clients understand and appreciate the contribution social media has to the success of their projects, it is becoming ever more a standard for the projects I undertake to include some form of share functionality. Some of you are probably aware of the early issues faced with 3rd party APIs when using them within the Actionscript side of the project, as opposed to the javascript of the the holding page.

Lets start with the more simple side of things where users simply want to share a simple link.

Facebook
http://www.facebook.com/sharer.php?u=URL_GOES_HERE

Twitter
http://twitter.com/home/?status=STATUS_GOES_HERE_INC_URL

Add to Any
http://www.addtoany.com/share_save?linkname=LINK_NAME_GOES_HERE&linkurl=URL_GOES_HERE

Those are just some of the basics. For a slightly different scenario, how about we have created a project where the user wishes to share a custom status alongside an image for example. You will see examples of this in your "News Feed" of your Facebook Account where friends may have shared games scores which also contain a link to the game and a small thumbnail image to promote the game or application.

Read more