Thursday, September 25, 2008

Virtual PC for the PC

I remember the first time I saw Virtual PC for the Mac - probably 10 years ago. An Apple rep came to the Board Office, plugged his Mac into our network and ran several Microsoft Office applications simultaneously and snappily. He even found one of our network printers and fired off a document to it. All this in a rabidly Windows environment. Magic!

I had a similarly satisfying experience this afternoon, downloading Microsoft Virtual PC 2007 onto my PC and running the disk image with Internet Explorer 6 bundled with it. When launched, I get a window with Windows in it and its own virtual hard drive with its own Program Files and plug-ins. The only non-authentic part of the experience is that the default desktop is not teletubby land. I am using it to test the CLIPS website on IE6, while I have IE7 installed on my non-virtual machine. I have been using javascript to allow CLIPS to have a draggable screen resizing widget and getting familiar with some of the cross-browser compatibility issues that that entails. It should go live shortly.

I wonder whether it would be safer to surf the web with the virtual copy of Windows, avoiding any viruses or nasties that way.

Tuesday, September 2, 2008

How does Flash Pass Control as it gotoAndPlays frames?

One of the pleasures of working on CLIPS is the chance to work with some top-notch Ontario educators, like Greg Rodrigo of Georgian College. As part of this summer's work, we we trying to figure out how actionscript is executed as control is passed to different frames and the onEnterFrame method is called. Greg created a little test file similar to the following:

Create seven keyframes and put the following code in each frame:
  1. onEnterFrame = function() {
    trace("I am on frame " + _currentframe);
    }
    trace("Frame 1");

  2. gotoAndPlay(4);
    gotoAndPlay(3);
    trace("Frame 2");

  3. trace("Frame 3");
    gotoAndPlay(5);

  4. trace("Frame 4");
    gotoAndPlay(1);

  5. trace("Frame 5");

  6. trace("Frame 6");
    delete onEnterFrame;

  7. stop();
    trace("Frame 7");
So here is what the teacher would ask you to do:
Determine what Flash's output window will contain when this file is tested.
We learned a lot about how Flash operates by trying to make this prediction.

STOP: Try it yourself now.






If that question is too hard or open-ended, here are some other questions that might be simpler:
  1. What will the output be the first time the onEnterFrame method is executed?
  2. Will the first output "Frame 2" occur before or after the first output "Frame 4"?
  3. Why does "I am on frame 5" not appear in the output window? (I am not sure what the answer to this question is, so perhaps it is not simpler.)
Please feel free to leave a comment about the last question.

If you don't feel like typing this in yourself, I have posted the .fla source file.