Ran in this issue today, similar to the old onMetaData error where we would always have to include an onMetaData handler even it we didn't need to use it. To fix the latest issue and stop the error event simply add in an onXMPData handler similar to the one below...
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.
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.
When working with 3rd party API's you may sometimes find yourself running into issues with a lack of definition. A small helping hand can be found in the describeType() method that produces an XML object that describes the class and its methods and properties.
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.
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.
public class TestObject
public function TestObject()
public function returnNumberOne():int
public function returnString(value:String):String
public function returnTrue():Boolean
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.
Lets start with the more simple side of things where users simply want to share a simple link.
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.
Just a quick issue I ran into today whilst trying to make use of runtime font loading inside Flash Builder. Where as before in Flex 3 it was a simple case of creating a class to construct a swf that would then be loaded in the main application. Today I ran into an Error #1014 - Class mx.core::FontAsset could not be found, when running the main application.
The fix as it seems is to add this to the compiler arguments of your font library swf.
Now if like me you use Ant Builder to compile your projects - simply add to your mxmlc tag within your ant script as shown here
Update:Adobe mention a fix to the noticeable file size increase. It appears that the increase is due to it including all classes that our "classes inherit from plus other framework dependencies" so we need to amend this script a little to something more like
As many of us know, memory management in any good size project is a topic that particular attention must be paid to. Over the last 12 months I have seen myself carrying out more and more research into memory management, in a recent project for example I was able to bring the memory usage of a website down by almost 30% in a matter of minutes by integrating simple techniques that I adopt in my own project builds.
In the words of Grant Skinner, "With great power comes great responsibility", and as we find ourselves building more complex applications it is important we consider the internal Garbage Collector and help it carry out its chores. The understanding of the Garbage Collector is another topic in itself, this post is merely a few pointers which I use as a rule of thumb in my work flow.
Add an Event.REMOVED_FROM_STAGE listener to instance which calls in built function to tidy up assets for garbage collector
Use weak event listeners
Remove/ set to null any variables passed into the instance/ container
Set to null any strings contained by components e.g. label.text = null / image.src = null