Chaging the Default Browser under Windows XP for IE and Firefox

There are times when you might want to change your default browser; especially if you are a developer and want to make sure that something works as it should with both IE and Firefox.

To change your default browser:

  • Go to: Start/Control Panels/Add or Remove Programs
  • Click on "Set Program Access and Defaults", the last button in the left-hand nav
  • Click on the "Custom" set of options
  • You will see an expanded list of items, Web Browser, E-mail Program, etc.
  • Under the "Choose a default Web browser", select the radio button next to browser you would like to set as default.
  • Click "OK"

getURL() in a Projector Firefox Bug and Solution

If you have ever tried to do a simple getURL() command in Flash from an .exe projector you’ll notice that it fails when Firefox is your default browser.

Following is the solution to the problem in both AS 2.0 and AS 3.0

Here’s the code for the fix in AS 2.0:

// code on a keyframe on the main timeline

var swfUrl:String = _root._url;
var lastSlashIndex:Number = swfUrl.lastIndexOf("/");
var pipeIndex:Number = swfUrl.indexOf("|");
var baseUrl:String;
if (pipeIndex >= 0)
{
baseUrl = swfUrl.substring(0, pipeIndex);
baseUrl += ":";
}
else
{
baseUrl = "";
}
baseUrl += swfUrl.substring(pipeIndex + 1, lastSlashIndex + 1);

myButton.onRelease = function()
{
var targetUrl:String = baseUrl + "test.html";
getURL(targetUrl, "_blank");
};

Here’s the code for the fix in AS 3.0:

// code on a keyframe on the main timeline

import flash.events.MouseEvent;
import flash.net.*;

output_txt.text = this.loaderInfo.url;

var swfUrl:String = this.root.loaderInfo.url;
var lastSlashIndex:Number = swfUrl.lastIndexOf("/");
var pipeIndex:Number = swfUrl.indexOf("|");
var baseUrl:String;
if (pipeIndex >= 0)
{
baseUrl = swfUrl.substring(0, pipeIndex);
baseUrl += ":";
}
else
{
baseUrl = "";
}
baseUrl += swfUrl.substring(pipeIndex + 1, lastSlashIndex + 1);

function gotoTestHtml(event:MouseEvent):void
{
var targetUrl:URLRequest = new URLRequest(baseUrl + "test.html");
navigateToURL(targetUrl, "_blank");
}

myButton.addEventListener(MouseEvent.CLICK, gotoTestHtml);

Here is a link to the original article where I found this with the full explanation and fix.

How to Run Firefox 2 and 3 at the Same Time

Here’s a quick how to on running Firefox 2 and 3 at the same time under Windows

  1. Right click the shortcut of the Firefox 2, click "Properties". Add "-profilemanager" at the end of the shortcut path. Click OK. Then run this shortcut to launch Firefox Profile Manager.
  2. Create a new profile, name it "firefox3". And uncheck the "Don’t ask at startup"
  3. Go to Properties of the Firefox 2 shortcut again, remove the "-profilemanager" and add "-p default" at the end of the path. This forces Firefox 2 to open the original profile.
  4. Install Firefox 3. Choose "Custom" when you are asked.
  5. Change the installation folder to "Mozilla Firefox 3"
  6. Same in Start Menu Folder name.
  7. When is complete, uncheck the "Launch Firefox now". You still have something to do before you can run it.
  8. Go to the Properties of the Firefox 3 shortcut. Append "-no-remote -p firefox3" to the Target. The "-no-remote" will let Firefox run a separate instance. The "-p firefox3" will force your Firefox 3 to run the newly clean profile.
  9. Run the Firefox 3, and you will be prompted that your Firefox is not the default browser. DON’T click Yes. Firefox 3 is not stable and you won’t like to use it as your default browser. Simple uncheck the "Always perform this check when starting Firefox" and click No.
  10. Now you can run Firefox 2 and Firefox 3 at the same time.

