<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ralph Canapa &#187; Flash</title>
	<atom:link href="http://ralphcanapa.com/blog/index.php/tag/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://ralphcanapa.com/blog</link>
	<description></description>
	<lastBuildDate>Tue, 11 May 2010 13:51:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Destroy All Bunnies!</title>
		<link>http://ralphcanapa.com/blog/index.php/2010/04/destroy-all-bunnies/</link>
		<comments>http://ralphcanapa.com/blog/index.php/2010/04/destroy-all-bunnies/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 13:38:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Funny]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Games]]></category>

		<guid isPermaLink="false">http://ralphcanapa.com/blog/?p=497</guid>
		<description><![CDATA[For too long the bunnies have dominated chicken-kind &#8211; heartlessly decorating and hiding their unborn offspring. Finally a hero has come! Help Bruster McRooster fend off the hideously fuzzy foes.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_VGame_1982016618"
			class="flashmovie"
			width="550"
			height="400">
	<param name="movie" value="http://ralphcanapa.com/blog/wp-content/uploads/2010/04/VGame.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://ralphcanapa.com/blog/wp-content/uploads/2010/04/VGame.swf"
			name="fm_VGame_1982016618"
			width="550"
			height="400">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
The main code came from an AS3 book. I modified the code a bit and added new graphics. Hope you enjoy it!
]]></description>
			<content:encoded><![CDATA[<p>For too long the bunnies have dominated chicken-kind &#8211; heartlessly decorating and hiding their unborn offspring. Finally a hero has come! Help Bruster McRooster fend off the hideously fuzzy foes.</p>
<p style="text-align: center;">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_VGame_1599718353"
			class="flashmovie"
			width="550"
			height="400">
	<param name="movie" value="http://ralphcanapa.com/blog/wp-content/uploads/2010/04/VGame.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://ralphcanapa.com/blog/wp-content/uploads/2010/04/VGame.swf"
			name="fm_VGame_1599718353"
			width="550"
			height="400">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>The main code came from an AS3 book. I modified the code a bit and added new graphics. Hope you enjoy it!</p>
]]></content:encoded>
			<wfw:commentRss>http://ralphcanapa.com/blog/index.php/2010/04/destroy-all-bunnies/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Thanks for your birthday wishes!</title>
		<link>http://ralphcanapa.com/blog/index.php/2010/03/thanks-for-your-birthday-wishes/</link>
		<comments>http://ralphcanapa.com/blog/index.php/2010/03/thanks-for-your-birthday-wishes/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 16:49:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[2D]]></category>
		<category><![CDATA[Funny]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://ralphcanapa.com/blog/?p=455</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://ralphcanapa.com/blog/wp-content/uploads/2010/03/final41.flv" rel="shadowbox[post-455];player=flv;width=640;height=385;" title="Double helix"><img class="aligncenter size-full wp-image-363" title="Double helix" src="http://ralphcanapa.com/blog/wp-content/uploads/2010/03/blogStill.gif" alt="" width="650" height="365" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://ralphcanapa.com/blog/index.php/2010/03/thanks-for-your-birthday-wishes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>An SN2 reaction</title>
		<link>http://ralphcanapa.com/blog/index.php/2010/03/an-sn2-reaction/</link>
		<comments>http://ralphcanapa.com/blog/index.php/2010/03/an-sn2-reaction/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 15:03:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[2D]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Science]]></category>

		<guid isPermaLink="false">http://ralphcanapa.com/blog/?p=444</guid>
		<description><![CDATA[Bit by bit I&#8217;m working on an animation that illustrates a SN2 reaction. Here&#8217;s a label free preview.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_sn2-1v1_104058855"
			class="flashmovie"
			width="640"
			height="480">
	<param name="movie" value="http://ralphcanapa.com/blog/wp-content/uploads/2010/03/sn2-1v1.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://ralphcanapa.com/blog/wp-content/uploads/2010/03/sn2-1v1.swf"
			name="fm_sn2-1v1_104058855"
			width="640"
			height="480">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
]]></description>
			<content:encoded><![CDATA[<p>Bit by bit I&#8217;m working on an animation that illustrates a SN2 reaction. Here&#8217;s a label free preview.</p>
<p style="text-align: center;">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_sn2-1v1_636428992"
			class="flashmovie"
			width="640"
			height="480">
	<param name="movie" value="http://ralphcanapa.com/blog/wp-content/uploads/2010/03/sn2-1v1.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://ralphcanapa.com/blog/wp-content/uploads/2010/03/sn2-1v1.swf"
			name="fm_sn2-1v1_636428992"
			width="640"
			height="480">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
]]></content:encoded>
			<wfw:commentRss>http://ralphcanapa.com/blog/index.php/2010/03/an-sn2-reaction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash ActionScript 2 PrintJob function example</title>
		<link>http://ralphcanapa.com/blog/index.php/2009/07/flash-printjob-example/</link>
		<comments>http://ralphcanapa.com/blog/index.php/2009/07/flash-printjob-example/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 17:25:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code Reference]]></category>
		<category><![CDATA[AS2]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://ralphcanapa.com/blog/?p=63</guid>
		<description><![CDATA[This ActionScript 2 code demonstrates how to use the PrintJob() function to generate a print job from JPG images in a subfolder.
In summary, what occurs is that all the images are imported/created as child movie clips of the parent movie clip, printZone, and then all the child movie clips are passed to the PrintJob object, [...]]]></description>
			<content:encoded><![CDATA[<p>This ActionScript 2 code demonstrates how to use the PrintJob() function to generate a print job from JPG images in a subfolder.</p>
<p>In summary, what occurs is that all the images are imported/created as child movie clips of the parent movie clip, printZone, and then all the child movie clips are passed to the PrintJob object, pj.</p>
<p>The biggest problem with this code is that for some reason the print dialog box does not give you the option to print selected pages.</p>
<pre  class="preCode">var printPath:String = "pages/"; // The is relative path to the subfolder containing the images.
var printLabel:String = "page-"; // For some reason I decided to use "page-" as the prefix for all the image files.
var printType:String = ".jpg"; // This is the file type for the images. You can use SWF files as well as PNGs instead, if you like.
var numPages:Number = 32; // The number of pages is hard coded but, given a chance to do it again, I'd probably go with an XML file definition.
var printXMin:Number = 0; // This variable and the next define the position on the page for the image. In this case, the upper left-hand corner is set to zero.
var printYMin:Number = 0;
var printXMax:Number = 1275; // This variable and the next define the number of pixels to force into the page from the source image.
var printYMax:Number = 1650; // And I set these variable to match the actual sizes of the JPG images so it would print the entire JPG image.
var printXScale:Number = 50; // An actual 8 1/2 X 11 sheet of paper is about 637.5 X 825 screen pixels and since the images are so much larger
var printYScale:Number = 50; // I had to scale them down 50% to fit on the page.

printCatalog = function() { // This function is called when some print button movie clip is released.
  loadingIndicator._visible = true; // The loadingIndicator movie clip nests a progressBar movie clip that is used to feedback progress for processes in general.
  var printLoader:MovieClipLoader = new MovieClipLoader(); // This is the MovieClipLoader object that manages to import the JPGs to the printZone movie clip.
  var printLoaderListener:Object = new Object(); // This object hosts the functions that are called for the MovieClipLoader object.
  var pageCount:Number = 1; // This variable keeps track of what page is being processed. 

  printLoader.addListener(printLoaderListener);

  printLoaderListener.onLoadProgress = function (target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number) {// This function updates the loadingIndicator to show progress of loading the individual pages.
    loadingIndicator.progressBar._width = Math.round(bytesLoaded/bytesTotal*100);
  }

  printLoaderListener.onLoadInit = function (mc:MovieClip) {//This function is called when the image is done loading.
    pageCount++; //When the image is loaded then the pageCounter is incremented. This could probably be put after the if-statement and the (numPages+1) term in the if-statement could be simply numPages.
    if (pageCount==(numPages+1)) {
      printDocument(); // If this is the last page then go ahead and print the document.
    } else {
      printNextPage(); // Only when the image is loaded do we proceed to load the next page image.    }
  }

  printDocument = function () {//This function simply takes the entire array of movie clip children from printZone and adds them as pages to the PrintJob() object, pj.
    var pj = new PrintJob();
    if(pj.start()) {
      var i = new Number();
      for (i=1;i&lt;=numPages;i++) {
        printZone["page"+i]._xscale = printXScale;
        printZone["page"+i]._yscale = printYScale;
        pj.addPage(eval("printZone.page"+i), {xMin:printXMin,xMax:printXMax,yMin:printYMin,yMax:printYMax},{printAsBitmap:true}, 1);
        loadingIndicator.progressBar._width = Math.round(i/numPages*100);//Here the progress of the pages adds is reflected in the loadingIndicator movie clip.
      }
      pj.send();
      loadingIndicator._visible = false;
      delete pj;
    }
  }

  printNextPage = function () { //This function parses the file name of the page and then
    var pageString = new String();
    if (pageCount&lt;10) {// For whatever reason, I formatted the files to be "page-001.jpg, page-002.jpg, ... , page-010.jpg, etc,..." This if-then statement formats the page element to match.
      pageString = "00"+pageCount.toString();
    } else {
      pageString = "0"+pageCount.toString();
    }
    var fileName:String = printPath+printLabel+pageString+printType;
    printZone.createEmptyMovieClip("page"+pageCount, pageCount);
    printLoader.loadClip(fileName, eval("printZone.page"+pageCount));// Here the image is called to load.
  }

  printNextPage(); // So here's where we start by loading the first page.
}</pre>
<p>This swath of code is fairly down-and-dirty. It could probably stand to have some error handlers. Also, a lot of this information could be offloaded to an XML file and make it more flexible.</p>
<p>-RC</p>
]]></content:encoded>
			<wfw:commentRss>http://ralphcanapa.com/blog/index.php/2009/07/flash-printjob-example/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Action Script 2.0 for playing a loop of a series of SWF files defined in an array.</title>
		<link>http://ralphcanapa.com/blog/index.php/2009/05/action-script-20-for-playing-a-loop-of-a-series-of-swf-files-defined-in-an-array/</link>
		<comments>http://ralphcanapa.com/blog/index.php/2009/05/action-script-20-for-playing-a-loop-of-a-series-of-swf-files-defined-in-an-array/#comments</comments>
		<pubDate>Mon, 25 May 2009 23:09:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code Reference]]></category>
		<category><![CDATA[AS2]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://canapacreative.com/blog/?p=56</guid>
		<description><![CDATA[So, yeah. Say you want to create a SWF that imports a series of SWFs and loops them. Well, here&#8217;s one way to do this.
// Action Script 2.0 for playing a loop of a series of SWF files defined in an array.
// Completion of the individual SWFs is defined as the event when the current [...]]]></description>
			<content:encoded><![CDATA[<p>So, yeah. Say you want to create a SWF that imports a series of SWFs and loops them. Well, here&#8217;s one way to do this.</p>
<pre class="preCode">// Action Script 2.0 for playing a loop of a series of SWF files defined in an array.
// Completion of the individual SWFs is defined as the event when the current frame
// is equal to the total number of frames.

fscommand("FULLSCREEN","true");
fscommand("showmenu", "false");

// You'll need a movie clip on the stage named movies_mc to hang the SWFs from. If you decide not to have one you can uncomment the following line to generate one.
//this.createEmptyMovieClip("movies_mc", 1);
var main_mc:MovieClipLoader = new MovieClipLoader();

var mcListener:Object = new Object();
main_mc.addListener(mcListener);

var movieTitle:Array = ["movie1.swf", "movie2.swf", "movie3.swf", "movie4.swf", "movie5.swf"];
var i:Number = 0;
var ii:Number = 0;

mcListener.onLoadInit = function(target_mc:MovieClip) {
    target_mc.onEnterFrame = function() {
        if (this._currentframe &gt;= this._totalframes) {
            trace("total frames = " + this._totalframes);

            i++;
            loadNextMovie(movieTitle[modFunction(i, movieTitle.length)]);
            delete this.onEnterFrame;
        } else {
            trace(target_mc._currentframe+" OF "+target_mc._totalframes);
        }
    }
}

function loadNextMovie(moviePath) {
    if (i&gt;0){main_mc.unloadClip(movies_mc);}
    trace("loading movie:" + moviePath + ", i="+i);
    main_mc.loadClip(moviePath, movies_mc);
}

function modFunction(n:Number,b:Number):Number {
  //****** MOD FUNCTION
  // n = number to apply the mod function to. b = base of for the mod function
  var result:Number = new Number();
  result = n - b*(Math.floor(n/b));
  return result;
}

loadNextMovie(movieTitle[i]);</pre>
<p>This script should be loaded into the first frame of a single frame FLA.</p>
]]></content:encoded>
			<wfw:commentRss>http://ralphcanapa.com/blog/index.php/2009/05/action-script-20-for-playing-a-loop-of-a-series-of-swf-files-defined-in-an-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

