Flash Forum, Tutorials, Education & Training

 


Flash Tutorials


Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Update URLs
jelly46
post Oct 5 2011, 11:22 AM
Post #1


Newbie
Group Icon

Group: Members
Posts: 2
Joined: 25-June 10
Member No.: 6,913



Hello all

I have this code, how do i update the URL's?

Help ohmy.gif

[AS]
#include "mcTween.as"
// States: init body_parts bones

function initFade()
{
clearInterval(initFade_int);
body.skin.alphaTo(0, 2, 'linear', 2);
body.bones.alphaTo(0, 2, 'linear', 6);
body.bones.alphaTo(100, 1, 'linear', 10);
body.skin.alphaTo(100, 1, 'linear', 11);
initFade_int = setInterval(initFade, 12000);
}

function tab_rollOver(type)
{
if (currentState == "init") {
switch(type)
{
case 'body_parts' :
body_parts_btn.gotoAndStop("over");
clearInterval(initFade_int);
body.skin.stopTween();
body.bones.stopTween();
body.organs.stopTween();
body.skin.alphaTo(0, 1);
body.bones.alphaTo(0, 1);
body.organs.alphaTo(100, 1);
break;
case 'bones' :
bones_btn.gotoAndStop("over");
clearInterval(initFade_int);
body.skin.stopTween();
body.bones.stopTween();
body.organs.stopTween();
body.skin.alphaTo(0, 1);
body.bones.alphaTo(100, 1);
body.organs.alphaTo(0, 1);
break;
}
}
switch(type)
{
case 'body_parts' :
body_parts_btn.gotoAndStop("over");
break;
case 'bones' :
bones_btn.gotoAndStop("over");
break;
}
}

function tab_rollOut(type)
{
if (currentState == "init") {
clearInterval(initFade_int);
body.skin.stopTween();
body.bones.stopTween();
body.organs.stopTween();
body.skin.alphaTo(100, 1);
body.bones.alphaTo(100, 1);
body.organs.alphaTo(100, 1);
initFade();
}
switch(type)
{
case 'body_parts' :
body_parts_btn.gotoAndStop("out");
break;
case 'bones' :
bones_btn.gotoAndStop("out");
break;
}
}

bones_array = [ {label:"skull", name:"Skull", xpos:134, ypos:340},
{label:"teeth", name:"Teeth", xpos:135, ypos:313},
{label:"spine", name:"Spine", xpos:137, ypos:212},
{label:"ribcage", name:"Rib cage", xpos:138, ypos:226},
{label:"shoulderblades", name:"Shoulder Blades", xpos:138, ypos:265},
{label:"sternum", name:"Sternum", xpos:138, ypos:248},
{label:"humerus", name:"Humerus", xpos:135, ypos:221},
{label:"radius_ulna", name:"Radius & Ulna", xpos:138, ypos:156},
{label:"pelvis", name:"Pelvis bone", xpos:134, ypos:151},
{label:"femur", name:"Femur", xpos:141, ypos:95},
{label:"patella", name:"Patella / Kneecap", xpos:150, ypos:51},
{label:"tibia_fibula", name:"Tibia & Fibula", xpos:149, ypos:-11},
{label:"heelbone", name:"Heel bone", xpos:153, ypos:-64} ];

organs_array = [ {label:"brain", name:"Brain", xpos:72, ypos:295},
{label:"eyes", name:"Eyes", xpos:205, ypos:299},
{label:"ears", name:"Ears", xpos:136, ypos:271},
{label:"nose", name:"Nose", xpos:73, ypos:270},
{label:"tonsils", name:"Tonsils", xpos:75, ypos:237},
{label:"tongue", name:"Tongue", xpos:199, ypos:225},
{label:"lungs", name:"Lungs", xpos:60, ypos:151},
{label:"heart", name:"Heart", xpos:190, ypos:165},
{label:"muscles", name:"Muscles", xpos:147, ypos:126},
{label:"liver", name:"Liver", xpos:215, ypos:131},
{label:"digestive_system", name:"Digestive system", xpos:61, ypos:83},
{label:"kidneys", name:"Kidneys", xpos:138, ypos:54},
{label:"arteries_veins", name:"Arteries & Veins", xpos:149, ypos:15},
{label:"nerves", name:"Nerves", xpos:174, ypos:236},
{label:"hair", name:"Hair", xpos:121, ypos:231},
{label:"nails", name:"Nails", xpos:175, ypos:-58},
{label:"skin", name:"Skin", xpos:129, ypos:-58},
{label:"blood", name:"Blood", xpos:159, ypos:-38} ];

