zephn
June 18, 2003, 12:42am
1
I have a menu array that has a few of links
var menuItems = [ “Rental Rates”,
“Catering Package”,
“London Bar Menu”,
“Floor Plan Level 1”,
“Floor Plan Level 2”];
var pdf = [ “components/cateringpackage.pdf”,
“components/floorplan1stlevel.pdf”,
“components/floorplan2ndlevel.pdf”,
“components/londonbarmenu.pdf”,
“components/rentalrates.pdf”];
for (i=0; i<menuItems.length; i++) {
mc = container.dynamicButton.duplicateMovieClip(“button”+i, i);
mc.menuLabel.text = menuItems*;
mc._y = i*(mc._height-1);
mc.movieToLoad = pdf*;
mc.actualButton.onPress = function() {
getURL(pdf,"_blank");
};
}
when I click on a button it pops up this webaddress. You’ll notice it is all the array options in one string. any ideas why that is?
C:\Documents%20and%20Settings\Zephn\Desktop\Thisislondon\components\cateringpackage.pdf,components\floorplan1stlevel.pdf,components\floorplan2ndlevel.pdf,components\londonbarmenu.pdf,components\rentalrates.pdf
system
June 18, 2003, 1:57am
2
the loop you have is weird, does it actually work? try this anyways
menuItems = [
"Rental Rates",
"Catering Package",
"London Bar Menu",
"Floor Plan Level 1",
"Floor Plan Level 2"
];
pdf = [
"components/cateringpackage.pdf",
"components/floorplan1stlevel.pdf",
"components/floorplan2ndlevel.pdf",
"components/londonbarmenu.pdf",
"components/rentalrates.pdf"
];
for (i=0; i<5; i++) {
mc = container.dynamicButton.duplicateMovieClip("button"+i, ++depth);
mc.menuLabel.text = menuItems*;
mc._y = i*(mc._height-1);
mc.actualButton.pdf = pdf*;
mc.actualButton.onPress = function() {
getURL(this.pdf, "_blank");
};
}
system
June 18, 2003, 2:10am
3
ahmed: His loop is weird because he chose not to use the Actionscript formatting tags :sigh:
And the problem lies here…
[AS]mc.movieToLoad = pdf*;
mc.actualButton.onPress = function() {
getURL(pdf,"_blank");
};[/AS]
getURL(pdf, “_blank”) will return all the items in the pdf array.
What you REALLY want is to change “pdf” to this.movieToLoad
system
June 18, 2003, 3:09am
4
oh oh I’m beginning o see the obvious problem but not the solution… let me explain what I want to hve happen. Sometimes when m,aking a post I forget to put the end result…
I want to have each button open a new window and load a url (or in this case a pdf) into it.
system
June 18, 2003, 3:17am
5
so I changed
getURL(pdf,"_blank");
to
getURL(this.movieToLoad,"_blank");
however no new window opens up and nothing else happen either.
system
June 18, 2003, 3:52am
6
Try _parent.movieToLoad instead of this.movieToLoad
system
June 18, 2003, 4:15am
7
*Originally posted by lostinbeta *
ahmed: His loop is weird because he chose not to use the Actionscript formatting tags :sigh:
lol!:P, i honestly thought it’s a different kind of loop that i haven’t dealt with yet
anywho, in the script i gave you, i assigned a variable to the button movieclip which is equivelent to the relative array entry , and it’s then called on the onPress event… did that not work?
mc.actualButton.pdf = pdf*;
mc.actualButton.onPress = function() {
getURL(this.pdf, "_blank");
};
}
system
June 18, 2003, 4:54am
8
unfortunatly it did not ahmed… would it be best if I posted the swf? … here I’ll do that in the post option
system
June 18, 2003, 4:57am
9
oops i mean fla
heres the current fla with the code
var menuItems = [
“Rental Rates”,
“Catering Package”,
“London Bar Menu”,
“Floor Plan Level 1”,
“Floor Plan Level 2”];
var pdf = [ “http://www.thisislondonclub.com/components/cateringpackage.pdf ” ,
“components/floorplan1stlevel.html”,
“components/floorplan2ndlevel.pdf”,
“components/londonbarmenu.pdf”,
“components/rentalrates.pdf”];
for (i=0; i<menuItems.length; i++) {
mc = container.dynamicButton.duplicateMovieClip(“button”+i, i);
mc.menuLabel.text = menuItems*;
mc._y = i*(mc._height-1);
mc.movieToLoad = pdf*;
mc.actualButton.onPress = function() {
getURL(this.movietoload,"_blank");
};
}
I tried chacing this string as an experiment
getURL(this.movietoload,"_blank");
to
getURL(“http://www.hotmail.com ,”_blank");
and it worked in making all the buttons go to hotmail
so the problem seems to be how I’m expressing the array in combination with get url.
system
June 18, 2003, 4:58am
10
keep in mind the links at the moment are mixed as I have been playing around with them
system
June 18, 2003, 5:04am
11
Ahmeds method worked perfectly fine for me…
[AS]mc.actualButton.movieToLoad = pdf*;
mc.actualButton.onPress = function() {
getURL(this.movieToLoad, “_blank”);
};[/AS]
system
June 18, 2003, 11:26am
12
weird now it does… thanks guys… maybe I cut out an extra line or somthing. Is it customary to post the end fla for people to use on these forums? I can do that if you guys like.
system
June 18, 2003, 7:14pm
13
It’s optional really, you can if you want, it may help someone, but you don’t have to.