<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Create a 360° panorama viewer with AS3</title>
	<atom:link href="http://www.riacodes.com/flash/create-a-360-panorama-viewer-with-as3/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.riacodes.com/flash/create-a-360-panorama-viewer-with-as3/</link>
	<description>Resources, tutorials , tips &#38; tricks for RIA : Flex, Flash, Air, AS3</description>
	<lastBuildDate>Fri, 03 Feb 2012 02:30:24 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Snick</title>
		<link>http://www.riacodes.com/flash/create-a-360-panorama-viewer-with-as3/comment-page-1/#comment-18482</link>
		<dc:creator>Snick</dc:creator>
		<pubDate>Wed, 25 Jan 2012 07:55:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.riacodes.com/?p=1039#comment-18482</guid>
		<description>Here&#039;s a similar example using the greensock BlitMask. moves the panorama with mouseX.
Could use a few tweaks but it should work.

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.loading.ImageLoader;
import com.greensock.events.LoaderEvent;
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.MouseEvent;

var bm:BlitMask;
var s:Sprite;
var l:ImageLoader = new ImageLoader(&quot;ImageHaLongBayPanorama.jpg&quot;, {onComplete:imageLoaded});
l.load(true);

function imageLoaded(e:LoaderEvent):void
{
	var img:Bitmap = e.target.rawContent as Bitmap;
	s = new Sprite();
	s.addChild(img);
	addChild(s);
	
	bm = new BlitMask(s,s.x,s.y,stage.stageWidth,s.height,true,true,0,true);
	bm.bitmapMode = true;
	addEventListener(Event.ENTER_FRAME, onMove);
}

