Log in

View Full Version : swfaddress problem



Mark__G
11-16-2007, 09:12 PM
For some reason I can not figure out why my swf will not load correctly? It for some reason will not play from frame1, it skips to a later frame for some reason. Other than that it works perfect.

AS Code on Frame 1:


// SWFAddress code
#include "includes/SWFAddress.as"

// Custom utilities
function replace(str, find, replace) {
return str.split(find).join(replace);
}
function toTitleCase(str) {
return str.substr(0,1).toUpperCase() + str.substr(1).toLowerCase();
}
function getIndex(arr, obj) {
for (var i = 0; i < arr.length; i++) {
if (arr[i] == obj) {
return i;
}
}
}
function formatTitle(addr) {
if (addr.substr(addr.length - 1, 1) == '/') {
addr = addr.substr(0, addr.length - 1);
}
return 'STATUS COUTURE' + ((addr.length > 0) ? ' / ' + toTitleCase(replace(addr.substr(1), '/', ' / ')) : '');
}
// SWFAddress handling
SWFAddress.onChange = function() {
var arr = new Array('', '/travel/', '/dining/', '/entertainment/',
'/shopping/', '/information/', '/event-planning/', '/connections/',
'/business-services/', '/lifestyle-management/', '/who-we-are/', '/what-we-do/',
'/our-members/', '/contact-us/');
var addr = SWFAddress.getValue();
if (_currentframe == 1 && addr == '') {
play();
} else {
gotoAndPlay(126 + 17*getIndex(arr, addr));
}
SWFAddress.setTitle(formatTitle(addr));
}

_root.cursor_mc.swapDepths(1000);
_root.onEnterFrame = function() {
Mouse.hide();
cursor_mc._x = _root._xmouse;
cursor_mc._y = _root._ymouse;
}

var buttonSound:Sound = new Sound();

menu.onRollOver = function() {
_root.buttonSound.attachSound("RollOver");
_root.buttonSound.start();
}


The bolded if then statement seems to be not working correctly??

BLiZZaRD
11-17-2007, 04:54 PM
Try (_root._currentframe == blah blah

there are a lot of frames in the movie.. you need to specify which one else Flash will ignore it.

Mark__G
11-21-2007, 07:18 PM
Unfortunately that is not it. It still for some reason doesn't recognize the first frame as the starting reference to play the movie when the initial index page is loaded?

BLiZZaRD
11-21-2007, 08:38 PM
What code do you have on the first frame?

Mark__G
11-26-2007, 10:11 PM
That is the code on the first frame...

BLiZZaRD
11-27-2007, 05:20 AM
Try double quotes:



if (_root._currentframe == 1 && addr == "") {

Mark__G
11-27-2007, 07:18 PM
Nope, what is weird is I have another flash site that I got swfaddress working perfectly on and I have basically just emulated that flash file while only changing the number of frames between the address handling? The other site works perfect, playing the movie from the first frame while the user is on the index page.

BLiZZaRD
11-27-2007, 07:21 PM
WIthout seeing much, I can only guess at things... shouldn't you have a stop(); on frame one? There is a lot of info to parse there without a stop();

Mark__G
11-28-2007, 01:30 AM
figures...

Totally overlooked something that obvious and simple. Thanks.

BLiZZaRD
11-28-2007, 05:21 PM
Welcome :D