Hello all,
looks like I've inherited a flash file from a previous builder and it works fine - however - the client wants a "whooshy" sound when you roll over the buttons. When I looked at the fla file I found this.......... yikes, way, way, above me!!!! Is there a way to add a snd to this so onRollover it plays once? I've tried attaching an on rollover play to a snd in a new layer of the first frame but it errors out - I'm missing it, but thats because of my limited knowledge (I know enough to make myself dangerous)
any ideas? -- oh this is a 2004MX file, I don't have 8 yet. (money |-p)
frame1 actions--
button action
looks like I've inherited a flash file from a previous builder and it works fine - however - the client wants a "whooshy" sound when you roll over the buttons. When I looked at the fla file I found this.......... yikes, way, way, above me!!!! Is there a way to add a snd to this so onRollover it plays once? I've tried attaching an on rollover play to a snd in a new layer of the first frame but it errors out - I'm missing it, but thats because of my limited knowledge (I know enough to make myself dangerous)
any ideas? -- oh this is a 2004MX file, I don't have 8 yet. (money |-p)
frame1 actions--
Code:
function onXmlLoad(success){
if(success){
trace("file loaded");
if(this.firstChild.attributes.speed){
timeToWait = 31 * parseInt(this.firstChild.attributes.speed);
}
if(this.firstChild.attributes.fadespeed){
fadeAccel = parseInt(this.firstChild.attributes.fadespeed);
}
trace(this.firstChild.attributes.defaultimg);
mcImage = mcContainer.createEmptyMovieClip("DefaultImage", 0);
loadImage(this.firstChild.attributes.defaultimg, mcImage, {_x:0, _y:0, _alpha:0});
arrImages.push(mcImage);
arrLinks.push(this.firstChild.attributes.defaulturl);
currentImage = 0;
initArrays();
} else {
thumbs[0].txtHeading.text = "File not loaded";
trace("file not loaded");
}
}
function initArrays(){
trace("init arrays");
if(xmlImages.firstChild && xmlImages.firstChild.hasChildNodes()){
nodes = xmlImages.firstChild.childNodes;
var Register_2_ = 0;
while(Register_2_ < nodes.length){
trace(nodes[Register_2_].firstChild.firstChild.nodeValue);
trace(nodes[Register_2_].childNodes[1].firstChild.nodeValue);
mcImage = mcContainer.createEmptyMovieClip(("XmlImage" + Register_2_), (Register_2_ + 1));
loadImage(nodes[Register_2_].firstChild.firstChild.nodeValue, mcImage, {_x:0, _y:_root.movieheight, _alpha:100});
mcThumb = thumbs[Register_2_].container.createEmptyMovieClip("thumb", thumbs[Register_2_].container.getNextHighestDepth());
mcThumb.number = Register_2_;
loadImage(nodes[Register_2_].childNodes[1].firstChild.nodeValue, mcThumb, {_x:0, _y:88, _alpha:0});
arrImages.push(mcImage);
arrSmImages.push(mcThumb);
arrLinks.push(nodes[Register_2_].childNodes[2].firstChild.nodeValue);
thumbs[Register_2_].txtHeading.text = nodes[Register_2_].childNodes[3].firstChild.nodeValue;
thumbs[Register_2_].txtSubHead.text = nodes[Register_2_].childNodes[4].firstChild.nodeValue;
if(nodes[Register_2_].attributes.actiontext != null && nodes[Register_2_].attributes.actiontext.length > 0){
thumbs[Register_2_].btnPlay.mc_text.learn.text = nodes[Register_2_].attributes.actiontext.toUpperCase();
} else {
thumbs[Register_2_].btnPlay.mc_text.learn.text = "LEARN MORE"; //change this if necessary
}
Register_2_++;
}
arrayinit = true;
}
}
function loadImage(strImage, mcTarget, init){
var Register_4_ = new Object();
Register_4_["onLoadInit"] = function (target){
for(var Register_3_ in init){
target[Register_3_] = init[Register_3_];
}
target.imgLoaded = true;
_root.imagesLoaded++;
if(target._name.indexOf("Default") >= 0){
target.maxAlpha = 100;
target.onEnterFrame = fadeIn;
}
trace(((((("finished loading image: " + target) + " ") + target.getBytesLoaded()) + "/") + target.getBytesTotal()));
}
var Register_3_ = new MovieClipLoader();
arrLoaders.push(Register_3_);
Register_3_.addListener(Register_4_);
Register_3_.loadClip(strImage, mcTarget);
}
function transition(){
mcTransition._x = -2000;
mcTransition["onEnterFrame"] = function (){
if(this._x >= 760){
this.onEnterFrame = null;
return undefined;
}
this._x += 100;
}
}
function fadeIn(){
if(this._alpha >= this.maxAlpha){
this.onEnterFrame = null;
return undefined;
}
if(this._alpha <= this.maxAlpha / 60){
this._alpha += _root.fadeAccel;
} else {
this._alpha += Math.ceil(_root.fadeAccel / 1.5);
}
}
function fadeOut(){
if(this._alpha <= 0){
this.onEnterFrame = null;
return undefined;
}
this._alpha -= _root.fadeAccel;
}
function slideUp(){
if(this._y <= 0){
this._alpha = 100;
this.onEnterFrame = null;
return undefined;
}
accel = _root.slideAccel;
if(this._y / _root.movieheight < 0.4){
accel = _root.slideAccel / 1.5 + (1 - this._y / _root.movieheight);
}
(this._y - accel) <= 0 ? (this._y = 0) : (this._y = this._y - accel);
if(!(this._alpha >= 100)){
this._alpha += 1.5 * _root.fadeAccel;
}
}
function slideDown(){
if(this._y >= _root.movieheight){
this.onEnterFrame = null;
return undefined;
}
accel = _root.slideAccel;
if(this._y / _root.movieheight > 0.6){
accel = _root.slideAccel / (1.5 + this._y / _root.movieheight);
}
(this._y + accel) >= _root.movieheight ? (this._y = _root.movieheight) : (this._y = this._y + accel);
if(!(this._alpha <= 0)){
this._alpha -= 2 * _root.fadeAccel;
}
}
function thmbSlideUp(){
if(this._y <= 0){
this._alpha = 100;
this.onEnterFrame = null;
return undefined;
}
accel = _root.slideAccel - 15;
if(this._y / thumbheight < 0.4){
accel = _root.slideAccel / 1.5 + (1 - this._y / thumbheight);
}
(this._y - accel) <= 0 ? (this._y = 0) : (this._y = this._y - accel);
if(!(this._alpha >= 100)){
this._alpha += 1.5 * _root.fadeAccel;
}
}
function thmbSlideDown(){
if(this._y >= thumbheight){
this._alpha = 0;
this.onEnterFrame = null;
return undefined;
}
accel = _root.slideAccel - 15;
if(this._y / thumbheight > 0.6){
accel = _root.slideAccel / (1.5 + this._y / thumbheight);
}
(this._y + accel) >= thumbheight ? (this._y = thumbheight) : (this._y = this._y + accel);
if(!(this._alpha <= 0)){
this._alpha -= 4 * _root.fadeAccel;
}
}
function timedSlideDown(target){
target.onEnterFrame = thmbSlideDown;
clearInterval(_root.nInter);
}
movieheight = 230; ////////////////////////////// look at main window for layer called *mcContainer = the image sizes in html set to 365
moviewidth = 900; /////////////////////////////// set this to larger if needed
thumbwidth = 237;
thumbheight = 88;
if(!strFile){
strFile = "./xml_txts/dyna.xml"; /////////////////////////////////////////////////////////////////////where xml is located
}
stop();
var arrImages = new Array();
var arrSmImages = new Array();
var arrLinks = new Array();
var arrWait = new Array();
var thumbs = new Array();
var arrLoaders = new Array();
thumbs.push(mcThmb1);
thumbs.push(mcThmb2);
thumbs.push(mcThmb3);
mcThmb1.nImage = 1;
mcThmb2.nImage = 2;
mcThmb3.nImage = 3;
var timeToWait = 10;
var fadeAccel = 5;
var slideAccel = 25;
var frame = -1;
var arrayinit = false;
var bPaused = false;
var bJust = false;
var currentImage = -1;
var currentThumb = -1;
var imagesLoaded = 0;
var nInter;
var xmlImages = new XML();
xmlImages.ignoreWhite = true;
xmlImages.onLoad = onXmlLoad;
if(_root.strFile){
xmlImages.load(strFile);
}
this["onEnterFrame"] = function (){
if((arrayinit && !bPaused) && (imagesLoaded == (arrImages.length + arrSmImages.length))){
frame++;
if((frame % timeToWait) == 0){
lastThumb = currentThumb;
currentThumb++;
if(currentThumb >= arrSmImages.length){
currentThumb = 0;
}
if(!arrSmImages[currentThumb].imgLoaded){
currentThumb--;
return undefined;
}
trace(((arrSmImages[currentThumb] + " ") + slideUp));
arrSmImages[currentThumb].onEnterFrame = thmbSlideUp;
thumbs[currentThumb].btnPlay.reverse = false;
thumbs[currentThumb].btnPlay.play();
if(bJust){
bJust = false;
thumbs[lastThumb].btnPlay.reverse = true;
} else {
if(lastThumb >= 0 && lastThumb < arrSmImages.length){
_root.nInter = setInterval(timedSlideDown, 100, arrSmImages[lastThumb]);
thumbs[lastThumb].btnPlay.reverse = true;
}
}
}
}
}
mcContainer["onRelease"] = function (){
getURL(_root.arrLinks[_root.currentImage], "");
}
;
button action
Code:
this.hitArea = this.bg;
this.mc_border.maxAlpha = 40;
this.thumbwidth = 237;
this.thumbheight = 88;
this["onEnterFrame"] = function (){
if(!_root.arrImages[this.nImage] && !_root.arrSmImages[(this.nImage - 1)]){
return undefined;
}
if(_root.arrImages[this.nImage].imgLoaded && _root.arrSmImages[(this.nImage - 1)].imgLoaded){
this.bg._y = 0;
this.onEnterFrame = null;
_root.frame = -1;
return undefined;
}
oImgLoaded = _root.arrLoaders[this.nImage].getProgress(_root.arrImages[this.nImage]);
oThmLoaded = _root.arrLoaders[this.nImage].getProgress(_root.arrSmImages[(this.nImage - 1)]);
trace(((((("Image: " + _root.arrImages[this.nImage]) + " - ") + oImgLoaded.bytesLoaded) + "/") + oImgLoaded.bytesTotal));
trace(((((("Thumb: " + _root.arrSmImages[(this.nImage - 1)]) + " - ") + oThmLoaded.bytesLoaded) + "/") + oThmLoaded.bytesTotal));
nTotalLoaded = oImgLoaded.bytesLoaded + oThmLoaded.bytesLoaded;
nTotalToLoad = oImgLoaded.bytesTotal + oThmLoaded.bytesTotal;
this.bg._y = 88 - nTotalLoaded / nTotalToLoad * 88;
}
this["onRollOver"] = function (){
trace(((((this + " ") + this.nImage) + " ") + _root.arrImages[this.nImage].imgLoaded));
trace(((_root.currentThumb + " ") + (this.nImage - 1)));
if(!_root.arrImages[this.nImage].imgLoaded && !_root.arrSmImages[(this.nImage - 1)].imgLoaded){
return undefined;
}
if(_root.currentThumb != (this.nImage - 1)){
_root.arrSmImages[_root.currentThumb].onEnterFrame = _root.thmbSlideDown;
_root.thumbs[_root.currentThumb].btnPlay.reverse = true;
}
this.container.thumb.onEnterFrame = _root.thmbSlideUp;
if(mc_border._currentframe < 20){
mc_border.reverse = false;
mc_border.play();
}
_root.arrImages[this.nImage].onEnterFrame = _root.slideUp;
_root.currentImage = this.nImage;
_root.bPaused = true;
if(btnPlay._currentframe < 23){
btnPlay.reverse = false;
btnPlay.play();
}
}
this["onRollOut"] = function (){
this.container.thumb.onEnterFrame = _root.thmbSlideDown;
_root.arrImages[this.nImage].onEnterFrame = _root.slideDown;
_root.currentImage = 0;
_root.currentThumb = this.nImage - 1;
_root.frame = -1;
_root.bPaused = false;
_root.bJust = true;
btnPlay.reverse = true;
mc_border.reverse = true;
}
this["onRelease"] = function (){
getURL(_root.arrLinks[this.nImage], "");
}
;