VB6 Code for Openning an External File

The following VB6 code will open an external file with it’s associated application.  This assumes that there is an application on the system that is already associated with a specific executable.
Under your General Declarations:

‘ Runs an external file/launches it’s associated app
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

On whatever Form/Button/Event

Dim FileName As String
FileName = "C:\path\to\some\file.pdf"
ShellExecute 0&, "open", FileName, "", "", vbNormalFocus

Creating MovieClips with Button States in AS 2.0

Here is a quick tutorial on how to create MovieClips that act like buttons using ActionScript 2.0.  Attached is a sample .fla file with a complete, working example.

  1. Create a new Flash document for AS 2.0
  2. Create whatever graphic/shape that you would like and convert it to a symbol.  Double click on on it with the selection tool, and then press F8 to open the create symbol dialog box, or right click on it and select "Create Symbol".  Make sure that you create it as a MovieClip.
  3. Double-click on the new MovieClip to enter the symbol edit mode.
  4. Rename the existing "Layer 1" layer that contains the base graphic "bg".
  5. Create three new layers above that one in this order:
    1. labels
    2. actions
    3. text
  6. On the labels layer:
    1. Create a keyframe at frame 10, 20, and 30
    2. In frame 1, enter the following label: _up
    3. In frame 10, enter the following label: _over
    4. In frame 20, enter the following lable: _down
  7. On the actions layer create a keyframe at frame 10, 20, and 30 and put a stop(); action in frame 1, 10, and 20.
  8. On the text layer, create a keyframe at frame 10 and 20.
    1. Add the following text to each keyframe:
      1. Frame 1: Steady State
      2. Frame 10: Over
      3. Frame 20: Down
  9. Go back to your main timeline, by clicking on the "Scene 1" button.
  10. Select your MovieClip and give it an instance name of button_mc.
  11. Create a new layer in the main timeline and name it actions
  12. Add the following actions to it:
    1. button_mc.onRelease = function(){
          trace( "Click" );
      }
  13. Test your movie and when you rollover and click on the clip you will see the different states displayed.

Creating a Mac/PC Hybrid CD-Rom with Roxio Toast

The following is a quick tutorial on how to create a hybrid CD under Mac OS X.
Using Toast, you can fairly easily create a hybrid CD with which the Mac OS will only see Mac specific files and the PC OS will only see the PC specific files.  This preserves the Mac resource fork and icon data as well as the PC icon data.

  1. Create a disk image into which you will place all of your Mac OS files.
    1. Open up the Disk Utility program in Applications/Utilities/Disk Utility.
    2. Click on the "New Image" button in the top bar of the Disk Utility window.
    3. Determine the size of your disk image and create it, making sure it has read/write permissions.
  2. Mount the new disk image and copy any Mac data onto it.  Leave the image mounted.
  3. Fire up Toast
  4. In the left-hand sidebar, click on the "Advanced" button.
  5. Click on the "Custom Hybrid" radio button.  The main Toast window will now display two buttons "Select Mac…" and "Select ISO.."
  6. To add Mac files:
    1. Click on the "Select Mac…" button.
    2. Choose the newly created disk image/Mac volume that you created and into which you copied your Mac files.
  7. To add PC files:
    1. Click on the "Select PC…" button
    2. An "ISO 9660" dialogue box will appear.
    3. Click on the "Files" button and then drag and drop your PC files into this window.
    4. To specify the name of the PC cd as it will appear, double-click on the text to the right of the CD graphic/icon (the default should be My CD).  Enter any new text and hit enter.
  8. Unmount/Eject your Mac data volume before burning.
  9. Burn CD, smile, do victory dance.  🙂

Using FlashPaper .swf files in ActionScript 2.0

Macromedia Studio 8 shipped with Macromedia FlashPaper 2.0, a pretty cool app that will take PDF and other documents and convert them into .swf files that you can load into other flash/swf applications.

The following is a quick tutorial on how to load FlashPaper swf files into Flash applications in ActionScript 2.0.