function gotoSection(type)
{
switch(type)
{
case 'body_parts' :
body.bones.alphaTo(0, 1);
body.organs.alphaTo(100, 1);
body_parts_btn.gotoAndStop("on");
bones_btn.gotoAndStop("out");
for (var i = 0; i<organs_array.length; i++) {
body.organs.front_organs[organs_array[i].label+"_mc"]._alpha = 0;
}
body.bones.gotoAndStop("static");
body.organs.gotoAndStop("buttons");
var int = setInterval(function() { clearInterval(int); startZoomControl(); showOrganExtras(); }, 1000);
if (currentState == "init") {
body.ySlideTo(300, 1);
body.scaleTo(200, 1);
}
currentState = "body";
break;
case 'bones' :
body.bones.alphaTo(100, 1);
body.organs.alphaTo(0, 1);
body_parts_btn.gotoAndStop("out");
bones_btn.gotoAndStop("on");
for (var i = 0; i<bones_array.length; i++) {
body.bones.front_bones[bones_array[i].label+"_mc"]._alpha = 0;
body.bones.front_bones[bones_array[i].label+"_mc_l"]._alpha = 0;
body.bones.front_bones[bones_array[i].label+"_mc_r"]._alpha = 0;
}
body.organs.gotoAndStop("static");
//body.bones.gotoAndStop("buttons");
var int = setInterval(function() { clearInterval(int); getURL("http://hospital.gosh.org/children/general-health-advice/body-tour/bones-and-joints/?xpos="+body._x+"&ypos="+body._y); }, 1200);
if (currentState == "init") {
body.ySlideTo(300, 1);
body.scaleTo(200, 1);
}
currentState = "body";
break;
}
}

function showOrganExtras()
{
for (var i = 13; i<organs_array.length; i++) {
body.organs.back_organs[organs_array[i].label+"_mc"].alphaTo(100, 1);
}
}

function hideOrganExtras()
{
for (var i = 13; i<organs_array.length; i++) {
body.organs.back_organs[organs_array[i].label+"_mc"].alphaTo(0, 1);
}
}

function organsRollover(mc) {
//body.scaleTo(220, 0.5);
showTooltip(organs_array[mc].name);
body.organs.front_organs[organs_array[mc].label+"_mc"]._alpha = 100;
body.organs.back_organs[organs_array[mc].label+"_mc"]._alpha = 0;
body.organs.front_organs[organs_array[mc].label+"_mc"].scaleTo(150, 1);
}

function organsRollout(mc) {
//body.scaleTo(200, 0.5);
hideTooltip();
body.organs.front_organs[organs_array[mc].label+"_mc"].scaleTo(100);
body.organs.front_organs[organs_array[mc].label+"_mc"]._alpha = 0;
body.organs.back_organs[organs_array[mc].label+"_mc"]._alpha = 100;
}

function organsPress(mc) {
hideTooltip();
body.organs.front_organs[organs_array[mc].label+"_mc"].scaleTo(100, 1);
body.organs.gotoAndStop("static");
body.organs.fade.alphaTo(100, 1);
diagram_mc.gotoAndStop(organs_array[mc].label);
diagram_mc.alphaTo(100, 1);
stopZoomControl();
body.slideTo(organs_array[mc].xpos, organs_array[mc].ypos, 1);
var int = setInterval(function() { clearInterval(int); getURL(organs_array[mc].label+".ashx", "_self"); }, 1200);
}

function bonesRollover(mc) {
//body.scaleTo(220, 0.5);
showTooltip(bones_array[mc].name);
body.bones.front_bones[bones_array[mc].label+"_mc"]._alpha = 100;
body.bones.back_bones[bones_array[mc].label+"_mc"]._alpha = 0;
body.bones.front_bones[bones_array[mc].label+"_mc"].scaleTo(150, 1);
body.bones.front_bones[bones_array[mc].label+"_mc_l"]._alpha = 100;
body.bones.back_bones[bones_array[mc].label+"_mc_l"]._alpha = 0;
body.bones.front_bones[bones_array[mc].label+"_mc_l"].scaleTo(150, 1);
body.bones.front_bones[bones_array[mc].label+"_mc_r"]._alpha = 100;
body.bones.back_bones[bones_array[mc].label+"_mc_r"]._alpha = 0;
body.bones.front_bones[bones_array[mc].label+"_mc_r"].scaleTo(150, 1);
}

function bonesRollout(mc) {
//body.scaleTo(200, 0.5);
hideTooltip();
body.bones.front_bones[bones_array[mc].label+"_mc"].scaleTo(100);
body.bones.front_bones[bones_array[mc].label+"_mc"]._alpha = 0;
body.bones.back_bones[bones_array[mc].label+"_mc"]._alpha = 100;
body.bones.front_bones[bones_array[mc].label+"_mc_l"].scaleTo(100);
body.bones.front_bones[bones_array[mc].label+"_mc_l"]._alpha = 0;
body.bones.back_bones[bones_array[mc].label+"_mc_l"]._alpha = 100;
body.bones.front_bones[bones_array[mc].label+"_mc_r"].scaleTo(100);
body.bones.front_bones[bones_array[mc].label+"_mc_r"]._alpha = 0;
body.bones.back_bones[bones_array[mc].label+"_mc_r"]._alpha = 100;
}

