神魂顛倒論壇logo

icon
首頁Adobe Animate CCFlash教學/下載分享區Flash教學分享區 → [原創]教你如何做google地圖 flash cs3+pv3d 附檔

雷射溶脂 | 瘦小腹 | 植髮 | 眼袋 | 玻尿酸 | 電波拉皮 | Flash | 購物車 | Flash Player 11.2 | 豐胸 |

下一主題 上一主題


[原創]教你如何做google地圖 flash cs3+pv3d 附檔


[原創]教你如何做google地圖 flash cs3+pv3d 附檔 簡版






原創證明

首先你要有一張2048x1024的廣角結合景像圖(礙於學校資源,我只能傳我自已開發的)
我使用的是flash cs3 + pv3d (版本.920)
用cs3呼叫外部as3檔執行
流程如下
創建一個pv3d的3d圓
開啟雙面材質及監聽(很重要~)
讀取廣角結合景像圖
將廣角結合景像圖鏡像
鏡像的目的是因為,材質貼圖貼在內側所以會左右相反
如果正常的圖一貼上,就會左右相反
所以先左右相反再貼上,就會正常
(這問題會增加處理時間,不過為了結果論,就算了吧~)
接著創建鏡頭和3d箭頭
3d箭頭跟著鏡頭轉
鏡頭則跟著滑鼠轉,加上演算,3d箭頭就能很漂亮的動著

其他的就請下載附件吧

 

package {
 import flash.display.*;
 import flash.display.Loader;
 import flash.display.Sprite;
 import flash.display.Bitmap;
 import flash.display.BitmapData;

 import flash.system.fscommand;

 import flash.events.*;
 import flash.events.Event;
 import flash.events.MouseEvent;
 import flash.events.KeyboardEvent;

 import flash.geom.*;
 import flash.geom.Point;
 import flash.geom.Rectangle;

 import flash.net.URLRequest;

 import flash.utils.ByteArray;
 import flash.ui.Mouse;
 import flash.ui.Keyboard;

 import flash.text.*;

 import org.papervision3d.core.geom.renderables.Triangle3D;
 import org.papervision3d.core.proto.MaterialObject3D;
 import org.papervision3d.core.proto.LightObject3D;
 import org.papervision3d.lights.PointLight3D;
 import org.papervision3d.materials.shadematerials.FlatShadeMaterial;
 import org.papervision3d.materials.MovieMaterial;
 import org.papervision3d.materials.WireframeMaterial;
 import org.papervision3d.materials.ColorMaterial;
 import org.papervision3d.materials.BitmapMaterial;
 import org.papervision3d.objects.DisplayObject3D;
 import org.papervision3d.objects.primitives.Plane;
 import org.papervision3d.objects.primitives.Sphere;
 import org.papervision3d.objects.primitives.Cube;
 import org.papervision3d.objects.primitives.Arrow;
 import org.papervision3d.view.BasicView;
 import org.papervision3d.events.*;
 import org.papervision3d.events.FileLoadEvent;
 import org.papervision3d.events.InteractiveScene3DEvent;
 import org.papervision3d.cameras.CameraType;

 public class Map360 extends BasicView {
  private var loader:Loader;
  private var SBitmap:Bitmap;
  private var SBitmapData:BitmapData;
  private var ImageUrl:String="image/2048x1024_0000";
  private var ImageNum:int=0;
  private var ImgSphere:Sphere;
  private var arrowFont:Arrow,arrowBack:Arrow;
  private var PlaneLine:Plane;
  private var IsMove:Boolean,IsLoad:Boolean;
  private var timer:int;

  public function Map360() {
   super(800,600,true,false,CameraType.FREE);
   fscommand("allowscale", "false");
   viewport.interactive = true;
   camera.focus=100;
   camera.zoom=5;

   loader=new Loader;
   loader.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler);
   LoadURL(ImageUrl + adjInt_4(ImageNum) + ".jpg");

   var mapRequest:URLRequest=new URLRequest("image/map.JPG");
   var mapLoader=new Loader;
   mapLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,mapcompleteHandler);
   mapLoader.load(mapRequest);

   addPlane();
   addArrow();
   stage.addEventListener(MouseEvent.DOUBLE_CLICK, clickHandler);
  }
  private function clickHandler(event:MouseEvent):void {
   var path:int;
   if (viewport.containerSprite.mouseX<-337&& viewport.containerSprite.mouseX>-355) {
    if (viewport.containerSprite.mouseY<-210&& viewport.containerSprite.mouseY>-255) {
     path=(255+viewport.containerSprite.mouseY) /6;
     ImageNum=path*50;
     LoadURL(ImageUrl + adjInt_4(ImageNum) + ".jpg");
     camera.rotationY=0;
     camera.rotationX=0;
     CameraFlow(camera.rotationY);
    }
   } else if (viewport.containerSprite.mouseX<-319&& viewport.containerSprite.mouseX>-337) {
    if (viewport.containerSprite.mouseY<-105&& viewport.containerSprite.mouseY>-210) {
     path=(255+viewport.containerSprite.mouseY) /6;
     ImageNum=path*50;
     camera.rotationY=0;
     camera.rotationX=0;
     CameraFlow(camera.rotationY);
     LoadURL(ImageUrl + adjInt_4(ImageNum) + ".jpg");
    }
   }
  }
  public function mapcompleteHandler(event:Event):void {
   var loader:Loader=Loader(event.target.loader);
   SBitmap=Bitmap(loader.content);
   addChild(SBitmap);
  }
  public function addArrow():void {
   var light:LightObject3D=new PointLight3D;
   var material:MaterialObject3D;
   var greenMaterial:ColorMaterial = new ColorMaterial(0x00cc00);

   material=new FlatShadeMaterial(light,0x00ff00,0x333333,5);
   material.interactive = true;
   arrowFont=new Arrow(material);
   arrowFont.scale=0.25;
   arrowFont.z=300;
   arrowFont.y=-300;
   arrowFont.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK,arrowFontClick);
   scene.addChild(arrowFont);

   material=new FlatShadeMaterial(light,0x00ffff,0x333333,5);
   material.interactive = true;
   arrowBack=new Arrow(material);
   arrowBack.scale=0.25;
   //arrowBack.scaleX=0.25;
   //arrowBack.scaleY=0.25;
   //arrowBack.scaleZ=5;
   arrowBack.rotationX=180;
   arrowBack.z=-300;
   arrowBack.y=-275;
   arrowBack.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK,arrowBackClick);
   scene.addChild(arrowBack);
  }
  public function addPlane():void {
   var material:ColorMaterial = new ColorMaterial(0xFFFFFF,0.4);
   material.doubleSided=true;
   PlaneLine=new Plane(material,30,600);
   PlaneLine.rotationX=90;
   PlaneLine.z=0;
   PlaneLine.y=-310;
   scene.addChild(PlaneLine);
  }
  private function arrowFontClick(event:InteractiveScene3DEvent):void {
   if (IsLoad==false) {
    if (ImageNum < 1200) {
     IsLoad=true;
     ImageNum+= 50;
     LoadURL(ImageUrl + adjInt_4(ImageNum) + ".jpg");
    }
   }
  }
  private function arrowBackClick(event:InteractiveScene3DEvent):void {
   if (IsLoad==false) {
    if (ImageNum > 0) {
     IsLoad=true;
     ImageNum-= 50;
     LoadURL(ImageUrl + adjInt_4(ImageNum) + ".jpg");
    }
   }
  }
  public function LoadURL(URLstring:String) {
   trace(URLstring);
   scene.removeChild(ImgSphere);
   var request:URLRequest=new URLRequest(URLstring);
   loader.load(request);
  }
  public function completeHandler(event:Event):void {
   var loader:Loader=Loader(event.target.loader);
   SBitmap=Bitmap(loader.content);
   SBitmapData=ImageMirror(SBitmap.bitmapData);

   var bitmapMaterial:MaterialObject3D=new BitmapMaterial(SBitmapData,false);
   bitmapMaterial.interactive = true;
   bitmapMaterial.doubleSided=true;
   bitmapMaterial.tiled=true;

   ImgSphere=new Sphere(bitmapMaterial,2048,80,80);
   ImgSphere.addEventListener(InteractiveScene3DEvent.OBJECT_PRESS,ImgSphereDOWN);
   ImgSphere.addEventListener(InteractiveScene3DEvent.OBJECT_RELEASE,ImgSphereUP);
   scene.addChild(ImgSphere);
   startRendering();
   IsLoad=false;
  }
  public function ImageMirror(InputBitmapData:BitmapData):BitmapData {
   var DBitmapData:BitmapData=new BitmapData(2048,1024,false,0x000000);
   var tmp:uint;
   for (var i:int=0; i < 1024; i++) {
    for (var j:int=0; j < 2048; j++) {
     tmp=InputBitmapData.getPixel(j,i);
     DBitmapData.setPixel(2047 - j,i,tmp);
    }
   }
   return DBitmapData;
  }
  private function adjInt_4(val:int):String {
   if (val < 10) {
    return "000" + val;
   } else if (val < 100) {
    return "00" + val;
   } else if (val < 1000) {
    return "0" + val;
   } else {
    return "" + val;
   }
  }
  private function ImgSphereDOWN(event:InteractiveScene3DEvent):void {
   IsMove=true;
  }
  private function ImgSphereUP(event:InteractiveScene3DEvent):void {
   IsMove=false;
  }
  override protected function onRenderTick(e:Event=null):void {
   if (IsMove==true) {
    var pan:Number = camera.rotationY - 210* viewport.containerSprite.mouseX/(stage.stageWidth/2);
    pan = Math.max( -100, Math.min( pan, 100 ) );
    camera.rotationY -= pan / 12;
    var tilt:Number = 90 * viewport.containerSprite.mouseY/(stage.stageHeight/2);
    camera.rotationX -= (camera.rotationX + tilt) / 12;
    CameraFlow(camera.rotationY);
   }
   super.onRenderTick(e);
  }
  private function ArrowFlow(val:int):void {
   var tmp:Number;
   tmp=int(val % 360) * 0.0175;
   arrowFont.rotationY=ImgSphere.rotationY;
   arrowBack.rotationY=180 + ImgSphere.rotationY;
   arrowFont.z=Math.cos(tmp) * 300;
   arrowFont.x=Math.sin(tmp) * 300;
   arrowBack.z=Math.cos(tmp) * -300;
   arrowBack.x=Math.sin(tmp) * -300;
  }
  private function CameraFlow(val:int):void {
   var tmp:Number;
   tmp=int(val % 360) * 0.0175;
   camera.z=Math.cos(tmp) * -1000;
   camera.x=Math.sin(tmp) * -1000;
  }
 }
}


以下內容只有回覆後才可以瀏覽




瘦小腹 | 回到頂部

簡版






感謝分享下載研究看看怎麼構成的



自體脂肪隆乳 | 回到頂部

簡版






這個是一定要學的啊~感謝教學



自體脂肪隆乳 | 回到頂部

簡版






感謝大大熱心分享





購物車 | 回到頂部

簡版






??是好?西哦





雷射溶脂 | 回到頂部

簡版






謝謝大大無私的分享...





雷射溶脂 | 回到頂部

簡版






好厲害啊@@~~~!





自體脂肪隆乳 | 回到頂部

簡版






thanks



雷射溶脂 | 回到頂部

簡版






thank you i find it long time



瘦小腹 | 回到頂部

簡版






thank you



雷射溶脂 | 回到頂部
下一主題 上一主題
總數 32 1 2 3 4 下一頁