In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

panorama

Panorama oefening
Get Adobe Flash player
by root.is1337.eu 16 Jun 2011
    Embed
/**
 * Copyright root.is1337.eu ( http://wonderfl.net/user/root.is1337.eu )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/89ff
 */

package  
{
    import flash.display.Bitmap;
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    
    /**
     * ...
     * @author Tim Schoonman
     */
    public class testPanorama extends Sprite
    {
        [Embed(source = 'http://i.imgur.com/NN6oT.png')]
        private var pan:Class;
        private var bm:Bitmap  =  new pan();
        private var pic:MovieClip  =  new MovieClip();
        private var pic2:MovieClip  =  new MovieClip();
        private var pic3:MovieClip  =  new MovieClip();
        private var swapPic:MovieClip;
        [Embed(source = 'http://i.imgur.com/5Z1Jp.jpg')]
        private var braq:Class;
        private var braqPic:Bitmap = new braq();
        
        [Embed(source = 'http://i.imgur.com/jcWrf.png')]
        private var pernod:Class;
        private var perPic:Bitmap = new pernod();
        
        private var delen:Number = 12;
        private var hotspot:Sprite = new Sprite;
        
        public function testPanorama() 
        {
            this.addChild(pic);
            this.addChild(pic2);
            this.addChild(pic3);
            
            pic.addChild(new pan());
            pic2.addChild(new pan());
            pic3.addChild(new pan());
            
            addEventListener(Event.ENTER_FRAME, scrollBar);
            
            hotspot.graphics.beginFill(0x57EC17, 0.2);
            hotspot.graphics.drawRect(pic.width / 2, 0, 50, 50);
            hotspot.graphics.endFill();
            hotspot.addEventListener(MouseEvent.MOUSE_OVER, spot);
            hotspot.addEventListener(MouseEvent.MOUSE_OUT, unspot);
            pic.addChild(hotspot);
        }
        //--EventListeners for hotspots.
        private function spot(e:MouseEvent):void 
        {
            positioning(braqPic, pic.width / 3, pic.height / 2, 0.2, 0.3);
            pic.addChild(braqPic);    
        }
        private function unspot(e:MouseEvent):void 
        {
            pic.removeChild(braqPic);
        }
        //--End of EvtListeners for hotspots
        private function scrollBar(e:Event):void
        {
            if (mouseX < stage.stageWidth / 8)
            {
                pic.x += delen;
            }
            if (mouseX > 7 * stage.stageWidth / 8)
            {
                pic.x -= delen;
            }
            //perPic.x = (mouseX / stage.width) * (pic.width - stage.width);
            if ( pic.x + pic.width < 0 )
            {
                swapPic  =  pic;
                pic  =  pic2;
                pic2  =  pic3;
                pic3  =  swapPic;
            }
            if ( pic.x > stage.stageWidth )
            {
                swapPic  =  pic2;
                pic2  =  pic;
                pic  =  pic3;
                pic3  =  swapPic;
            }
            pic2.x = pic.x + pic.width;
            pic3.x = pic.x - pic3.width;    
        }
        private function positioning(_pic:Bitmap, _x:Number, _y:Number, _sx:Number, _sy:Number):void
        {
            _pic.scaleX = _sx;
            _pic.scaleY = _sy;
            _pic.x        = _x;
            _pic.y        = _y;
        }
    }
}