Flash Platform

Flexciting

It’s seemed like a longer wait than it was, but finally the Flex 2 Beta for Mac OS X is here. Posted on Adobe Labs on 23rd October.

Just in time for my next project which will be ActionScript 3 based and hopefully ready in time for Apollo. Flex seems like it will provide a better development environment than the Flash 9 Alpha.

Posted by creacog in ActionScript, Flex, Mac OS, 0 comments

flash webservices pending call gotcha – well got me for a while

I have a webservice running from asp.net. Sample method interface…

[WebMethod( Description = "Returns the About content" )]
public XmlDocument getAbout()
{
  xmlDoc.LoadXml( "<about></about>" );
  rootElement = xmlDoc.DocumentElement;
/*
* add some child nodes... etc
*/
...
  return xmlDoc;
}

As you can see the return type is of XmlDocument.

In ActionScript I am using code within a class similar to…

  private var myPCO :mx.services.PendingCall;
  private var myWSO :mx.services.WebService;

// myWSO is intialised once in a constructor or some other suitable location
  myWSO = new WebService( "/TheService.asmx?WSDL" );

//inside some function we initiate the data load
  myPCO = myWSO.getAbout();
  myPCO.onResult = mx.utils.Delegate.create( this, pcoResult )

// we handle a dataresult...
  private function pcoResult( result:XML ):Void
  {
    trace( result.firstChild.nodeName );
  }

The trace returns ‘undefined’. Spotted the mistake?

Because my service is returning an XML object, I assumed the ‘result’ would be the XML object. It isn’t. It is simply an object which contains the XML object, the root node of which you can access directly by name. In this case…

private function pcoResult( result:Object ):Void
{
  trace( result.about.nodeName );
}

This now correctly traces ‘about’.

Posted by creacog in ActionScript, Flash Platform, 1 comment

reading list

Commenced creation of my reading list of books and online references I have found useful. Initially concentrating on the Flash and ActionScript books I used to get involved in this technology.

Posted by creacog in ActionScript, Flash Platform, User Groups, 0 comments

mac flash switch

I recently had the need to be able to switch player versions on the mac, and was very grateful to have found Mike Chambers‘ “Flash Player Switching on Mac” entry. Following the instructions in that entry may well be all you need. Be sure to read comments IV and V – they are important!

In my own set up I made a couple minor alterations to ease things in my own mind (to be read in conjunction with Mike’s article)…

  1. With respect to setting up the ‘soft-link’ or alias to “Internet Plug-Ins” I find an alias name of “InternetPlug-Ins” less likely to cause confusion than the more generic “plugins”. (Norton utils for example creates a “Plug-ins” folder within /Library)
  2. Similarly to avoid any confusion within the InternetPlug-Ins folder which in my case contains loads of files, I created a sub-folder “flashplayers” into which I placed the version folders.

So my resulting folder/file structure is as follows…

/Library/InternetPlug-Ins/
  Flash Player Enabler.plugin
  Flash Player.plugin
  flashplayer.xpt
/Library/InternetPlug-Ins/flashplayers/7
  Flash Player Enabler.plugin
  Flash Player.plugin
  flashplayer.xpt
/Library/InternetPlug-Ins/flashplayers/8
  Flash Player Enabler.plugin
  Flash Player.plugin
  flashplayer.xpt
/Library/InternetPlug-Ins/flashplayers/9
  Flash Player Enabler.plugin
  Flash Player.plugin
  flashplayer.xpt

The idea being that the three files currently in /Library/InternetPlug-Ins represent the currently active version of the player.

As my folder structure is different to that of Mike’s, my script is slightly modified…

#!/bin/bash
#
# Script to change the flash player
#
if [ $# != 1 ]; then
  echo "Usage: $0 name-of-player-version-dir"
  exit
else
  plugin_dir='/Library/InternetPlug-Ins'
  np_dir="$plugin_dir/flashplayers/$1"
  if [ ! -d $np_dir ]; then
    echo "$np_dir does not exist."
    exit
  fi
  cp -rv $np_dir/* $plugin_dir/
fi

Finally if you are not familiar with writing and running scripts via the terminal, two things to bear in mind…

  1. Placing your script file in a folder picked up by the path, will ensure it is available to you whatever is your current working directory. In my case I use the default tcsh shell and cfp is placed in my /Users/username/bin directory. This is added to the path in my via my .tcshrc file with the line
    setenv PATH "$PATH":bin
  2. Make sure you set the executable flag on the script file:
    chmod +x cfp
Posted by creacog in Flash Platform, Mac OS, 2 comments

embedding flash in html page – best practice? (SWFObject)

For a long time I simply used the html published from the Flash IDE to embed a SWF. Expecting that to be the ‘best practice’ approach. Like others I was concerned at the impact of Microsoft’s upcoming changes to IE in response to EOLAS patent issues. I was dreading either having to write my own JavaSript or research countless approaches.

With SWFObject the problem is solved. It has been around for a long time (formerly known as FlashObject) and appears to be well tried and tested. I was really pleased with how simple it is to use, how it degrades gracefully. I’ve used this on a number of projects and now consider it to be best practice. In future I’d need a very good reason not to use it.

Update (14/03/2008): SWFObject 2 released

Posted by creacog in Flash Platform, Javascript, XHTML/CSS, 2 comments

make my h1 look nice

I’ve recently been distracted from my flash ambitions back to the world xhtm/css design. One of the issue with the organisation concerned is that in print media they use what I think is a really nice font: ITC Century Light. Ideally this is what should be used for all h1 headers through this site. Obviously not many users are likely to have this font installed. The substitute font is Times New Roman which is not nearly as neat, or distinctive.

In the bad-old days we would have created GIFs for each heading and used them instead. The height of bad-practice in this new world of standards compliance and accessibility.

Prior to doing any research, I had expected use of Flash would fall foul of similar problems. Then I found sIFR. A combination of JavaScript, CSS and Flash, which at run-time replaces designated tags with a SWF containing the text rendered in your font of choice to the same dimensions. What’s better it ticks most of the accessibility boxes. I’m really pleased with how easy this was to set up, and how it gracefully degrades.

Ok I came to this late. But the current version (2.02 at time of writing) has been recently updated with bug fixes and changes relating to ELOAS. And there is a version 3 in development.

This is a good piece of work by the developers, who are looking for funding. Certainly if my client goes with this recommendation, I’ll be sending a donation.

Posted by creacog in Accessibility, Flash Platform, Javascript, XHTML/CSS, 0 comments

attending user groups

Over the past few months I’ve been heading along to meetings of the London MultiMedia User Group. Working usually alone, or at least the lone technical ‘expert’ on most of my projects, it has been really good to see and hear what other similar types are up-to. Great for self-assessing my own approach against contemporaries.

With London MMUG in recess until September 2006 Tink has established the London Flash Platform User Group, the first meeting of which was this evening. Two impressive speakers: Stefan Richter and Stuart Eccles.

One of the things Stefan sparked an idea as to why I’ve been struggling to get one of the simplest Flash Media Server tasks to work – including one of the tutorials from Adobe. More on this soon.

Having never even looked at Ruby on the Rails, Stuart’s presentation was extremely interesting and illuminating. I’ll defiantly be looking into using RoR on future projects. That seemed to be the consensus of the audience too.

I am sorry I had to leave a little early. Thanks to Tink and both speakers for putting in the time to make this happen

Posted by creacog in Flash Platform, User Groups, 0 comments