function bonesPress(mc) {
hideTooltip();
//body.bones.front_bones[bones_array[mc].label+"_mc"].scaleTo(100, 1);
//body.bones.front_bones[bones_array[mc].label+"_mc_l"].scaleTo(100, 1);
//body.bones.front_bones[bones_array[mc].label+"_mc_r"].scaleTo(100, 1);
body.bones.gotoAndStop("static");
body.bones.fade.alphaTo(100, 1);
stopZoomControl();
body.slideTo(bones_array[mc].xpos, bones_array[mc].ypos, 1);
var int = setInterval(function() { clearInterval(int); getURL(bones_array[mc].label+".ashx", "_self"); }, 1200);
}

function setClickToContinue(type, mc)
{
cont_btn._visible = true;
cont_btn.alphaTo(100, 0.5);

if (type == "bones") {
clickToContinue = function() {
body.bones.fade.alphaTo(0, 1);
body.xSlideTo(150, 1);
cont_btn.alphaTo(0, 0.5);
var int = setInterval(function() { clearInterval(int); cont_btn._visible = false; }, 0.5);
startZoomControl();
bonesRollout(mc);
body.bones.gotoAndStop("buttons");
this.onMouseDown = null;
}
} else {
clickToContinue = function() {
body.organs.fade.alphaTo(0, 1);
diagram_mc.alphaTo(0, 1);
body.xSlideTo(150, 1);
cont_btn.alphaTo(0, 0.5);
var int = setInterval(function() { clearInterval(int); cont_btn._visible = false; }, 0.5);
startZoomControl();
organsRollout(mc);
body.organs.gotoAndStop("buttons");
this.onMouseDown = null;
}
}
}

zoomCS = 100;

function setTooltip(txt)
{
tooltip.inner.textbox.text = txt;
tooltip.inner.textbox.autoSize = "left";
tooltip.inner.expand._x = tooltip.inner.textbox._width + 10;
}

function showTooltip(txt)
{
setTooltip(txt);
tooltip._x = _xmouse;
tooltip._y = _ymouse + 20;
tooltip._visible = true;
tooltip.onEnterFrame = function() {
tooltip._x = _root._xmouse;
tooltip._y = _root._ymouse + 20;
}
}

function hideTooltip()
{
tooltip._visible = false;
tooltip.onEnterFrame = null;
}

function startZoomControl()
{
trace("START");
zoomCSby = body._y;
this.onEnterFrame = function() {
if (checkMouseRect(this, 0, 0, 300, zoomCS)) {
var diff = (zoomCS - (_ymouse - 7)) / 10;
trace("UP "+diff);
if ((zoomCSby + diff) < 300) {
zoomCSby += diff;
} else {
zoomCSby = 300;
}
} else if (checkMouseRect(this, 0, (320 - zoomCS), 300, zoomCS)) {
var diff = (_ymouse - (320 - zoomCS)) / 10;
trace("DOWN "+diff);
if ((zoomCSby - diff) > -40) {
zoomCSby -= diff;
} else {
zoomCSby = -40;
0;
}
}
trace(zoomCSby);
body._y += (zoomCSby - body._y) / 3;
}
}

function stopZoomControl()
{
this.onEnterFrame = null;
}

function checkMouseRect(mc, x, y, w, h)
{
return ((mc._xmouse > x) && (mc._xmouse < (x+w)) && (mc._ymouse > y) && (mc._ymouse < (y+h)));
}

doAfter(myCallback, int)
{
var das = this;
arguments.shift();
arguments.shift();
var daargs = arguments;
var dalocFunc = function() { clearInterval(dalocInt); return myCallback.apply(das, arguments.concat(daargs));};
var dalocInt = setInterval(dalocFunc, int);
}

