Google, RSLs and indexing

A while back I posted an article on Google giving errors with indexing SWF files that used the RSL framework feature to reduce the overall size of your SWF. It seemed to me very odd that you have Adobe trying to push the use of RSL’s as well as bumming up the great work that they’ve done with Google to index SWFs but not mentioning that fact that Google couldn’t index a SWF with an RSL. This lead people to see errors when they tried to find their app in a Google search.  See this for details http://kennethsutherland.com/2009/04/27/google-and-swfs/

Anyway good news, finally Google can index SWF files with external resources.  This news came out a few days back, but due to my blog needing fixed (it was breaking FF – wordpresses fault:( ) and other things going on blah blah…

Well here is the annoucement from Google – http://googlewebmastercentral.blogspot.com/2009/06/flash-indexing-with-external-resource.html I have yet to try this out, but if it works as it say it does then great. another bonus for using Flex.

[ad name=”ad-1″]

Doom and gloom or a new beginning

Redundancy… world shrinking economy… depression… company cutbacks… is this a bleak time or is it a time to make and face new challenges in the RIA world (particularly in the Flex and Actionscript areas)?

Well after the unfortunate news that the company I work for are no longer wishing to partake in the RIA party that’s changing the way we look at and use the web/desktop and hence are making myself redundant. I’m looking at this as a great opportunity to expand my knowledge so that I can work with as many forward thinking companies as possible that deal with Flex/Actionscript/AIR or for that matter any RIA technology.
Also I should now have more time to create and sell my own components, of which I had a cracking idea this morning (more on this later hopefully).

Hect I’ll event look at Silverlight or JavaFX 🙂 if I get the time or the chance. So anyone out there fancy taking on a new contractor with 4 years+ experience in Flex as well as a bunch of other languages I’ve used along the way before I even heard of Flex.

Feel free to contact me at this address.

Get Adobe Flash player

I’m going to continue to post hints and tips on anything I do as well as posting any new components so watch this space and feel free to contact me if you need any work done in the UK, remote working is always an option as well.

[ad name=”ad-1″]

Simple tip #2 – random colours

Their are so many times I’ve used a random colour in my apps (mainly for testing) that I thought I’d add this way of using a getter method with actionscript to simplify the process.

First of if you haven’t got one already, create a uiltily class so features that you use regulary across projects (you could turn this file into a SWC and reference that in you various projects – now that I think about it I explain this as simple tip #3 🙂 )

So inside your utility class place the following code

public static function get randomColour() : uint {
	return Math.random() * uint.MAX_VALUE;
}

Then lets just say you require a random colour for anything just call Utility.randomColour, no brackets, no = signs. Because you’ve set the function as a getter using the function name will be enough. This method also means that you don’t need to remember the max/min values for a colour. The uint min and max values are the same as the the min/max values for colours.

e.g.

<mx:Canvas backgroundColor="{Utility.randomColour}"
   width="600"
   height="600">

Utility is the name of the class that holds my utility functions.

Previous Tip

Next Tip

[ad name=”ad-1″]

Simple tip #3 – Utility SWC (library project)

Do you frequently use simple actionscript functions in more than one project. Perhaps you’ve got a function to do tracking, parse strings to dates, or return a random colour etc.

I’m sure most folk will have struggled to think of what project they last used a generic function ABC in as they could do with using it for project XYZ and would rather spend 30 mins searching for said function rather than rewrite it.

Well as explained below is a way to stop this from happening and hopefully save you a heap of time.

  • Step 1

    – Create a library project.

  • So using flexbuilder, go to File->New->Flex Library Project.
  • This will create an empty library project.
  • Step 2

    – add in your Utilty class to the library project.

  • To do this add/create a Utility actionscript file that contains your static functions. Save, and this should then automaticlaly create a SWC file inside the library bin folder. (If it hasn’t and the file added has no errors then check the project properties to make sure the newly added file is being included – see pic)

  • Step 3

    – add the reference of the newly created SWC file to any project you intend to use it in.

  • So go to your project you wish to use the SWC with, then select the projects properties and inside ‘Flex build path’ select ‘Add SWC’.
  • Browse to the the previous library project and select the SWC from its bin folder.

You are now done, any time you update the code in the library project, those changes will be reflected in any project that references the SWC file automatically.

Previous Tip

Next Tip

[ad name=”ad-1″]

Show dual coloured highlight for a DG

If you have a datagrid that has different coloured columns, then why should you have to do with only using a single colour for the highlight.

Below is a simple soloution using actionscript to solve this.

First I should state that you need to use the AdvancedDataGrid even if you only need a normal DataGrid.  This is because the AdvancedDataGrid has a method called drawHighlightIndicator(…), which as you’d expect from the name draws the highlight.  Normally this is a single colour, but with a little overriding you’ll be able to change this.

Below is the main snippet of code from the extended AdvancedDataGrid.

override protected function drawHighlightIndicator(  indicator:Sprite, x:Number, y:Number,
	width:Number, height:Number, color:uint,  itemRenderer:IListItemRenderer):void
{
	//The indicator is the highlight, so grab its graphics and clear them
	var g:Graphics = Sprite(indicator).graphics;
	g.clear();
 
	var xPos : Number = 0;
	var yPos : Number = 0;
	//loop through the number of columns in the datagrid
	for(var i : uint = 0; i &lt; this.columnCount; i++){
		//get a random colour
		g.beginFill(randColour);
		//draw the rectanlge that fills the first column
		g.drawRect(xPos, y, this.columns[i].width, height);
		//update the starting X position so that it starts at the begin of the
		//next column
		xPos = xPos + this.columns[i].width;
	}
	g.endFill();
}

using the above you could create a DataGrid like the below which has some left hand columns in light purple and the rest in white. Then on highlight that same light purple colour is used for the white cells and the existing light purple becomes a slightly darker purple.

Twin DG colour example

Check out this link to see a very simple/colourful demo. As ever right click app for full source code.

[ad name=”ad-1″]

Flex Collection search – live

When I was setting up my blog, one of the first things I found out about was creating custom searches using Google. So I promptly set up a custom search that had a list of my favourite and most frequently visited flex sites and at the same time if those sites didn’t have the info I required any search that was directed to the ‘web’ rather than the ‘flex collection’ would be weighted to sites that had AS3, Flex, or Adobe related info.
After a little bit more research I managed to create an OpenSearch plugin from the custom Google search, and after that turned it into a firefox plugin.  See the ‘how to’ here on creating your own custom search and firefox plugin.

Live

Well the folk at Mozilla (or whoever tests the plugins) have just changed its status to LIVE 🙂 yeh.
check it out here http://addons.mozilla.org/addon/11823
You can also check out the original post with a list of all the included sites here.

[ad name=”ad-1″]

Flash Builder – Webservices – SoTR

Question:

What has a hidden entrance, is dark, damp and a just bit fousty (for any non Scottish readers – definition ) and takes quite a while to warm up?

Answer:

SoTR09 🙂
Yes, the Scotch on the Rocks 09 event held in Edinburgh was in a building called ‘The Caves’.  Oddly enough for a venue there was no sign outside to say that you were in the right place and on Friday there was a reasonable amount of rain.  So inside the main venue area you could see the water slowly runnning down the walls and the occasional drip noise coming from the corridor. The heaters didn’t come on till half way through the day but the tea & beers made up for that.

So what about the day, well I’m not a coldfusion guy, actually I’ve never touched a line of coldfusion.  But I didn’t go to learn or find out about coldfusion, I went to see if there was any tip bits about flex.  Serge was doing a talk on the new Flash builder and Flash catalyst, plus there was the another talk that involved both flex (lifecycle) and coldfusion.

It was nice to see Flash catalyst in action and during some of the talks they did this cool thing with webservices as if it was just something that was just known.  What was done was to import a WSDL (webservice) then once you see the list of methods available and while in design view, drag a method onto a datagrid and flash builder automaticly populated the datagrid with the returned result fields.

Something cool, other than Catalyst

Maybe this isn’t a cool thing to most people, nobody in the room seemed to notice, maybe because they were pretty much all coldfusion devs!?  But I thought that it was pretty neat. Should save a heap of time typing, plus just like you can with AMF you can now specify a return type for the WSDL.  Great new additions to Flash Builder. (In order to set up the datagrid automatically you need to specify the return type before dragging it onto the datagrid)

Best thing you could do would be to try yourself, download Flash Builder here, then create a new project, then find a WSDL that you wish to test something like this weather WSDL, choose the menu in Flashbuilder ‘Data’ -> ‘Connect to Webservice’. Follow the wizard then play around with the services.  Try things like setting the return type (create your own object), or right click one of the methods and ‘generate form’.  Very good additions.

If you’re into coldfusion then I’d definitely recommend SoTR. Last year (08) had more flex than this year (09), so if you’re also into flex then keep an eye on it. Scotch on the Rocks

[ad name=”ad-1″]

Where’s the VBox?

I resisted installing gumbo until it reached public beta, and having just done so started up a project only to find that using the auto complete VBox amongst others seemed to have disappeared.  Although using the VBox tag worked in exactly the same way as previously.

This made me a tad curious, was this a bug with the beta, I doubted that as that would have been a major issue.  So i figured it must have been for a reason, and it was.  A very good reason it turned out!

Due to the large number of new component classes and the different namespaces, Flash Builder will now only show the recommended components when using auto complete (unless you press Ctrl + Space, then you cycle through various options such as ‘show all’).  This I like. Great idea and a great way to get those folk set in their ways to find out more about the new classes.

So what is recommended in place of the old VBox?  This took a little while of searching Google, but I’ve found this article in the Adobe Dev Connection, http://www.adobe.com/devnet/flex/articles/flex3and4_differences_04.html.  This lists the old versus new and shows that the VBox is now replaced by the VGroup.

So there you go, should you not find the class in the auto complete help to start with, press Ctrl + Space then check out the above link to find out what you should really be using.

[ad name=”ad-1″]