Newtriks Blog

How To Reset Default Folder Icons on Mac OS X

I have recently installed a new SSD into my Mac Pro and decided instead of moving my Home folder to a separate drive as I usually do, to optimise the speeds of the SSD I would simply shift the larger directories to a separate drive and setup symbolic links. This was all fine until I forgot to update the Music directory icon and staring at a plain folder icon slowly started to irritate me. However, a bigger irritation was that no matter what I used i.e. CandyBar or LiteIcon the default folder icon would not reset :(

So after digging around the default icon set was eventually found in /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources, I then dragged MusicFolderIcon.icns into a CandyBar icon set, dropped it into the quick drop window and then finally dragged the Music folder onto the quick drop window, BAM all done and back to default icon thank you very much.

Posted in Mac OS X, Snow Leopard | Tagged , , , | 1 Comment

How to Setup A ColdFusion Project in IntelliJ IDEA

I had recently put out a twitter request to see if there are any tutorials out there for setting up a simple ColdFusion project with IntelliJ IDEA and I got no response. I presumed there would be a specific routine for a ColdFusion project but it seems that there isn’t one and after having a play around, there is no need for one, its just too simple.

I have detailed below the steps you take to get a simple ColdFusion project up and running.

Prerequisites are:

(1) ColdFusion
(2) IntelliJ IDEA
(3) I use this CFML markup plugin which you install within IntelliJ as shown in Step One and Two.
Read More »

Posted in Coldfusion, IntelliJ IDEA | Tagged , | 4 Comments

mx:Module and Unsupported Spark Components

Just to note a minor gotcha to be aware of when using mx:Module’s with Flex 4. Certain Spark components are not supported within mx:Module, two of which are:

  • s:layout
  • s:states

A suggested workaround for this is to either add a view component which extends a Spark component such as s:Group to your mx:Module, or simply nest all components in the mx:Module within an e.g. s:Group.

If your aware of exactly what is not supported in mx:Module’s in a Flex 4 project, or other unsupported/problematic aspects for that matter please report on http://bugs.adobe.com/jira (and if you would list [module related] them as a comment below) so other devs are not left wasting time on why certain code is not working?

Posted in Flash Builder, SDK 4 | Tagged , , | 1 Comment

MX ComboBox Open Direction Bug – Alternative Solution

Here’s another ComboBox bug (plus potential feature) that irritated me no end with a fix being made difficult due to the relevent methods I needed access to in ComboBox.as declared as private (as so many are in mx components [bangs head]!!!).

Bug: ComboBox opens in a specific direction according to its current position on the stage, so the logic is if its too close to the bottom boundary and its content is of a particular height then it will open upwards. This does function but it is inconsistent and the result is a list being cropped with options therefore rendered inaccessible [bad]. Ideally we want to override this logic written in ComboBox.as but it’s private so you have absolutely no control over the direction the list opens.

Solution: Ditch the ComboBox and extend PopUpButton (as pointed out by the above link) applying some small modifications as I have done here http://gist.github.com/505255. What I have done completely removes the stage detection and enables you to declare whether the list opens upwards or downwards. It’s a simple solution so don’t expect bells and whistles and essentially fixes the problem I was having leaving you free to modify too your hearts content adding in any other functionality i.e. stage boundary detection etc.

Posted in Flex | Tagged , | 1 Comment

Flex Popup Modal and HTML Text Issues

I found an interesting couple of issues today whilst working with Popup’s. Due to time this post is brief but to the point and below is a link to an example (with source) of the issues with fixes.

1) Firstly I was passing an Object to the Popup with the data to display and discovered if this Object data is a String of HTML text to be displayed in an TextArea then casting the Object to String causes the HTML text to be rendered incorrectly. Quick Fix: Cast Object to XML then to String.

2) Secondly I had an effect on the closing of the popup window and noticed that the modal layer beneath the popup was being removed after the popup effect had finished and ultimately removed which looked cr@p. Quick Fix: Dispatch a flex hide event from within the popup when the closing animation method is called.

Popup Example

Posted in Flex | Tagged , , , , | 1 Comment

Spark DataGrid

I have recently created a new GitHub repository for my code seperation of Alex Harui’s combination of Spark List components to build a datagrid. As my notes say:

I have basically taken Alex Harui’s example from
http://blogs.adobe.com/aharui/2009/12/spark_list_spark_list_spark_da.html and broken it up into more bite size chunks,
added some styling and various other attributes to try and make it more flexible? Here is an example application using
the source http://demo.newtriks.com/ExampleSparkDataGrid/

SparkDataGrid

SparkDataGrid

This is by no means perfect but I did manage to get some sort of separation to be able to use in a couple of projects quite nicely and as a simple grid it works fine, have a play and fork the project to offer some improvements.

