Ciao ragazzi ho un problema con questi script e non riesco a richiamare un sfw quando clicco sui tasti
ecco il codice AS:
Codice PHP:
stop();
usingXML = true;
if(usingXML == true){
Stage.align = "TL";
Stage.scaleMode = "noScale";
this._visible=false;
var my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.load("menu_parameters.xml");
my_xml.onLoad = function(success){
if (success){
//menuParameters saves the attributes of the node of the same name in the XML
menuParameters = my_xml.firstChild.childNodes[0].attributes;
tweenVelocity = 1 / Number(menuParameters.tweenVelocity);
firstTextColor = Number(menuParameters.firstTextColor);
secondTextColor = Number(menuParameters.secondTextColor);
firstRectangleColor = Number(menuParameters.firstRectangleColor);
secondRectangleColor = Number(menuParameters.secondRectangleColor);
//rectangleWidth is the number of pixels for the final width of the rectangle when the mouse
//is rolled over the button
rectangleWidth = Number(menuParameters.rectangleWidth);
//rectangleHeight is the number of pixels for the height of the rectangle when the mouse is
//rolled over the button
rectangleHeight = Number(menuParameters.rectangleHeight);
//verticalSpace is the number of pixels between the rectangles of the menu items
verticalSpace = Number(menuParameters.verticalSpace);
//initialAlphaTween is a boolean variable that determines whether the beginnig of the rectangle
//color tween has an alpha effect. 0 = false, 1 = true
initialAlphaTween = Number(menuParameters.initialAlphaTween);
//selectedMenu is a boolean variable that determines the fact that if you click a button
//it will keep the status of being pressed. 0 = false, 1 = true
selectedMenu = Number(menuParameters.selectedMenu);
initialPressedButton = Number(menuParameters.initialPressedButton);
initialMenuPositionX = Number(menuParameters.initialMenuPositionX);
initialMenuPositionY = Number(menuParameters.initialMenuPositionY);
initialTextPositionX = Number(menuParameters.initialTextPositionX);
initialTextPositionY = Number(menuParameters.initialTextPositionY);
initialTextWidth = Number(menuParameters.initialTextWidth);
initialTextHeight = Number(menuParameters.initialTextHeight);
typeWriterEffect = Number(menuParameters.typeWriterEffect);
arrTitles = new Array();
arrLinks = new Array();
//arrWindows is the array for the Windows of the items
arrWindows = new Array();
//arrMovieClips is the array where all the instances of the Menu Item are stored
arrMovieClips = new Array();
for(i = 1; i < my_xml.firstChild.childNodes.length; i++){
arrTitles.push(my_xml.firstChild.childNodes[i].attributes.titleName);
arrLinks.push(my_xml.firstChild.childNodes[i].attributes.link);
arrWindows.push(my_xml.firstChild.childNodes[i].attributes.window);
}
gotoAndStop(2);
}else{
_visible=true;
//We display the message "Error Loading XML"
displayError.text = "Error Loading XML";
}
}
}else{
//**************************** Using ActionScript for the Parameters ****************************
//tweenVelocity sets the velocity of the tween for the rectangle and the text
//im dividing 1 by the number you set in the XML so you should use whole numbers
//starting from 1 up to whatever you want. Remember that 1 will look like there is
//no tween but the rest of the numbers will divide the tween in n parts
tweenVelocity = 1/6;
//firstTextColor is the hexadecimal number for the first color of the text color tween
//this color will appear when the mouse is NOT rolled over the button or it has NOT been pressed
firstTextColor = 0xFF00CC;
//secondTextColor is the hexadecimal number for the second color of the text color tween
//this color will appear when the mouse is rolled over the button or it has been pressed
secondTextColor = 0xFFFFFF;
//firstRectangleColor is the hexadecimal number for the first color of the rectangle color tween
firstRectangleColor = 0x9900FF;
//secondRectangleColor is the hexadecimal number for the second color of the rectangle color tween
secondRectangleColor = 0xFF00CC;
//rectangleWidth is the number of pixels for the final width of the rectangle when the mouse
//is rolled over the button
rectangleWidth = 200;
//rectangleHeight is the number of pixels for the height of the rectangle when the mouse is
//rolled over the button
rectangleHeight = 50;
//verticalSpace is the number of pixels between the rectangles of the menu items
verticalSpace = 1;
//initialAlphaTween is a boolean variable that determines whether the beginnig of the rectangle
//color tween has an alpha effect. 0 = false, 1 = true
initialAlphaTween = true;
//selectedMenu is a boolean variable that determines the fact that if you click a button
//it will keep the status of being pressed. 0 = false, 1 = true
selectedMenu = false;
//initialPressedButton is the number of the item which will appear pressed after the menu is loaded
//starting from the top, the first item is number 1 and so on. Use number 0 if you dont wish any
//item to be apper pressed.
initialPressedButton = 3;
//initialTextPositionX is the initial X coodinate of the text for the Title of each item
//this coordinate is relative to the top left corner of the rectangle of each iteam
initialTextPositionX = -5;
//initialTextPositionY is the initial Y coodinate of the text for the Title of each item
//this coordinate is relative to the top left corner of the rectangle of each iteam
initialTextPositionY = 12;
//initialTextWidth is the initial width for the text of the title
//this variable WONT scale the text but it will work as a mask for the text if it's too short
initialTextWidth = 350;
//initialTextHeight is the initial height for the text of the title
//this variable WILL scale the text
initialTextHeight = 1000;
//typeWriterEffect is a boolean variable that determines wheather the typeWriter effect is
//applied to the rolled over buttons or not. 0 = false, 1 = true
typeWriterEffect = false;
//arrTitles is the array for the Titles of the items
arrTitles = ["home", "chi siamo", "servizi", "photo gallery", "dove siamo", "news", "dove siamo", "contatti.swf"];
//arrLinks is the array for the Links of the items, place them in the same order as the titles
arrLinks = ["peterpan.swf", "siamo.swf/", "servizi.swf", "photo_gallery.swf", "news.swf", "dove_siamo.swf", "contatti.swf"];
//arrWindows is the array for the Windows of the items, place them in the same order as the titles
/* You can use the next set of values or even the names of your own frames, example: "my_frame"
"_self" -> specifies the current frame in the current window.
"_blank" -> specifies a new window.
"_parent" -> specifies the parent of the current frame.
"_top" -> specifies the top-level frame in the current window.
*/
arrWindows = ["_blank","_blank","_blank","_blank","_blank","_blank"];
//arrMovieClips is the array where all the instances of the Menu Item are stored
arrMovieClips = new Array();
//After we read all the XML file and initialized all the variables wie load the rest
//of the movieclips to build the menu interface. NOTE:within the code one of the movieclips
//stored in the second frame we set the _visibile variable of the menu to true again
this.gotoAndStop(2);
}
//this function is called by every button when released
function doActions(numButtonPressed){
//condition to see if we are using XML
if(usingXML == true){
//If we are using XML for the parameters of the menu it will automaticly just work for URLs
loadMovieNum(arrLinks[numButtonPressed],2)
}else{
//If we are NOT using XML we can do whatever we want with ActionScript for each button like
//calling other functions, loading movieClips or just go to some URL
//This line of code is accessed by all the buttons
loadMovieNum(arrLinks[numButtonPressed],2)
//From this point on each if statement represents the actions for each and every single button
//here you can write any piece of code you need for each button
//just copy and paste the if statemen and change the number of the condition
if(numButtonPressed == 0){
//actions for the first button
}
if(numButtonPressed == 1){
//actions for the second button
}
if(numButtonPressed == 2){
//actions for the third button
}
// .
// ..
// ...
// ....
}
}
xml:
Codice PHP:
<menuItem
titleName="home page"
>
</menuItem>
<menuItem
titleName="chi siamo"
>
</menuItem>
<menuItem
titleName="servizi"
>
</menuItem>
<menuItem
titleName="photo gallery"
>
</menuItem>
<menuItem
titleName="dove siamo"
>
</menuItem>
<menuItem
titleName="news"
>
</menuItem>
<menuItem
titleName="contatti"
>
</menuItem>
</menu>
potete aiutarmi è due giorni che