This tutorial assumes that you know the basics of FlashPaper 2.0 and have a usable FlashPaper .swf file.

Essentially, you will include an ActionScript file that will provide the functions to allow you to load in and scale the FlashPaper .swf and then include a few configurations and lines of code to load in the FlashPaper .swf.

First, create a new ActionScript file, save as "flashpaper.loader.as" and copy and paste the following code into it:


function loadFlashPaperSWF( arg_flashPaper_conf:Object ):Void{
    trace( "\nFrom loadFlashPaperSWF" );
    trace( "arg_flashPaper_conf.flashPaper_SWF " + arg_flashPaper_conf.flashPaper_SWF );
    // Creating the MovieClip into which we’ll load our Flash Paper document.
    this.createEmptyMovieClip( "testMovie_mc", this.getNextHighestDepth() );
   
    // callback functions for this clip
    var mcObjListener = new Object();
    mcObjListener.onLoadComplete = function(){
        testMovie_mc._visible = false;
    }
    mcObjListener.onLoadInit = function( arg_target:MovieClip ):Void{
        trace( "running the onLoadInit callback" );
        trace( "arg_target = " + arg_target );
       
        // We’ll have to wait until the first page of the flash paper document has loaded
        // before we have access to the FlashPaper API
        // To do so, we’ll set up an interval that will check for it’s existence.
        // Then run the setSize method
        var var_intervalID = 0;
       
        // Our check function
        function checkFlashPaperLoaded(){
            // Hide the holder clip until it is loaded
            // eval( arg_target )._visible = false;
           
            // Getting a reference to our FlashPaper object
            var var_flashPaperObj = eval( arg_target ).getIFlashPaper();
            trace( "var_flashPaperObj = " + var_flashPaperObj );
           
            if( !var_flashPaperObj ){
                return;
            }
            else{
                trace( "We now have access to our FlashPaper API" );
                clearInterval( var_intervalID );
               
                // Resize the doc to fit the size of the stage
                var_flashPaperObj.setSize( arg_flashPaper_conf.flashPaper_width,
                                          arg_flashPaper_conf.flashPaper_height );
               
                // Setting the document to fit to height:
                // var_flashPaperObj.setCurrentZoom( "page" );
               
                // Show it
                eval( arg_target )._visible = true;
            }
        }
        var_intervalID = setInterval(checkFlashPaperLoaded, 100);
    };
   
   
    // Here we create a new MovieClipLoader Object
    var var_movieClipLoader = new MovieClipLoader();
               
    // Here we add the listener to our new MovieClipLoader Object
    var_movieClipLoader.addListener( mcObjListener );
           
    // Now we use our new MovieClipLoader object to load the swf into the movieclip holder
    var_movieClipLoader.loadClip( arg_flashPaper_conf.flashPaper_SWF, "testMovie_mc" );

}


Then, create a new Flash file (ActionScript 2.0) and add the following to the first frame of the timeline:


#include "flashpaper.loader.as"

// ============================================================================
// Configurations:
//
// Our config object
var obj_flashPaper_conf:Object = new Object();

// The flash paper swf to load:
obj_flashPaper_conf.flashPaper_SWF = "files/flashpaper_docs/flashpaper.swf";

// The width and height of our flashpaper doc
obj_flashPaper_conf.flashPaper_width = 650;
obj_flashPaper_conf.flashPaper_height = 320;

// ============================================================================

// Loading our Flash Paper SWF
loadFlashPaperSWF( obj_flashPaper_conf );


Edit the configurations to specify the location of the FlashPaper .swf and the size that you want it to be displayed and you are good to go.

NSIS Installer Maker and the HM NIS Edit IDE

The NullSoft Scriptable Installer System is a great open source package for building Windows installers.  Recently I found an open source editor/IDE package that makes putting these things together a real snap!

First download the NSIS package and install.  Then download and install HM NIS Edit and you should be all set.