Posted in Flex, SDK 4 | Tagged , , , | 2 Comments

Streaming an FLV using Spark VideoPlayer/VideoDisplay

I had a head banging moment last night trying to help a mate out to stream an FLV from Akamai (also seen on Wowza) using the latest Spark VideoPlayer component. We had a working flv streaming in the old mx:VideoDisplay absolutely fine, update the component to the Spark equivalent and nothing, nowt, nada, not even a glimmer?

// OLD MX COMPONENT - WORKS FINE
<mx:VideoDisplay source="rtmp://myserver.com/my_application/my_stream.flv" />
// NEW SPARK COMPONENT - DOES NOT WORK!!
<s:VideoDisplay source="rtmp://myserver.com/my_application/my_stream.flv" />

My first thought was I that when the component was upgraded, the syntax was changed for defining the source string? After a chat with Stefan he also mentioned that as the VideoPlayer/VideoDisplay is now built on OSMF this would most likely be the case.

I then started looking through the docs to find out what the syntax is for streaming an FLV in the latest spark components (a fairly common practice I would have thought), damned if it was a quick find for me! The typical example I found was as below:

source="rtmp://fmsexamples.adobe.com/vod/mp4:_cs4promo_1000.f4v"

Then we started playing with DynamicStreamingVideoSource and I stumbled over the thought that I should dig into OSMF documentation more and eventually found the solution but buggered if I can find it again and I flippin' forgot to bookmark (there may be alternatives but this worked):

// WORKS!!!
<s:VideoDisplay source="rtmp://myserver.com/my_application/?streamName=my_stream&streamType=flv" />
Posted in Flash Media Server, Flex, SDK 4, Video | Tagged , , , , , | 2 Comments

Server move for newtriks.com

I have recently moved this site to my new server and there may be some non-functioning application examples, lost comments (during last nights dns change) and maybe some other small issues, sorry about any inconvenience caused. I will be getting things up and running as soon as I can, although the majority should be sorted now the core components are installed and databases/datasources transferred.
Read More »

Posted in General | Tagged , , | 1 Comment

Changing DataProvider in a Flex ComboBox Problem Fix

I have stumbled across an old fix I found for a problem I had with an mx:ComboBox ages ago and thought it worth while blogging about. Basically I found that if I bound an ArrayCollection to the dataprovider of a ComboBox and then changed the contents of the ArrayCollection, the ComboBox would not update? I tried all sorts of things i.e. itemUpdated() on the provider/collection, invalidateProperies/DisplayList on the ComboBox and so on to no avail. I originally found that setting the prompt attribute in the ComboBox caused the issue but on building a quick example application I found that with or without the prompt it still fails to update. In fact its even odder without a prompt, the selected item changes but not the content within the dropdown???
Read More »

Posted in General | 12 Comments

Helper Method for Handling Flash Vars in Flex

I have used the below logic repeatedly now for processing Flash Vars in my Flex 4 applications which others may find useful. In the example below I use it in a service class. Basically I define a custom value object with the flash var properties defined. I then loop through the available parameters in the loadParameters() method using a [Transient] array which returns the name of each parameter.

package com.newtriks.services
{
	import com.newtriks.models.vo.APIData;
	import flash.events.EventDispatcher;
	import mx.core.FlexGlobals;

	public class FlashVarsService extends EventDispatcher implements IExternalParametersService
	{
		public function FlashVarsService(){}

		public function loadParameters():void
		{
			var flashVars:Object = FlexGlobals.topLevelApplication.parameters;
			var data:APIData = new com.newtriks.models.vo.APIData();
			var param:String;
			var i:int;
			var length:int = data.params.length-1;

			for ( i = length; i>= 0; i -- )
			{
				param = data.params[i].toString();

				if(flashVars[param] != null)
					data[param] = flashVars[param];
				else
					data[param] = ""; // Simply populate a null param with an empty string
			}
		}
	}
}

Which implements:

package com.newtriks.services
{
	import flash.events.IEventDispatcher;

	public interface IExternalParametersService
	{
		function loadParameters():void;
	}
}

And the APIData Object looks like this:

package com.newtriks.models.vo
{
	public class APIData
	{
		public var username:String = '';
		public var role:String = '';
		public var status:String = '';

		public function APIData(){}

		[Transient]
		public function get params():Array
		{
			return ["username","role","status"];
		}
	}
}

And finally the actual Flash Vars in the html wrapper:

/** Flash Vars passed into Flex **/
var flashvars = {username:"newtriks",role:"admin",status:"1"};
Posted in Flex, SDK 4 | Tagged , | 2 Comments
  • FreeAgent sign-up


  • Recent Posts

  • Categories