function goStraightTo(type, num)
{
body._xscale = 200;
body._yscale = 200;
currentState = "body";
body.skin._alpha = 0;
if (type == "bones") {
body.bones.gotoAndStop("static");
body.bones.fade._alpha = 100;
setClickToContinue("bones", num);
body._x = bones_array[num].xpos;
body._y = bones_array[num].ypos;
body.skin._alpha = 0;
body.organs._alpha = 0;
for (var i = 0; i<bones_array.length; i++) {
body.bones.front_bones[bones_array[i].label+"_mc"]._alpha = 0;
body.bones.front_bones[bones_array[i].label+"_mc_l"]._alpha = 0;
body.bones.front_bones[bones_array[i].label+"_mc_r"]._alpha = 0;
}
body.bones.front_bones[bones_array[num].label+"_mc"]._alpha = 100;
body.bones.front_bones[bones_array[num].label+"_mc_l"]._alpha = 100;
body.bones.front_bones[bones_array[num].label+"_mc_r"]._alpha = 100;
body.bones.front_bones[bones_array[num].label+"_mc"]._xscale = 150;
body.bones.front_bones[bones_array[num].label+"_mc_l"]._xscale = 150;
body.bones.front_bones[bones_array[num].label+"_mc_r"]._xscale = 150;
body.bones.front_bones[bones_array[num].label+"_mc"]._yscale = 150;
body.bones.front_bones[bones_array[num].label+"_mc_l"]._yscale = 150;
body.bones.front_bones[bones_array[num].label+"_mc_r"]._yscale = 150;
bones_btn.gotoAndStop("on");
setClickToContinue("bones", num);
} else if (type == "bones_joints") {
clearInterval(initFade_int);
body.skin.stopTween();
body.bones.stopTween();
body.organs.stopTween();
body.bones.gotoAndStop("buttons");
body._x = initxpos;
body._y = initypos;
body.skin._alpha = 0;
body.organs._alpha = 0;
startZoomControl();
for (var i = 0; i<bones_array.length; i++) {
body.bones.front_bones[bones_array[i].label+"_mc"]._alpha = 0;
body.bones.front_bones[bones_array[i].label+"_mc_l"]._alpha = 0;
body.bones.front_bones[bones_array[i].label+"_mc_r"]._alpha = 0;
}
bones_btn.gotoAndStop("on");
} else {
body.organs.gotoAndStop("static");
body.organs.fade._alpha = 100;
setClickToContinue("organs", num);
body._x = organs_array[num].xpos;
body._y =organs_array[num].ypos;
body.skin._alpha = 0;
body.bones._alpha = 0;
for (var i = 0; i<bones_array.length; i++) {
body.organs.front_organs[organs_array[i].label+"_mc"]._alpha = 0;
}
body.organs.front_organs[organs_array[num].label+"_mc"]._alpha = 100;
diagram_mc._alpha = 100;
diagram_mc.gotoAndStop(organs_array[num].label);
body_parts_btn.gotoAndStop("on");
for (var i = 13; i<organs_array.length; i++) {
body.organs.back_organs[organs_array[i].label+"_mc"]._alpha = 100;
}
setClickToContinue("organs", num);
}
}

switch (initpart)
{
case "skull" :
goStraightTo("bones", 0);
break;
case "teeth" :
goStraightTo("bones", 1);
break;
case "spine" :
goStraightTo("bones", 2);
break;
case "ribcage" :
goStraightTo("bones", 3);
break;
case "shoulderblades" :
goStraightTo("bones", 4);
break;
case "sternum" :
goStraightTo("bones", 5);
break;
case "humerus" :
goStraightTo("bones", 6);
break;
case "radius_ulna" :
goStraightTo("bones", 7);
break;
case "pelvis" :
goStraightTo("bones", 8);
break;
case "femur" :
goStraightTo("bones", 9);
break;
case "patella" :
goStraightTo("bones", 10);
break;
case "tibia_fibula" :
goStraightTo("bones", 11);
break;
case "heelbone" :
goStraightTo("bones", 12);
break;
case "brain" :
goStraightTo("organs", 0);
break;
case "eyes" :
goStraightTo("organs", 1);
break;
case "ears" :
goStraightTo("organs", 2);
break;
case "nose" :
goStraightTo("organs", 3);
break;
case "tonsils" :
goStraightTo("organs", 4);
break;
case "tongue" :
goStraightTo("organs", 5);
break;
case "lungs" :
goStraightTo("organs", 6);
break;
case "heart" :
goStraightTo("organs", 7);
break;
case "muscles" :
goStraightTo("organs", 8);
break;
case "liver" :
goStraightTo("organs", 9);
break;
case "digestive_system" :
goStraightTo("organs", 10);
break;
case "kidneys" :
goStraightTo("organs", 11);
break;
case "arteries_veins" :
goStraightTo("organs", 12);
break;
case "nerves" :
goStraightTo("nerves", 13);
break;
case "hair" :
goStraightTo("organs", 14);
break;
case "nails" :
goStraightTo("organs", 15);
break;
case "skin" :
goStraightTo("organs", 16);
break;
case "blood" :
goStraightTo("organs", 17);
break;
case "bones_joints" :
goStraightTo("bones_joints");
break;
default :
currentState = "init";
initFade();
break;
}


[/AS]
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 





> Webwasp Flash Forums
New Posts

RSS Lo-Fi Version Time is now: 2nd August 2014 - 08:33 AM