Dynamic Flash

Confessions of a serial code abuser
  • rss
  • Home
  • MTASC
  • Archives
  • About me
  • Goodies
    • Base64 encoder/decoder class
  • My Bookshelf
  • My Talks

Foundation PHP5 for Flash

Wednesday, 30 March 2005

Today Friends of Ed announced the release of Foundation PHP5 for Flash. I know a lot of people have been waiting for an update to my Foundation PHP for Flash book, but I want to make it clear that I haven’t been involved in any way in this rewrite. That’s not to say that it isn’t as good as the original or that you shouldn’t buy it, just that you shouldn’t necessarily rush out and buy it if you are a fan of the original without first checking it out properly.

Comments
2 Comments »
Categories
Books, Flash, General
Comments rss Comments rss
Trackback Trackback

MTASC 1.03 OS X Binary Release Package

Friday, 25 March 2005

I’ve compiled MTASC 1.03 on OS X and uploaded a binary release package - Download MTASC 1.03 for OS X.

Nicolas, feel free to host or link to this from http://www.mtasc.org.

Comments
No Comments »
Categories
General
Comments rss Comments rss
Trackback Trackback

ClassFinder class

Thursday, 10 March 2005

In a recent project I needed to instantiate a number of objects of various classes based on configuration data coming from an XML file. Unfortunately instantiating a class at runtime is not straight forward if all you've got to work with is a string. What I needed was some way of getting a reference to the constructor function of a class given the fully qualified class name. Ten minutes of tinkering later, I came up with the ClassFinder class.

PLAIN TEXT
Actionscript:
  1. class com.dynamicflash.utils.ClassFinder {
  2.   public static function find(package:String) : Function {
  3.     var packageParts:Array = package.split(".")
  4.     var obj:Object = _global;
  5.    
  6.     for (var i:Number = 0; i <packageParts.length; i++) {
  7.       obj = obj[packageParts[i]];
  8.     }
  9.    
  10.     return Function(obj);
  11.   }
  12. }

Feeding the ClassFinder.find() method with a fully qualified class name will return a reference to the constructor of the class. You can use this to instantiate an object of that class using new and passing any arguments to the constructor as you would normally.

PLAIN TEXT
Actionscript:
  1. import com.dynamicflash.utils.ClassFinder;
  2.  
  3. var myClass:Function = ClassFinder.find("com.dynamicflash.SomeClass");
  4.  
  5. var instance = new myClass("Test");

Classes are stored in _global with nested objects representing the package hierarchy. All ClassFinder.find() does is split the package name into chunks and descent the nested objects one at a time to find the class constructor function.

So what's the catch? Because of the way the Flash compiler works, any classes that aren't explicitly referenced in any of your code at compile time will not be included in the SWF. This means that ClassFinder won't be able to find them, returning undefined instead. If you want to trick the compiler into including such classes, you need to make a dependancy link to those classes from a class that is explicitly referenced in your code.

PLAIN TEXT
Actionscript:
  1. class com.dynamicflash.SomeOtherClass {
  2.   public function SomeOtherClass () {
  3.     ...
  4.   }
  5.  
  6.   // Create dependancy link
  7.   private static var SomeClassDependancy = com.dynamicflash.SomeClass;
  8. }

This method is used in Macromedia's V2 component core classes to make sure they're all included in the SWF if just one of them is referenced.

--Update--

I've just realised that a very similar class is included with Flash MX 2004 Professional, but adding it to your projects isn't exactly intuitive. You have to open up the Classes common library (via Window » Other panels » Common libraries » Classes in the main menu) and drag the UtilsClasses symbol into your library. You can then use
mx.utils.ClassFinder.findClass() instead of my class.

Why Macromedia didn't just put these classes in the standard folder I don't know, but since using it requires extra work I'll stick with my version of ClassFinder.

Comments
10 Comments »
Categories
Flash
Comments rss Comments rss
Trackback Trackback

Flash Player Yahoo Toolbar FAQ

Sunday, 06 March 2005

