클릭 한 대상에 따라 navigateToURL을 사용하여 사용자를 다른 URL로 보내려면 어떻게해야합니까?

Codesee

위치가 다른 "가상 맵"의 SWF 파일이 있습니다. 각 위치를 클릭하면 사용자가 하이퍼 링크로 리디렉션됩니다.

각 위치를 다른 하이퍼 링크로 리디렉션하려면 어떻게해야합니까?

여기 에서 SWF를 다운로드 하거나 온라인에서 볼 수 있습니다. http://www.fastswf.com/NInMHKU

다음은 사용자가 위치를 클릭 할 때 리디렉션되도록하는 ActionScript 코드입니다.

package
{
   import flash.net.URLRequest;
   import flash.net.navigateToURL;
   import flash.events.MouseEvent;

   public class Map
   {
       public function Map()
       {
       }

       public function gotoLocation(param1:int) : void
       {
           if(param1 != 999)
           {
               navigateToURL(new URLRequest("http://www.baidu.com"),"_blank");
            }
        }

        private function closeMap(param1:MouseEvent = null) : void
        {

        }
    }
}

JPEXS Free Flash Decompiler라는 프로그램으로 SWF 파일을 디 컴파일 한 후지도의 각 위치에 대해 두 개의 다른 AS 파일이 있음을 발견했습니다. 예를 들어, 아래는 분 수용 파일입니다.

출처 : Flumsfountain_499.as

package SkylandersSuperchargersMap_26_10_15_fla
{
   import flash.display.MovieClip;

   public dynamic class Flumsfountain_499 extends MovieClip
   {


      public function Flumsfountain_499()
      {
         super();
         addFrameScript(0,this.frame1,1,this.frame2);
      }

      function frame1() : *
      {
         stop();
      }

      function frame2() : *
      {
         stop();
      }
   }
}

출처 : flumsfountainlPU_520.as

package SkylandersSuperchargersMap_26_10_15_fla
{
   import flash.display.MovieClip;

   public dynamic class flumsfountainlPU_520 extends MovieClip
   {


      public function flumsfountainlPU_520()
      {
         super();
         addFrameScript(18,this.frame19);
      }

      function frame19() : *
      {
         stop();
      }
   }
}


이전에 나는 시도했다 ...

RABCDAsm 을 사용 하여 SWF를 여러 다른 파일로 디 컴파일 할 수 있었고 다음 Map.class.asasm 은이 질문의 맨 위에있는 AS3 프로젝트에서 생성 한 코드 ( 소스 파일 :) 입니다.

  trait method QName(PackageNamespace(""), "gotoLocation")
   method
    name "gotoLocation"
    refid "TestGotoLocationFunction/instance/gotoLocation"
    param QName(PackageNamespace(""), "int")
    returns QName(PackageNamespace(""), "void")
    flag HAS_PARAM_NAMES
    paramname "param1"
    body
     maxstack 4
     localcount 2
     initscopedepth 0
     maxscopedepth 1
     code
      getlocal0
      pushscope

      getlocal1
      pushshort           999
      ifeq                L13

      getlex              QName(PackageNamespace("flash.net"), "navigateToURL")
      getglobalscope
      findpropstrict      QName(PackageNamespace("flash.net"), "URLRequest")
      pushstring          "http://www.baidu.com"
      constructprop       QName(PackageNamespace("flash.net"), "URLRequest"), 1
      pushstring          "_blank"
      call                2
      pop
L13:
      returnvoid
     end ; code
    end ; body
   end ; method
  end ; trait 
Kiran Shakya

com.binweevils.externalUIs.map.Map.as 파일을 편집합니다 .

  public function gotoLocation(param1:int) : void
  {
     if(param1 == 190)
     {
        navigateToURL(new URLRequest("http://www.different.com"),"_blank");
     }
     else if(param1 == 113)
     {
        navigateToURL(new URLRequest("http://www.something.com"),"_blank");
     }
     else
     {
        navigateToURL(new URLRequest("http://www.baidu.com"),"_blank");
     }
  }

param1에 대한 값은 다음에서 찾을 수 있습니다.

     this.mapLocs.push(new com.binweevils.externalUIs.map.MapLocation(this,this.halloween_btn,818));
     this.mapLocs.push(new com.binweevils.externalUIs.map.MapLocation(this,this.sinksSub_btn,116));
     this.mapLocs.push(new com.binweevils.externalUIs.map.MapLocation(this,this.tinksTree_btn,191));
     this.mapLocs.push(new com.binweevils.externalUIs.map.MapLocation(this,this.doshPalace_btn,102));
     this.mapLocs.push(new com.binweevils.externalUIs.map.MapLocation(this,this.gongsPipenest_btn,103));
     this.mapLocs.push(new com.binweevils.externalUIs.map.MapLocation(this,this.shoppingMall_btn,104));
     this.mapLocs.push(new com.binweevils.externalUIs.map.MapLocation(this,this.castleGam_btn,113));
     this.mapLocs.push(new com.binweevils.externalUIs.map.MapLocation(this,this.flem_manor_btn,125));
     this.mapLocs.push(new com.binweevils.externalUIs.map.MapLocation(this,this.partyBox_btn,10013));
     this.mapLocs.push(new com.binweevils.externalUIs.map.MapLocation(this,this.rumsCove_btn,129));
     this.mapLocs.push(new com.binweevils.externalUIs.map.MapLocation(this,this.flumsFountain_btn,190));
     this.mapLocs.push(new com.binweevils.externalUIs.map.MapLocation(this,this.riggsPalladium_btn,111));
     this.mapLocs.push(new com.binweevils.externalUIs.map.MapLocation(this,this.post_btn,120));
     this.mapLocs.push(new com.binweevils.externalUIs.map.MapLocation(this,this.figgsCafe_btn,156));
     this.mapLocs.push(new com.binweevils.externalUIs.map.MapLocation(this,this.grottoClub_btn,109));
     this.mapLocs.push(new com.binweevils.externalUIs.map.MapLocation(this,this.labsLab_btn,172));
     this.mapLocs.push(new com.binweevils.externalUIs.map.MapLocation(this,this.nestStreet_btn,115));
     this.mapLocs.push(new com.binweevils.externalUIs.map.MapLocation(this,this.nest_btn,5));
     this.mapLocs.push(new com.binweevils.externalUIs.map.MapLocation(this,this.binPetsParadiseRight_btn,100));
     this.mapLocs.push(new com.binweevils.externalUIs.map.MapLocation(this,this.binPetsParadiseLeft_btn,101));

각 라인 :

this.mapLocs.push (new com.binweevils.externalUIs.map. MapLocation (this, this.flumsFountain_btn , 190 ));

를 제공 buttonMC하고 roomID에 대한 어떤 더 PARAM1로 사용할 수 있습니다 gotoLocation()조건부 브라우저를 탐색 할 수 있습니다.

https://drive.google.com/open?id=0B_AKfmXEaZvQUldqNkU3ZW9ZMTg 에서 swf를 다운로드 할 수 있습니다.

참고 : 교육용이 아닌 한 허가없이 다른 자산을 디 컴파일하고 사용해서는 안됩니다.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관