PDA

View Full Version : Testing Flash: works locally, fails on the web



madmac66
March 29th, 2008, 01:52 PM
My current project is displaying some very odd behavior I have never come across before. I am up against the wall with a deadline and no troubleshooting has lead to a solution yet. I am desperate for help.

I have a very simple SWF, plays some basic animation, and calls in external MP3 voiceover. Nothing complex. When the animation is complete, it lands on a static frame with 3 buttons. The buttons are actually instances of the same MC with a nested btn in, the text on the btn passed by a variable. Mouse over the btn and the MC plays a little animation. Click on the btn and a MovieClipLoader class calls in a SWF, which itself calls in another SWF of just formatted text.

For some reason this all tests well on my computer, and (very strangely) on our dev server for staging. When the files get deployed to to live site the animation plays through to the static frame with the btns, but when clicked the btns do not work. The external SWF does not load.

Now we've tested and tried every scenario checking the correct paths to the SWFs and everything is where it should be. I'm staring at the code waiting for something to jump out at me but it is very basic, and nothing looks astray.

We had a similar issue last night when the animation would not even play. It turned out the SWF was getting hung up on a frame that had an animated mask on it. I broke the mask into a shape and the SWF played properly after that. It took us 2 hours to figure that out. I was infuriated. Why would something so basic cause a movie to fail? Has anyone ever experienced this before? Is it a known bug? Could this be related to the issue of the btns now not working? I am at a loss where to try next, especially when something as random and obscure as a mask caused an earlier failure.

If you have any advice, please I would deeply appreciate it.

mm66




// this is the frame action on the final static frame of the presentation
stop();
voCar04.start(0, 0);
voCar04.setVolume(200);
voCar04.onSoundComplete = function(){
music.volumeTo(50, 2, "linear"); // using mc_tween imported class
}
// set text labels of the 3 buttons
headset_mc.label_mc.label_txt.text = "HEADSET";
cellPhone_mc.label_mc.label_txt.text = "MOBILE PHONE";
visorKit_mc.label_mc.label_txt.text = "CAR KIT";

var prodLoader:MovieClipLoader = new MovieClipLoader();

// sets the btn interactivity, plays a little animation when rolled over
headset_mc.hotSpot_btn.onRollOver = function(){
headset_mc.gotoAndPlay(2);
}
headset_mc.hotSpot_btn.onRollOut = function(){
headset_mc.gotoAndPlay(12);
}
cellPhone_mc.hotSpot_btn.onRollOver = function(){
cellPhone_mc.gotoAndPlay(2);
}
cellPhone_mc.hotSpot_btn.onRollOut = function(){
cellPhone_mc.gotoAndPlay(12);
}
visorKit_mc.hotSpot_btn.onRollOver = function(){
visorKit_mc.gotoAndPlay(2);
}
visorKit_mc.hotSpot_btn.onRollOut = function(){
visorKit_mc.gotoAndPlay(12);
}

// sets the call to the external SWFs, tried 2 methods of doing this, neither worked
headset_mc.hotSpot_btn.onRelease = function(){
_root.products_mc.loadMovie("product2.swf", 1);
//_root.prodLoader.loadClip("product2.swf", _root.products_mc);
}
cellPhone_mc.hotSpot_btn.onRelease = function(){
_root.prodLoader.loadClip("product3.swf", _root.products_mc);
}
visorKit_mc.hotSpot_btn.onRelease = function(){
_root.prodLoader.loadClip("product1.swf", _root.products_mc);
}

madmac66
March 29th, 2008, 04:29 PM
Well after a morning of digging and some luck, it turns out that the _root of the SWF inherits the root status from the HTML page, so all links to the files have to be relative the the HTML not the SWF.

in all my years I never came across this before. Go figure. now I know.

mm66

glosrfc
March 29th, 2008, 05:47 PM
The URL of your HTML page has no bearing whatsoever on _root. _root is simply a reference to the main timeline and therefore, if a movie clip has multiple levels, the root movie clip timeline is on the level containing the currently executing script. Also if a movie clip that contains _root is loaded into another movie clip, _root refers to the timeline of the loading movie clip, not the timeline that contains _root. I suspect that's what's happened in your code. You can get round this by either using _lockroot or avoiding the use of _root altogether. Have a read of this to understand how _root works...http://www.actionscript.com/Article/tabid/54/ArticleID/root-and-scope-in-flash/Default.aspx