Menü ausrichten über xml datei [Flash CS3]
| Beiträge: 71 Wohnort: Potsdam-Babesberg Registriert: Mar 2005
| 24.08.2008, 15:44
Hallo wie kannn ich die Menü wenn ich geklickt habe das Swf anzeigen
zum Beispiel ich klicke jetzt auf Programme da soll das Swf-Date Programme anzeigen und ausrichten
Wie kann ich es über xml machen?Mit Beispiele verstehe ich besser | | | Beiträge: 71 Wohnort: Potsdam-Babesberg Registriert: Mar 2005
Themenautor/in
| 24.08.2008, 21:17
hallo hilft mir den keiner hmmmMit Beispiele verstehe ich besser | | | Beiträge: 2827 Wohnort: Bayern Registriert: Aug 2005
| 24.08.2008, 22:13
Tja, also ich für meine Teil verstehe die Frage leider überhaupt nicht.
Meinst du, du kannst das etwas besser formulieren? | | | Beiträge: 71 Wohnort: Potsdam-Babesberg Registriert: Mar 2005
Themenautor/in
| 25.08.2008, 00:00
also habe mal gezippt
wie kann ich diese test swf auf das index.swf das grüne fald bereich anzeigen und ausrichten per xml???
oder geht es auch anders???Mit Beispiele verstehe ich besser
Angehängte Dateien:
| Geändert von hornmartin am 25.08.08 um 00:00 Uhr | |
| | Beiträge: 71 Wohnort: Potsdam-Babesberg Registriert: Mar 2005
Themenautor/in
| 25.08.2008, 14:43
kann es keiner machenMit Beispiele verstehe ich besser | | | Beiträge: 71 Wohnort: Potsdam-Babesberg Registriert: Mar 2005
Themenautor/in
| 27.08.2008, 20:21
So ich habe auf dem Suche gemacht da habe ich ja etwas gefunden die als externe Movieclip lädt und die im XML einschreiben kann (=A), ich will aber auf meine grüne XML menü umschreiben lassen bitte die korrigierte hier posten (=B)
und will in XML soll das links und das supmenu bleiben
zu A:
ActionScript:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | //A variable to refer to this timeline
var home:MovieClip = this;
//The XML object
var xml:XML = new XML();
//Ignore all the white spaces in the XML file so the file is read correctly
xml.ignoreWhite = true;
//Nr of Buttons read from the XML file
var numOfButtons:Number;
//Array for button names
var btnNames:Array = new Array();
//Array for button links
var btnLinks:Array = new Array();
//Width of a button
var btnWidth:Number = 100;
//The function that is executed when the XML file is read
xml.onLoad = function(loaded) {
if (loaded) {
//Determine the number of buttons in the XML file.
//It counts the number of <button></button> tags (childnodes) in between the <menu></menu> tags(firstchild).
numOfButtons = this.firstChild.childNodes.length;
//Store the name and link of each button from the XML file in the arrays
for (var i = 0; i<numOfButtons; i++) {
//The first set of tags (childnodes[0]) in between each set of <button></button> tags are the <name></name> tags
btnNames[i] = this.firstChild.childNodes[i].childNodes[0].firstChild.nodeValue;
//The second set of tags (childnodes[1]) in between each set of <button></button> tags are the <link></link> tags
btnLinks[i] = this.firstChild.childNodes[i].childNodes[1].firstChild.nodeValue;
}
//Let's attach an instance of the main bar and give it the same width as the stage
var bar = home.attachMovie("bar", "bar", home.getNextHighestDepth());
bar._width = Stage.width;
//And add the light effect to the bar
var light = home.attachMovie("light", "light", home.getNextHighestDepth());
light._width = Stage.width;
//Let's determine where to start adding the buttons
//We want the center of the menu to be at the center of the stage
var menuLength:Number = numOfButtons*btnWidth;
var startX:Number = Stage.width/2-menuLength/2;
//Let's add the buttons
for (var i = 0; i<numOfButtons; i++) {
//Add an instance of the button mc to the stage
btn = home.attachMovie("btn", "btn"+i, home.getNextHighestDepth());
//Set its position
btn._x = i*btnWidth + startX;
//Set the button's name
btn.txt.text = btnNames[i];
//Set the button's roll over state
btn.onRollOver = function() {
this.gotoAndPlay(2);
}
//Set the button's roll out state
btn.onRollOut = function() {
this.gotoAndPlay(16);
}
//Set the link to the button
btn.link = btnLinks[i];
//Set the button's on release state
btn.onRelease = function() {
//Loads the swf on the holder mc instance on the _root stage.
//The holder has to be given an instance name!! Done on the properties tab on the left
loadMovie(this.link, _root.holder);
//You could also load in URL's, then you would use something like:
//getURL(this.link,_blank);
//Of course without the // and _self in stead of _blank to load it in the same window instead of a new window
}
}
//Now let's add the borders
for (var i = 0; i<numOfButtons+1; i++) {
//Add an instance of the borderL mc to the stage
//There is a border for each alignment, cause the border mc's are aligned differently as well.
border = home.attachMovie("border", "border"+i, home.getNextHighestDepth());
//Set its position
border._x = i*btnWidth + startX;
}
}
}
//Load in the XML file
xml.load("menu.xml");
|
und zu B:
ActionScript:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | stop();
var my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.load("menu.xml");
onEnterFrame = function(){
if(auto_center_x=="1"){
_x = (Stage.width/2 - (_width/2));
}
/*if(auto_center_y=="1"){
_y = (Stage.height/2 - (_height/2));
}*/
}
my_xml.onLoad = function(success){
if (success){
settings = my_xml.firstChild.childNodes[0].attributes;
menu_count = Number(settings.menu_count);
auto_center_x = Number(settings.auto_center_x);
auto_center_y = Number(settings.auto_center_y);
submenu = my_xml.firstChild.childNodes[1].attributes;
sub = String(submenu.cap);
for(i=1;i<=menu_count;i++){
duplicateMovieClip("menu","menu"+i,i);
eval("menu"+i)._x = 0 + (120*i) - 105;
sm = my_xml.firstChild.childNodes[i].attributes;
eval("menu"+i).label = sm.cap;
eval("menu"+i).menu_url = sm.menu_url;
eval("menu"+i).menu_load_movie = sm.menu_load_movie;
eval("menu"+i).window = sm.menu_url_window;
eval("menu"+i).level = sm.menu_load_movie_level;
eval("menu"+i).target = sm.menu_load_movie_mctarget;
//Action for button
eval("menu"+i).onRelease = function(){
trace(this.target);
if(this.menu_url<>""){
getURL(this.menu_url,this.window);
}else if(this.menu_load_movie<>""){
eval(this.target).loadMovie(this.menu_load_movie,this.level);
}
}
eval("menu"+i).onRollOver = function(){
this.gotoAndStop(2);
}
eval("menu"+i).onRollOut = function(){
this.gotoAndStop(1);
}
right_rounded._x = eval("menu" + menu_count)._x + 120;
left_rounded._x = eval("menu1")._x;
}
}
}
|
Mit Beispiele verstehe ich besser | Geändert von hornmartin am 27.08.08 um 20:22 Uhr | |
|
| Ähnliche Beiträge zum Thema | 11.04.2019 - Rennier 02.11.2020 - frliberti 05.10.2020 - Rrxxqg 28.03.2018 - WladSpiel |
|
Flashhilfe.de Flash Platform Tipps & Tutorials Flash Platform Andere Programmiersprachen Jobangebote Diskussionen
Flashhilfe News 
Regeln & Bedingungen
|