Archive for the 'hints & tips' Category

Embedding Flash in a .Net form

Sunday, January 28th, 2007

I’ve needed to do this various times and there’s always a few gotchas, here’s a brain dump for my own future reference if nothing else…

  • In Visual Studio 2005 Express Edition, go to Tools -> Choose Toolbox Items
  • From the “Com Components” panel tick “Shockwave Flash Object” then click OK.
  • In the toolbar now, if you expand the “All Windows Forms” group and look at the end you should see a new “Shockwave Flash Object” entry that you can drag onto your form.

swf_obj_img.JPG

To load a swf into your object, either set the full path in the “Movie” parameter using the Properties panel at design time, or at runtime using something like…

this.axShockwaveFlash1.LoadMovie(0, "D:\\test.swf");

Note - in both cases the paths must be absolute or the movie wont load.

If you get the error…

“Failed to import the ActiveX control. Please ensure it is properly registered”

…with VS running you need to go into the \obj\debug folder under your project root and delete any file(s) in there with ‘interop’ in their name. New (working) files should be auto generated for you and the problem fixed.

I’ll add more tid-bits to this list as I find them…

Will it blend…?

Sunday, December 17th, 2006

So, intrigued by some of the stuff I saw @ FOTB I’ve been playing a little with the latest beta of Microsoft’s Expression Blend and trying to get my head around what exactly it does and how.

There doesn’t seem to be much in the way of info or tutorials around at the moment (other than the few that come with it and a couple of handy ones @ ExpressionBlend.com), so I’ve been pretty much making it up as I go along. The result of my first little expriments is this simple analog clock app…

blend_clock.jpg

As I don’t really know if I’m doing this the right way, and to perhaps help others just starting, I’ve made a video walkthough of the creation of the clock and put the source code up for you to have a look at, if anyone knows a ‘better’ way of making this please comment (sorry about the bored cockney voiceover, it’s scary hearing myself speak! :) )

(Edit - just noticed the right click pop-ups don’t show up in the video, sorry about that, must be a Camtasia issue. I’ll try to fix it if I do another video)

UPDATE - 31/01/07 -
Due to popular demand (well, errr, Roger anyway :) ) the video is now available as a downloadable WMV also. Enjoy.

expressionblend.com for expression blend tutorials, xaml demo, wpf info

FlashFilterLab.com

Thursday, August 31st, 2006

Wow, nice work @ FlashFilterLab.com, which allows you to chain together various Flash effects and tweak the results in real time. Reminds me a lot of an old modular synth, and once you’ve got your head around the way it works it makes playing with and understanding the effect parameters a doddle.

FDT - Templates are your friend!

Saturday, July 22nd, 2006

Jason Nussbaum suggests on his blog the use of a standard naming convention in all your get and set functions to save you a few seconds thinking time. This is all good, but how about taking it one step further by ensuring you always use standard names while also saving some typing? If you’re using FDT I just might be able to help…

A nifty feature of FDT that not many people seem to know about is Templates. Templates allow you to easily insert and customise chunks of code, anything from one line to whole classes, in a few keystrokes. Being a lazy git at heart I have a lot of love for this feature, and use it often. The best thing is you can also easily make your own Templates to automate your regular tasks, and in this post I’ll show you to add a simple Template to write a pair of ‘get’ & ’set’ data access functions in a record time…

(more…)

Flex2 & Flash9 in Ubuntu

Saturday, July 15th, 2006

Ubuntu just keeps getting better!

It took some messing around but I’ve now got Flex2 Builder working as a plugin in Eclipse (no visual editor but code hinting’s fine), MXMLC compiling, and Flash Player 9 installed in Firefox (through WINE) for testing the end result… of course there’s gotta be a million ways of improving the process but I was kind of shocked it worked at all :)

check the vid (or download it to see a much more readable full size version)…

To view this content you need to install or upgrade your Flash player