Flash field shadow Control

Source: Internet
Author: User

VaR radar_offset: Number = 0;
VaR currentid: Number = 0;
VaR topid: Number = 1;
VaR Hotspots: array = new array;

// Create container movieclip
VaR Vr: movieclip = _ root. createemptymovieclip ("Vr", 1 );
// Prevent access to "real" Root
VR. _ lockroot = true;

Function clearhotspots (){
VaR MC: movieclip;
VaR I: number;
For (I = 0; I MC = hotspots [I];
MC. removemovieclip ();
}
Hotspots = new array ();
}

Function loadpanorama (ID: Number ){
// Create a movieclip Loader
VaR myloader = new movi1_loader ();
VaR mylistener = new object ();
 
// Remove old hotspots
Clearhotspots ();

Mylistener. onloadstart = function (){
VaR filename: string;
// Set the Dimentions and position of the Pano
Virtual Reality. window_width = 470;
Virtual Reality. window_height = 380;
VR. window_x = 120;
VR. window_y = 10;
// Change autorotation
VR. autorotate = 0.5;
VR. autorotate_delay = 20;

// Add a preview bar...
VaR my_fmt: textformat = new textformat ();
My_fmt.bold = true;
My_fmt.font = "Arial ";
My_fmt.size = 12;
My_fmt.color = 0 xffffff;
_ Root. createtextfield ("pretxt", 10,170, 40,200, 20 );
_ Root. pretxt. setnewtextformat (my_fmt );
_ Root. pretxt. selectable = false;
_ Root. pretxt. Text = "loading ...";
_ Root. createemptymovieclip ("prebar", 21 );
};

Mylistener. onloadprogress = function (target_mc: movieclip, loadedbytes: Number, totalbytes: Number ){
// Update SS bar
VaR X1: Number, X2: Number, Y1: Number, Y2: number;
_ Root. pretxt. Text = "loading..." + math. Floor (100 * loadedbytes/totalbytes) + "% ";
_ Root. prebar. Clear ();
_ Root. prebar. beginfill (0x0000ff, 30 );
_ Root. prebar. linestyle (2, 0x000080,100 );

X1 = _ root. pretxt. _ x;
X2 = X1 + 180 * loadedbytes/totalbytes;
Y1 = _ root. pretxt. _ y + 20;
Y2 = Y1 + 10;

_ Root. prebar. moveTo (x1, Y1 );
_ Root. prebar. lineto (X2, Y1 );
_ Root. prebar. lineto (X2, Y2 );
_ Root. prebar. lineto (x1, Y2 );
_ Root. prebar. lineto (x1, Y1 );
_ Root. prebar. endfill ();

};
 
Mylistener. onloadcomplete = function (){
// Remove progress bar
_ Root. pretxt. removetextfield ();
_ Root. prebar. removemovieclip ();
};

 
Mylistener. onloadinit = function (){
Setuppanorama (currentid );
// Add another hotspot to position Pan 0, tilt-90 (Nadir) without rolover Effect
VaR hs_p2q: movieclip = _ root. attachmovie ("pano2qtvr_lib", "hs_textmc2", 10200 );
Hs_p2q.onrelease = function (){
_ Root. geturl ('HTTP: // www.pano2qtvr.com ',' _ blank ');
}
VR. Pano. addhotspot ('p2q', 0,-90, hs_p2q );
// Add hotspots to a list to clear them
Hotspots. Push (hs_p2q );
Compass. FOV. _ visible = true;
};

// Add the listener
Myloader. addlistener (mylistener );
 
// Set the parameters for the different panoramas
If (ID = 1 ){
Filename = "park.swf ";
Radar_offset =-10;
Compass. _ x = map. _ x + map. bt1. _ x;
Compass. _ y = map. _ y + map. bt1. _ y;
}
If (ID = 2 ){
Filename = "pavilion.swf ";
Radar_offset = 110;
Compass. _ x = map. _ x + map. bt2. _ x;
Compass. _ y = map. _ y + map. bt2. _ y;
}
If (ID = 3 ){
Filename = "fountain.swf ";
Compass. _ x = map. _ x + map. bt3. _ x;
Compass. _ y = map. _ y + map. bt3. _ y;
Radar_offset = 210;
}
// Remove the radar during loading
Compass. FOV. _ XScale = 0;
Compass. FOV. _ yscale = 0;
Compass. FOV. _ visible = false;

//... And finally load the Pano!
Myloader. loadclip (filename, VR );
Currentid = ID;
 
}

Function addnextpanohotspot (Aid: String, apan: Number, atilt: Number, hstext: String, NID: Number ){
// Add first hotspot
Topid ++;
VaR hs_textmc1: movieclip = _ root. attachmovie ("hs_lib", "hs_textmc1", 10000 + topid );

// Set the text of this instance
Hs_textmc1.hstext.text = hstext;
// Add a action to this instance
Hs_textmc1.onrelease = function (){
Loadpanorama (NID );
}
// Rolover Effect
Hs_textmc1.hstext. _ visible = false;
Hs_textmc1.onrolover = function (){
Hs_textmc1.hstext. _ visible = true;
}
Hs_textmc1.onrolout = function (){
Hs_textmc1.hstext. _ visible = false;
}
VR. Pano. addhotspot (aid, apan, atilt, hs_textmc1 );
// Add hotspots to a list to clear them
Hotspots. Push (hs_textmc1 );
}

Function setuppanorama (ID: Number ){
// Reset the topid
Topid = 0;
// Add the hotspots for the other panoramas
If (ID = 1 ){
Addnextpanohotspot ("Pavilion", 69, 0, "Pavilion", 2 );
Addnextpanohotspot ("Fountain", 170, 0, "Fountain", 3 );
}
If (ID = 2 ){
Addnextpanohotspot ("park", 115, 0, "park", 1 );
Addnextpanohotspot ("Fountain", 54, 0, "Fountain", 3 );
}
If (ID = 3 ){
Addnextpanohotspot ("park", 120, 0, "park", 1 );
Addnextpanohotspot ("Pavilion", 144, 0, "Pavilion", 2 );
}
}

// Attach the border. The border is "higher" then the restm so it is in the forgound
VaR border: movieclip = _ root. attachmovie ("border_lib", "border", 20001, {_ ALPHA: 100 });

// Add the map
VaR map: movieclip = _ root. attachmovie ("map", "map", 20005, {_ x: 0, _ y: 100 });

// Connect the buttons in the map
Map. bt1.onpress = function (){
Loadpanorama (1 );
}
Map. bt2.onpress = function (){
Loadpanorama (2 );
}
Map. bt3.onpress = function (){
Loadpanorama (3 );
}

//... And the operation is even higher...
VaR compass: movieclip = _ root. attachmovie ("compass_lib", "Compass", 20010, {_ x: 60, _ y: 200, _ ALPHA: 50 });

Compass. FOV. _ XScale = 0;
Compass. FOV. _ yscale = 0;
Compass. _ visible = true;
Compass. FOV. _ visible = false;

// Update the shape of the clip on each frame
_ Root. onenterframe = function (){
Compass. FOV. _ rotation =-(Vr. Pano. getpan () + radar_offset );
Compass. FOV. _ XScale = 100 * Math. Tan (Vr. Pano. getfov () * Math. PI/360 );
Compass. FOV. _ yscale = 100 * Math. Cos (Vr. Pano. gettilt () * Math. PI/180 );
}

// Load the pavilion Pano first
Loadpanorama (2 );

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.