Communication, the podcast – RTMFP and Flash

I talk about RTMFP, the Real Time Media Flow Protocol, and it’s use in Flash and mobile applications.

Flex 4 Scroller Quirks

So in Flex 4, scrolling has moved out of the individual visual containers and now is a container itself that wraps around the containers that need to be scrolled. This is a good thing, but does have some issues that developers, like me, need to wrap their heads around.

Right now, I am just going to talk about the sizing of the children inside the s:Scroller component. It’s something that I have run into a few times, and writing it out here will cement things in my head and hopefully be helpful to you, the reader.

When sizing children inside a scroller, make sure you aren’t using percent based sizing. Why? Because then the child will attempt to size itself to the size of the scroller. It seems obvious, but it’s one of those things that you don’t think about in the middle of coding since it isn’t something that you would think about in Flex 3.

When you use percentage based layout for the children, you end up getting children with their display elements cut off. The scroller thinks that the child is sized correctly based off of it’s percentage, and not it’s actual size. The way around this is to use constraint based layout. If you want a width=”100%” layout, then simply switching to left=0 right=0 will fix your problems. Also, if you don’t need to be fussy with your layout, then let the component size itself, and scroller will handle that properly as well.

In conclusion, avoid percentage based layouts when laying out inside a scroller component.

Flex Training for ColdFusion Developers

This Thursday November 19th I will be assisting Jeff Tapper while he teaches the Flex Training for ColdFusion Developers class at the Hyatt Regency Chicago on the River Walk, 151 East Wacker Drive, Chicago, IL 60601.

The project I have been working on lately has thrown me headlong into CF, and I find that I like it. It’s been quite easy to pick up, and the changes from CF 8 to CF9 are interesting. Which is part of the class this Thursday. Also part of that class is Flex’s integration with CF9.

To sign up for the free class, head over to the registration site: http://www.ce1.com/adobe/2009/flextrainingforcfdevelopers/

I have no idea if it is full or not, but I know we had over 70 people signed up when I talked with Jeff about it last week. Should be a fun day!

FlexUnit 4 – Starting out

For any of you familiar with FlexUnit 1, Fluint, or FlexUnit 4, move along. This is probably going to be so simple you will scoff at it. For those of you who haven’t started out with any unit testing, especially the new FlexUnit 4, then read on.

First:

FlexUnit 4 has NOTHING to do with Flash Builder 4 in terms of version number. It actually relates to JUnit 4 (which specific version, I don’t know, someone?). So for those of you wondering, yes, it can test Flex 3 SDK , not just Flex 4 SDK projects.

Next: Getting started

Whether you have an already created project, or are starting a brand new one, there is a simple set of steps that you can perform in Flex Builder 4 to set up your project for unit testing.

I am writing this, because I thought it should be easy, and it is, I just went about it the wrong way and I want you out there to not have to make the same mistake.

Originally, I was right clicking on the Package Explorer and trying to use Execute FlexUnit Tests menu item. While this will eventually work, it won’t yet. Why? You haven’t set up your project to know that it has FlexUnit tests!

Steps: (This is the way I know how to do it, if you know another way, let me know!)

  1. Select Run > Run > FlexUnit Tests
    1. This brings up a progress dialog that sets up all of the libraries into your project.
    2. Then the Run FlexUnit Tests dialog comes up.
    3. If you haven’t written any tests yet, then you can only Cancel from this.
  2. Write some tests!
    1. Create a new package that will contain all of your tests. This way you can keep track of them more easily and separate them out of your production code.
    2. A simple testing class will look like this:
    3. package TestingPackage
      {
      	import flexunit.framework.Assert;
      
      	public class TestSampleLayout
      	{
      		[Test]
      		public function testAssertFalse():void
      		{
      			Assert.assertFalse( false );
      		}
      
      		[Test]
      		public function testSampleLayoutFunctionReturn():void
      		{
      			var initialString : String = "Hello World.";
      			var finalString : String;
      			finalString = new SampleLayout().sampleFunctionReturnTest( initialString );
      			Assert.assertEquals( initialString, finalString );
      		}
      
      		public function TestSampleLayout()
      		{
      		}
      	}
      }
    4. This class does two tests.
      1. It asserts that False really is false. You normally wouldn’t do this, but it shows you something of what you can do.
      2. It tests the method “sampleFunctionReturnTest” of the class SampleLayout. The method merely spits back whatever string it was entered.
    5. So when it gets run through AssertEquals, and they are equal, then the test passes. If they are not, then it would fail.
  3. Note that before each test method is [Test], this is what FlexUnit 4 uses to determine if a method is a test or not. So you need that before every test you want run.

I am still working out all of the different types of testing that are available, but this should hopefully get you started until I post more, or more documentation becomes available.