Blog

Latest entries from the YAY! blog...

November 30, 2005

Flash gallery app

Writing about web page http://www2.warwick.ac.uk/services/elearning/experts/elat/about/stevencarpenter/flash/galleries/

As if working/parenting/studying/planning a wedding didn’t take up enough of my time, in the odd moment here and there in between I’ve been building this Flash gallery application (needs the new Flash 8 player), and finally got it working. I’ve wasted more than few hours on the following bugs though;

  • V2 object depth bug; V2 components that are instantiated using this.getNextHighestDepth() won’t remove properly due to a bug in MX - after many hours of Googling and trying different things I finally found that using unloadMovie() does work
  • Loader class event bug – I nearly gave up on this, but finally found out that the Loader class requests an image 3 times, then gives up. But rather than just giving up, it sends a ‘complete’ event to the listener anyway, the net result being that anything I tried to do to the object within the listener didn’t work, because nothing was there. The workaround was to use Jeff Tappers excellent IELoader subclass which fixed it for IE. Firefox was still refusing to load and display all the images though, but only if I had set the Loader object scaleContent to true; setting it to false would result in a full set of images but at full size. I never found a satisfactory way to rescale the images without problems, so it was time to turn to a new Flash 8 class that offers an alternative to the Loader; MovieClipLoader. Except that…
  • MovieClipLoader onLoadComplete() event. This new class seems to operate in a slightly odd way. There are several events this class can fire off, including onLoadInit(), which fires when the first chunk of data arrives, onLoadError(), onLoadProgress() and onLoadComplete(). Now which one of those would you think would tell you when you have all your image data (and can therefore perform things like a resize/reposition)? Wrong! onLoadComplete should do that, but for some reason it doesn’t. onLoadInit() does though. Macromedia changed the LiveDoc on this yesterday after I’d figured it out myself…

“When you use the onLoadComplete and onLoadInit events with the MovieClipLoader class, it’s important to understand how this differs from the way they work with your SWF file. The onLoadComplete event is called after the SWF or JPEG file has loaded, but before the application has been initialized. At this point it is impossible to access the loaded movie clip’s methods and properties, and because of this you cannot call a function, move to a specific frame, and so on. In most situations, it’s better to use the onLoadInit event instead, which is called after the content has loaded and is fully initialized.”

Mr. Macromedia, no-one loves using Flash more than me, but this kind of stuff is such a pain in the rear. While there’s a certain satisfaction to be gained from being a ‘god-of-asynchronous-event-programming’ (and the new features like dynamic filtering rock), the cost in terms of hours wasted is somewhat higher than many of us would like.

Paul, Hannah and Kieran – thanks for all the help!

Anyway, enjoy…if it breaks, I’m not here…

November 25, 2005

Flash Loader class problems

Writing about web page http://www2.warwick.ac.uk/services/elearning/experts/elat/about/stevencarpenter/flash/galleries/

This (Flash 8 player required) app was a simple port of the Blog wall code, with the addition of some of the new dynamic filters available in 8. The filters rock; you can create drop-shadows and a load of other effects on the fly and do a heap of other cool manipulation things directly in Actionscript, but I’m still struggling with the Loader class introduced in MX.

Despite using an event listener chain (call image file > check for load completion > resize) this thing still refuses to resize uncached images; according to my trace output those that take a while to load never invoke the load completion listener that resizes the image for viewing, but the Loader object still decides to display the image at full size despite being told to wait. Refreshing the page seems to fix it every time, but the whole point of the Loader class is to prevent problems like this in the first place. More work needed…

November 16, 2005

Google Answers

Writing about web page http://answers.google.com/answers/

Google now offers a question/answer service…

More than 500 carefully screened Researchers are ready to answer your question for as little as $2.50 — usually within 24 hours. Your satisfaction is completely guaranteed.

There is a disclaimer that you shouldn’t use this service as a shortcut to getting your coursework done (as do other ‘cheat’ sites) but Google’s involvement in this area this is likely to be a contentious subject for the academic community – how can they consistently differentiate valid questions from invalid ones? Take this one for example – is it from a medical student who can’t be bothered to look it up, or just someone with a passing interest? Either way, for about