Macromedia have posted added a new section to the Flash Player FAQ regarding the recent default bundling of the Yahoo Toolbar with the Flash Player download. Well done Macromedia, though I can't help but think it would have been better to post this at the same time as implementing this 'offer' rather than after the fact to counteract the backlash from the developer community. Surely such a reaction wouldn't have been that hard to anticipate given that you're potentially messing with people's livlihoods?

There are two interesting questions in the FAQ that I think need looking at in more detail...

Does the Yahoo! Toolbar offer decrease Flash Player install rates from the Flash Player Download Center?

No. Preliminary information suggests that Flash Player install rates from the install page have improved. We will continue to monitor this closely to ensure that Flash Player install rates are not negatively affected.

Call me stupid, but did anyone at Macromedia stop to think that the increased install rates might be developers checking out how bad the damage might be for themselves? Or maybe they're investigating how difficult it's going to be to talk their clients through how to uninstall the Yahoo Toolbar when they realise they've been tricked into downloading it?

A more interesting statistic would be the number of genuine downloaders who then had to manually purge the Yahoo Toolbar from their system because they didn't want it in the first place.

Why is the Yahoo! Toolbar offered by default?

Macromedia wants the relationship with Yahoo! to be as successful as possible. Thus, we have set the default settings to encourage installation of the Yahoo! Toolbar.

We are continually monitoring install statistics and user feedback and will adjust the install process as necessary in order to ensure the continued adoption of Flash Player.

The first statement here explains the whole deal. Macromedia aren't focused on end users of the Flash Player, or on the developer community; they're focused on their lucrative deal with Yahoo. The reason the Yahoo Toolbar is 'offered' by default is that both Macromedia and Yahoo know that people wouldn't download it if they had to make a conscious choice. Instead they make it the default option, hoping to trick those people who were too tempted by the hugely inviting 'Install Now' button to realise just what they were getting.

As for the second statement, by the time this 'offer' has affected the install stats enough for anyone to notice, the damage will already be done. I can't believe that a company like Macromedia, with all the bright minds they employ, cannot see this for themselves. It just goes to show the blinding power of the mightly dollar.

At the bottom of the FAQ section Macromedia invite us to contact them via their Feedback Form if we have any suggestions. I recommend that everyone who is concerned about this 'offer' to let Macromedia know your concerns. Don't go over the top - present your concerns in a polite but firm tone, and we might just be able to get this 'offer' switched to opt-in instead of opt-out (which is the best we can reasonably hope for.)

Comments
8 Comments »
Categories
Flash
Comments rss Comments rss
Trackback Trackback

Yahoo Toolbar now bundled with Macromedia Flash Player

Wednesday, 02 March 2005

I'll post more on this when I've got time, but I've just noticed that if you go to the Flash Player Download Center you now get the Yahoo Toolbar bundled in with your download by default if you're using IE.

Of course, you can choose to download just the Flash Player, but only if you see the inconspicuous radio buttons before the huge button inviting you to 'Install Now'. Oh, and you're also agreeing to the 5+ page Yahoo Toolbar licence agreement displayed on the page in a text area so tiny that nobody will bother to read it.

This situation is remeniscent of spyware-bundling applications such as Gator and the like, which is somewhat ironic given that one of the stated features of the Yahoo Toolbar is some kind of 'Anti-Spy' mechanism. I'm not convinced that this is such a good business move by Macromedia, event if Yahoo did pay them a load of cash. You can guarantee that it'll put more than a few people off downloading the Flash player, and as a professional web developer working primarily with Flash that has the potential to affect me directly.

Waiting to see what others think on this!

Comments
85 Comments »
Categories
Flash, General
Trackback Trackback

About Dynamic Flash

Steve Webster is a Senior Web Developer for Yahoo! in London, UK.

He is more than a little concerned that he defines himself in terms of his career, and that he talks about himself in the third person.

Find out more

Recent Posts

  • Yahoo! London seeks Junior Developers
  • I am Singularity
  • Yahoo! Astra component library 1.1 released
  • On X-UA-Compatible
  • foundationas3.com has launched

Tags

ActionScript actionscript 3.0 air book conference designer filereference file upload Flash flex internet internet explorer jobs junior microsoft opportunities singularity08 skin urlrequest web developer web development Web Standards Yahoo!

Stuff

Singularity?
Flex.org - The Directory for Flex
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox