[SWFObject] can anyone help me?
Aran Rhee
aran.rhee at qdc.net.au
Tue Nov 14 15:12:38 PST 2006
Robert.
There are a couple of issues with your page/flash.
1. You are setting up swfObject strangely. You have:
<script type="text/javascript">
var so = new SWFObject("navbar.swf", "navbar", "700", "195", "6",
"#000000");
so.addParam("classid", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000");
so.addParam("codebase",
"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version
=6,0,29,0");
so.addParam("movie", "navbar.swf");
so.addParam("quality", "high");
so.addParam("pluginspace",
"http://www.macromedia.com/go/getflashplayer");
so.addParam("type", "application/x-shockwave-flash");
so.addVariable("url", "/rob/index.cfm");
so.write("flashcontent");
</script>
When all you need is:
<script type="text/javascript">
var so = new SWFObject("navbar.swf", "navbar", "700", "195", "6",
"#000000"); so.addVariable("url", "/rob/index.cfm");
so.write("flashcontent");
</script>
SWFObject constructs all your codebase / classid etc for you.
2. In your flash movie you have a whole bunch of links pointing to your
internal machine IP which won't work on a live site:
getURL ("http://127.0.0.1:8500/rapidflame/caseglass.cfm");
Would need to be some thing like (I don't know what your actual final server
address will be):
getURL ("http://www.rapidflame.com/caseglass.cfm");
Or as a relative path:
getURL ("caseglass.cfm");
3. You might want to get someone who is familiar with flash to help you out
with the code in your menu system, as having all those if/else statements
for each language is really inneficient.
As only 1 part of the problem, you could replace the 11 instances of the
code block like below with a simple string concatination function.
// Your original code
on (press) {
if (_root.url == "/rapidflame/index.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/indexarab.cfm");
} else if (_root.url == "/rapidflame/headoffice.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/headofficearab.cfm");
} else if (_root.url == "/rapidflame/registeredoffice.cfm") {
getURL
("http://127.0.0.1:8500/rapidflame/registeredofficearab.cfm");
} else if (_root.url == "/rapidflame/salesoffice.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/salesofficearab.cfm");
} else if (_root.url == "/rapidflame/agents.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/agentsarab.cfm");
} else if (_root.url == "/rapidflame/indglass.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/indglassarab.cfm");
} else if (_root.url == "/rapidflame/indmetals.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/indmetalsarab.cfm");
} else if (_root.url == "/rapidflame/indpaper.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/indpaperarab.cfm");
} else if (_root.url == "/rapidflame/indfood.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/indfoodarab.cfm");
} else if (_root.url == "/rapidflame/indplastics.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/indplasticsarab.cfm");
} else if (_root.url == "/rapidflame/indflame.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/indflamearab.cfm");
} else if (_root.url == "/rapidflame/indceramics.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/indceramicsarab.cfm");
} else if (_root.url == "/rapidflame/indsafety.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/indsafetyarab.cfm");
} else if (_root.url == "/rapidflame/indenvironmental.cfm") {
getURL
("http://127.0.0.1:8500/rapidflame/indenvironmentalarab.cfm");
} else if (_root.url == "/rapidflame/galglass.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/galglassarab.cfm");
} else if (_root.url == "/rapidflame/galmetals.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/galmetalsarab.cfm");
} else if (_root.url == "/rapidflame/galpaper.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/galpaperarab.cfm");
} else if (_root.url == "/rapidflame/galfood.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/galfoodarab.cfm");
} else if (_root.url == "/rapidflame/galplastics.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/galplasticsarab.cfm");
} else if (_root.url == "/rapidflame/galflame.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/galflamearab.cfm");
} else if (_root.url == "/rapidflame/galceramics.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/galceramicsarab.cfm");
} else if (_root.url == "/rapidflame/galsafety.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/galsafetyarab.cfm");
} else if (_root.url == "/rapidflame/galenvironmental.cfm") {
getURL
("http://127.0.0.1:8500/rapidflame/galenvironmentalarab.cfm");
} else if (_root.url == "/rapidflame/caseglass.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/caseglassarab.cfm");
} else if (_root.url == "/rapidflame/casemetals.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/casemetalsarab.cfm");
} else if (_root.url == "/rapidflame/casepaper.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/casepaperarab.cfm");
} else if (_root.url == "/rapidflame/casefood.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/casefoodarab.cfm");
} else if (_root.url == "/rapidflame/caseplastics.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/caseplasticsarab.cfm");
} else if (_root.url == "/rapidflame/caseflame.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/caseflamearab.cfm");
} else if (_root.url == "/rapidflame/caseceramics.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/caseceramicsarab.cfm");
} else if (_root.url == "/rapidflame/casesafety.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/casesafetyarab.cfm");
} else if (_root.url == "/rapidflame/caseenvironmental.cfm") {
getURL
("http://127.0.0.1:8500/rapidflame/caseenvironmentalarab.cfm");
} else if (_root.url == "/rapidflame/contact.cfm") {
getURL ("http://127.0.0.1:8500/rapidflame/contactarab.cfm");
}
}
Replacement code e.g.
// test url variable
_root.url = "/rapidflame/index.cfm";
// setup server prefix
_root.serverPrefix = "http://www.mydomain.com";
// button click function placed on timeline , not the button
// btn is the instance name of a button on stage
btn.onRelease = function()
{
buildLink(_root.url, "arab");
}
// link building function called on each button press
function buildLink (origurl, language)
{
// take away the ".cfm" from the original link
var strippedURL = origurl.substring(0, origurl.lastIndexOf("."));
// rebuild a new absolute link with the specific language chosen
//trace(serverPrefix + strippedURL + language + ".cfm");
getURL (serverPrefix + strippedURL + language + ".cfm");
}
// will trace out / link to: "www.mydomain.com/rapidflame/indexarab.cfm"
You can basically ditch your 760 lines of hard to manage code (69 lines of
if/else * 11 languages) with the 2 actual lines of code in the buildLink()
function. Let me know if you want an .FLA
Regards,
Aran
> -----Original Message-----
> From: swfobject-bounces at lists.deconcept.com
> [mailto:swfobject-bounces at lists.deconcept.com] On Behalf Of
> Robert Jones
> Sent: Wednesday, 15 November 2006 1:23 AM
> To: swfobject at lists.deconcept.com
> Subject: [SWFObject] can anyone help me?
>
> thanks for your help but there is not stop command on the
> first frame, I have no idea what this problem is :(
>
> _________________________________________________________________
> Be the first to hear what's new at MSN - sign up to our free
> newsletters!
> http://www.msn.co.uk/newsletters
>
> _______________________________________________
> SWFObject mailing list
> SWFObject at lists.deconcept.com
> http://lists.deconcept.com/listinfo.cgi/swfobject-deconcept.com
More information about the Swfobject
mailing list