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.

The Nuts and Bolts of Domain Name Ownership

That’s not to say that the proper care and feeding of a domain is overly complex. But before we get into the those details let’s go over some core domain related terminology:

  • IP Address:  A unique numerical address for a server that hosts any Internet service.
  • DNS: Which stands for “Domain Name System.” The primary purpose of DNS is to make it easy for people to access web pages and send e-mails.  DNS translates a given domain name into the IP address of the computer that is hosting the given web service (website, e-mail, etc).  Without it, you would have to remember the IP address of each website that you wanted to visit.
  • Registrar: An organization that maintains Internet domain name records.  It is through these organizations that you purchase a domain name.  And the registrar is who you pay to keep your domain current.  The registrar keeps track of who owns a domain, their contact information, and the key DNS information for a domain.

With that in mind, let’s take a look at the three most important aspects of domain name ownership and maintenance:

  • Keeping it Current:  By far the most common problem that we see is letting a domain expire.  Simply, someone forgot to pay the bill from their registrar to keep the domain current and the registrar turns off the lights.  Usually, they never saw an e-mail from their registrar, or a third party who was “helping” them with it dropped the ball.  When this happens, any Internet service related to the domain becomes inoperable; website(s), e-mail, chat servers, etc., all go dark.  This can usually be resolved by renewing the domain.  Most registrars give you a grace period of up to a month to renew your domain before revoking the domain ownership from you.  That’s not to say that you should ever let it expire if you can help it.  Make sure that you have someone who is on top of it and keeps it current.
  • Ownership:  The person listed as the owner of your domain is the individual or organization who has the ability to make changes to it, and is the legal owner of the domain.  Sometimes it is the business or organization itself.  Often times it is another organization that has registered the domain in proxy and is managing it for them.  NBI typically registers domains for it’s customers, especially those that do not have internal IT departments and don’t want to have to worry about keeping it current and managing the technical details.  NBI also helps it’s clients establish their own domain accounts and transfer them from other third parties if need.
  • Login Information:  Most registrars provide you with a login to their website where you can renew your domain and update your contact information.  Make sure to keep this in a safe place as you will need it anytime you need to renew, and/or move your website to a new provider.

To do a lookup on your domain, click here and enter your domain name.

Double-check the Registrant (the organization listed as the owner, which is different from the registrar) and Expiration Date.  If you do not have your login information for your domain, and you are listed as the registrant, give the registrar a call and they can usually reset your password.

If it is going to expire soon, make sure to renew it right away.

If your domain’s Registrant is as an organization other than yourself and that organization isn’t a current, trusted, service provider, get in touch with an Internet technology professional who can help you gain direct ownership of the domain.

If you have any questions or ever need any help with your domain, feel free to send me an e-mail.

Ryan Chapin
President, Nuts & Bolts Interactive, Inc.