function onMove(e:Event):void
{
	var offset:Number = s.width / bm.width;
	var targetX:Number = (mouseX * offset) * -1;
	TweenMax.to(s, 2, {x:targetX, onUpdate:bm.update});
}</description>
		<content:encoded><![CDATA[<p>Here&#8217;s a similar example using the greensock BlitMask. moves the panorama with mouseX.<br />
Could use a few tweaks but it should work.</p>
<p>import com.greensock.*;<br />
import com.greensock.easing.*;<br />
import com.greensock.loading.ImageLoader;<br />
import com.greensock.events.LoaderEvent;<br />
import flash.display.Bitmap;<br />
import flash.display.Sprite;<br />
import flash.events.MouseEvent;</p>
<p>var bm:BlitMask;<br />
var s:Sprite;<br />
var l:ImageLoader = new ImageLoader(&#8220;ImageHaLongBayPanorama.jpg&#8221;, {onComplete:imageLoaded});<br />
l.load(true);</p>
<p>function imageLoaded(e:LoaderEvent):void<br />
{<br />
	var img:Bitmap = e.target.rawContent as Bitmap;<br />
	s = new Sprite();<br />
	s.addChild(img);<br />
	addChild(s);</p>
<p>	bm = new BlitMask(s,s.x,s.y,stage.stageWidth,s.height,true,true,0,true);<br />
	bm.bitmapMode = true;<br />
	addEventListener(Event.ENTER_FRAME, onMove);<br />
}</p>
<p>function onMove(e:Event):void<br />
{<br />
	var offset:Number = s.width / bm.width;<br />
	var targetX:Number = (mouseX * offset) * -1;<br />
	TweenMax.to(s, 2, {x:targetX, onUpdate:bm.update});<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hans</title>
		<link>http://www.riacodes.com/flash/create-a-360-panorama-viewer-with-as3/comment-page-1/#comment-16780</link>
		<dc:creator>hans</dc:creator>
		<pubDate>Sat, 31 Dec 2011 08:41:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.riacodes.com/?p=1039#comment-16780</guid>
		<description>Good day to all....
I&#039;ve tried the tutorial above and it is great works fine, but what if i add an invisible button on the image which when clicked will open another image.
Is that even possible??? it would be a great help if you make a tutorial of it.

Thank you so much!! 
and i wish everyone a Happy New Year!!! :-)</description>
		<content:encoded><![CDATA[<p>Good day to all&#8230;.<br />
I&#8217;ve tried the tutorial above and it is great works fine, but what if i add an invisible button on the image which when clicked will open another image.<br />
Is that even possible??? it would be a great help if you make a tutorial of it.</p>
<p>Thank you so much!!<br />
and i wish everyone a Happy New Year!!! <img src='http://www.riacodes.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mladen</title>
		<link>http://www.riacodes.com/flash/create-a-360-panorama-viewer-with-as3/comment-page-1/#comment-12995</link>
		<dc:creator>Mladen</dc:creator>
		<pubDate>Sun, 23 Oct 2011 17:51:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.riacodes.com/?p=1039#comment-12995</guid>
		<description>how to place a button in front of the panorama? Please help</description>
		<content:encoded><![CDATA[<p>how to place a button in front of the panorama? Please help</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Francis</title>
		<link>http://www.riacodes.com/flash/create-a-360-panorama-viewer-with-as3/comment-page-1/#comment-12007</link>
		<dc:creator>Francis</dc:creator>
		<pubDate>Fri, 16 Sep 2011 02:32:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.riacodes.com/?p=1039#comment-12007</guid>
		<description>Is there a version of this tutorial in either Actionscript 1.0 and Actionscript 2.0?</description>
		<content:encoded><![CDATA[<p>Is there a version of this tutorial in either Actionscript 1.0 and Actionscript 2.0?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Siyad</title>
		<link>http://www.riacodes.com/flash/create-a-360-panorama-viewer-with-as3/comment-page-1/#comment-11324</link>
		<dc:creator>Siyad</dc:creator>
		<pubDate>Sat, 13 Aug 2011 18:03:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.riacodes.com/?p=1039#comment-11324</guid>
		<description>Oops it works...

Sorry for the previous post.

Thanks alot  Ksun</description>
		<content:encoded><![CDATA[<p>Oops it works&#8230;</p>
<p>Sorry for the previous post.</p>
<p>Thanks alot  Ksun</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Siyad</title>
		<link>http://www.riacodes.com/flash/create-a-360-panorama-viewer-with-as3/comment-page-1/#comment-11323</link>
		<dc:creator>Siyad</dc:creator>
		<pubDate>Sat, 13 Aug 2011 18:01:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.riacodes.com/?p=1039#comment-11323</guid>
		<description>hi Ksun 

Mouse pan script didnt working for me.....

I did like this which is not working

// File downloaded from www.riacodes

var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader.load(new URLRequest(&quot;panorama.jpg&quot;));

function progressHandler(event:ProgressEvent):void{
	var ratio:Number = event.bytesLoaded / event.bytesTotal;
	percent.text = Math.ceil(ratio*100).toString() + &quot; %&quot;;
}

var content_mc:Sprite = new Sprite();

function completeHandler(event:Event):void{
	removeChild(percent);
	percent = null;
	
	var image1:Bitmap = (Bitmap)(loader.content);
	var image2:Bitmap = new Bitmap(image1.bitmapData.clone());
	content_mc.addChild(image1);
	content_mc.addChild(image2);
	image1.x = 0;
	image2.x = image1.width;
	
	addChild(content_mc);
	content_mc.x = 0;
	
	stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
}



stage.addEventListener(MouseEvent.MOUSE_DOWN, pressMouse);
stage.addEventListener(MouseEvent.MOUSE_UP, releaseMouse);
var mouseDownX:Number=0;

function pressMouse(e:MouseEvent):void{
mouseDownX = mouseX;
addEventListener(Event.ENTER_FRAME, panByMouse);
}

function releaseMouse(e:MouseEvent):void{
removeEventListener(Event.ENTER_FRAME, panByMouse);
}

function panByMouse(e:Event):void{
var speedAdjustment:Number = .5;
content_mc.x+= (mouseDownX-mouseX)*speedAdjustment;
 if (content_mc.x&gt;0) { 
	   		content_mc.x= -content_mc.width /2; 
	   }
 	   else if (content_mc.x &lt; stage.stageWidth - content_mc.width){
		 	content_mc.x= stage.stageWidth - content_mc.width/2 ;
	   }
}</description>
		<content:encoded><![CDATA[<p>hi Ksun </p>
<p>Mouse pan script didnt working for me&#8230;..</p>
<p>I did like this which is not working</p>
<p>// File downloaded from <a href="http://www.riacodes" rel="nofollow">http://www.riacodes</a></p>
<p>var loader:Loader = new Loader();<br />
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);<br />
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);<br />
loader.load(new URLRequest(&#8220;panorama.jpg&#8221;));</p>
<p>function progressHandler(event:ProgressEvent):void{<br />
	var ratio:Number = event.bytesLoaded / event.bytesTotal;<br />
	percent.text = Math.ceil(ratio*100).toString() + &#8221; %&#8221;;<br />
}</p>
<p>var content_mc:Sprite = new Sprite();</p>
<p>function completeHandler(event:Event):void{<br />
	removeChild(percent);<br />
	percent = null;</p>
<p>	var image1:Bitmap = (Bitmap)(loader.content);<br />
	var image2:Bitmap = new Bitmap(image1.bitmapData.clone());<br />
	content_mc.addChild(image1);<br />
	content_mc.addChild(image2);<br />
	image1.x = 0;<br />
	image2.x = image1.width;</p>
<p>	addChild(content_mc);<br />
	content_mc.x = 0;</p>
<p>	stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);<br />
}</p>
<p>stage.addEventListener(MouseEvent.MOUSE_DOWN, pressMouse);<br />
stage.addEventListener(MouseEvent.MOUSE_UP, releaseMouse);<br />
var mouseDownX:Number=0;</p>
<p>function pressMouse(e:MouseEvent):void{<br />
mouseDownX = mouseX;<br />
addEventListener(Event.ENTER_FRAME, panByMouse);<br />
}</p>
<p>function releaseMouse(e:MouseEvent):void{<br />
removeEventListener(Event.ENTER_FRAME, panByMouse);<br />
}</p>
<p>function panByMouse(e:Event):void{<br />
var speedAdjustment:Number = .5;<br />
content_mc.x+= (mouseDownX-mouseX)*speedAdjustment;<br />
 if (content_mc.x&gt;0) {<br />
	   		content_mc.x= -content_mc.width /2;<br />
	   }<br />
 	   else if (content_mc.x &lt; stage.stageWidth &#8211; content_mc.width){<br />
		 	content_mc.x= stage.stageWidth &#8211; content_mc.width/2 ;<br />
	   }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: panoramas 3d flash tutorial let you to build&#8230; &#171; Doing &#38; Done</title>
		<link>http://www.riacodes.com/flash/create-a-360-panorama-viewer-with-as3/comment-page-1/#comment-11223</link>
		<dc:creator>panoramas 3d flash tutorial let you to build&#8230; &#171; Doing &#38; Done</dc:creator>
		<pubDate>Tue, 09 Aug 2011 01:52:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.riacodes.com/?p=1039#comment-11223</guid>
		<description>[...] in Flash Panoramic 360 with Papervision3d Full Screen Flash 360 Panoramas – Are They Worth It? Create a 360° panorama viewer with AS3 3d Panorama Cruise Virtual Reality On Adobe Air Creating a 3D Room in Flash Catalyst   Share and [...]</description>
		<content:encoded><![CDATA[<p>[...] in Flash Panoramic 360 with Papervision3d Full Screen Flash 360 Panoramas – Are They Worth It? Create a 360° panorama viewer with AS3 3d Panorama Cruise Virtual Reality On Adobe Air Creating a 3D Room in Flash Catalyst   Share and [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ksun</title>
		<link>http://www.riacodes.com/flash/create-a-360-panorama-viewer-with-as3/comment-page-1/#comment-10401</link>
		<dc:creator>Ksun</dc:creator>
		<pubDate>Wed, 06 Jul 2011 16:37:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.riacodes.com/?p=1039#comment-10401</guid>
		<description>Oh, and DENNIS.

I don&#039;t know if you&#039;ll be checking this forum since you posted about a month ago. But if you set the cacheAsBitmap property on the content_mc to true it may help your performance on the ipad. 

After you add the bitmaps to the content_mc add this line:
content_mc.cacheAsBitmap = true;

Then in your publish settings for Air iOS set the hardware acceleration to GPU. I think this should help. Probably worth a shot anyway.</description>
		<content:encoded><![CDATA[<p>Oh, and DENNIS.</p>
<p>I don&#8217;t know if you&#8217;ll be checking this forum since you posted about a month ago. But if you set the cacheAsBitmap property on the content_mc to true it may help your performance on the ipad. </p>
<p>After you add the bitmaps to the content_mc add this line:<br />
content_mc.cacheAsBitmap = true;</p>
<p>Then in your publish settings for Air iOS set the hardware acceleration to GPU. I think this should help. Probably worth a shot anyway.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ksun</title>
		<link>http://www.riacodes.com/flash/create-a-360-panorama-viewer-with-as3/comment-page-1/#comment-10400</link>
		<dc:creator>Ksun</dc:creator>
		<pubDate>Wed, 06 Jul 2011 16:33:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.riacodes.com/?p=1039#comment-10400</guid>
		<description>Hi MAMDOUGH,

This is the code I wrote to control the panning with mouse events:

**************************************************************************
stage.addEventListener(MouseEvent.MOUSE_DOWN, pressMouse);
stage.addEventListener(MouseEvent.MOUSE_UP, releaseMouse);
var mouseDownX:Number=0;

function pressMouse(e:MouseEvent):void{
	mouseDownX = mouseX;
	addEventListener(Event.ENTER_FRAME, panByMouse);
}

function releaseMouse(e:MouseEvent):void{
	removeEventListener(Event.ENTER_FRAME, panByMouse);
}

function panByMouse(e:Event):void{
	var speedAdjustment:Number = .5;
	content_mc.x+= (mouseDownX-mouseX)*speedAdjustment;
	if(content_mc.x&gt;0) {
	      content_mc.x= -content_mc.width /2;
	 }
	else if (content_mc.x &lt; stage.stageWidth - content_mc.width){
	    content_mc.x= stage.stageWidth - content_mc.width/2 ;
    }
}

***************************************************************************

Just paste that in place of the keyPressed function. Should work. You can adjust the speedAdjustment variable to play with how fast you want the image to pan. 

As far as hotspots - you could make the original image into a MovieClip and add  hotspots (buttons or whatever you&#039;d like to it) and then add those two MovieClips to the content_mc rather than two bitmaps. Just a warning - this will probably slow things down though.

If you have questions about this you can email me here: kasonflash@gmail.com. I will check this account in the next couple days - but I don&#039;t use it that often.</description>
		<content:encoded><![CDATA[<p>Hi MAMDOUGH,</p>
<p>This is the code I wrote to control the panning with mouse events:</p>
<p>**************************************************************************<br />
stage.addEventListener(MouseEvent.MOUSE_DOWN, pressMouse);<br />
stage.addEventListener(MouseEvent.MOUSE_UP, releaseMouse);<br />
var mouseDownX:Number=0;</p>
<p>function pressMouse(e:MouseEvent):void{<br />
	mouseDownX = mouseX;<br />
	addEventListener(Event.ENTER_FRAME, panByMouse);<br />
}</p>
<p>function releaseMouse(e:MouseEvent):void{<br />
	removeEventListener(Event.ENTER_FRAME, panByMouse);<br />
}</p>
<p>function panByMouse(e:Event):void{<br />
	var speedAdjustment:Number = .5;<br />
	content_mc.x+= (mouseDownX-mouseX)*speedAdjustment;<br />
	if(content_mc.x&gt;0) {<br />
	      content_mc.x= -content_mc.width /2;<br />
	 }<br />
	else if (content_mc.x &lt; stage.stageWidth &#8211; content_mc.width){<br />
	    content_mc.x= stage.stageWidth &#8211; content_mc.width/2 ;<br />
    }<br />
}</p>
<p>***************************************************************************</p>
<p>Just paste that in place of the keyPressed function. Should work. You can adjust the speedAdjustment variable to play with how fast you want the image to pan. </p>
<p>As far as hotspots &#8211; you could make the original image into a MovieClip and add  hotspots (buttons or whatever you&#039;d like to it) and then add those two MovieClips to the content_mc rather than two bitmaps. Just a warning &#8211; this will probably slow things down though.</p>
<p>If you have questions about this you can email me here: <a href="mailto:kasonflash@gmail.com">kasonflash@gmail.com</a>. I will check this account in the next couple days &#8211; but I don&#039;t use it that often.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mamdouh</title>
		<link>http://www.riacodes.com/flash/create-a-360-panorama-viewer-with-as3/comment-page-1/#comment-9697</link>
		<dc:creator>Mamdouh</dc:creator>
		<pubDate>Sat, 04 Jun 2011 18:55:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.riacodes.com/?p=1039#comment-9697</guid>
		<description>Many thanks for this appreciated tutorial, but I wanna make it by mouse events! also to add hot spots on the image that should move correctly like the image. Any help please?</description>
		<content:encoded><![CDATA[<p>Many thanks for this appreciated tutorial, but I wanna make it by mouse events! also to add hot spots on the image that should move correctly like the image. Any help please?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

