Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    Problema tasti AS + XML

    Ciao a tutti
    ho un problemacon questo script, non riesco a far chiamare un file swf esterno

    Stage.scaleMode = "noScale";
    Stage.align = "TL";
    //global variables
    xml_path = "";
    images_path = "images/";
    level = 1;
    sections = new Array();
    //load XML
    var my_xml = new XML();
    my_xml.ignoreWhite = true;
    my_xml.load(xml_path+"data.xml");
    my_xml.onLoad = function() {
    sections = my_xml.firstChild.childNodes;
    ypos = 0;
    xpos = 0;
    _root.createEmptyMovieClip("MyMenu", level++);
    MyMenu._x = 0;
    MyMenu._y = 0;
    for (var i = 0; i<sections.length; i++) {
    n = "bu"+i;
    _root.MyMenu.attachMovie("Button", n, level++);
    with (_root.MyMenu[n]) {
    _y = ypos;
    _x = xpos;
    xpos += 110;
    }
    _root.MyMenu[n].loadDescr(sections[i].attributes.descr);
    _root.MyMenu[n].loadCaption(sections[i].attributes.caption);
    _root.MyMenu[n].hitFunction = sections[i].attributes.hitFunction;
    }
    // initMyMenuImages ();
    };
    function unhitAll() {
    for (var i = 0; i<sections.length; i++) {
    n = "bu"+i;
    _root.MyMenu[n]._state = 0;
    }
    }
    function initMyMenuImages() {
    _root.createEmptyMovieClip("MyMenuImages", level++);
    MyMenuImages._y = _root.ScreenHeight-100;
    for (var i = 0; i<sections.length; i++) {
    n = "img"+i;
    MyMenuImages.createEmptyMovieClip(n, i);
    with (MyMenuImages[n]) {
    _x = i*_root.ScreenWidth;
    loadMovie(images_path+sections[i].attributes.image);
    }
    }
    }
    _root.onEnterFrame = function() {

    };
    function setMyMenuImages() {
    pos = _root.MyMenuImages._x;
    if (pos%width != 0) {
    pos -= pos%_root.ScreenWidth;
    }
    for (var i = 0; i<sections.length; i++) {
    bu = "bu"+i;
    if (_root.MyMenu[bu]._state == 2) {
    pos = -(i*_root.ScreenWidth);
    }
    }
    for (var i = 0; i<sections.length; i++) {
    bu = "bu"+i;
    if (_root.MyMenu[bu]._state == 1) {
    pos = -(i*_root.ScreenWidth);
    }
    }
    _root.MyMenuImages._x += (pos-_root.MyMenuImages._x)/4;
    }
    //functions called when user clicks buttons
    hitThink = function () {
    trace("hit Think");
    // your action code for "Think" goes here
    };
    hitArt = function () {
    trace("hit ArtWork");
    };
    hitFlash = function () {
    trace("hit Flash");
    };
    hitMusic = function () {
    trace("hit Music");
    };
    hitResume = function () {
    trace("hit Resume");
    };
    hitGuests = function () {
    trace("hit Guests");
    };

    questo scipt è collegato a un file xml che è il seguente

    <data>
    <section descr="A collection of some mind numbing discussions!!" image="stage_due.swf" attribute="" caption="Chi siamo" swf="tmp" hitFunction="hitThink"/>
    <section image="paintmug.jpg" descr="My work experiences in graphic designing &amp; digital art" attribute="" caption="Servizi" swf="Design_01" hitFunction="hitArt"/>
    <section descr="Listen to my guitar compositions" image="frethand.jpg" attribute="" caption="Music" swf="music" hitFunction="hitMusic" />
    <section descr="Some of my Flash ActionScript experiments" image="wires.jpg" attribute="" caption="Flash" swf="expt" hitFunction="hitFlash" />
    <section descr="My latest resume" attribute="" image="01B.jpg" caption="Resume" swf="resume" hitFunction="hitResume"/>
    <section descr="Say something!" image="bag.jpg" attribute="" caption="Guests" swf="guests" hitFunction="hitGuests"/>
    </data>

    come posso fare per far partire swf esterno? sto impazzendo

    Grazie

  2. #2
    mi fai sapere cosa succede con questo codice??
    ciao
    Codice PHP:
    Stage.scaleMode "noScale";
    Stage.align "TL";
    //global variables
    xml_path "";
    images_path "";
    level 1;
    sections = new Array();
    //load XML
    var my_xml = new XML();
    my_xml.ignoreWhite true;
    my_xml.load(xml_path+"menu.xml");
    my_xml.onLoad = function() {
    sections my_xml.firstChild.childNodes;
    ypos 0;
    xpos 0;
    _root.createEmptyMovieClip("MyMenu"level++);
    MyMenu._x 0;
    MyMenu._y 0;
    for (var 
    0i<sections.lengthi++) {
    "bu"+i;
    _root.MyMenu.attachMovie("Button"nlevel++);
    with (_root.MyMenu[n]) {
    _y ypos;
    _x xpos;
    xpos += 110;
    }
    _root.MyMenu[n].loadDescr(sections[i].attributes.descr);
    _root.MyMenu[n].loadCaption(sections[i].attributes.caption);
    _root.MyMenu[n].hitFunction sections[i].attributes.hitFunction;
    _root.MyMenu[n].image=sections[i].attributes.image
    MyMenu
    [n].onRelease=function(){
        
    trace(this.image)}
    }
    // initMyMenuImages ();
    };
    function 
    unhitAll() {
    for (var 
    0i<sections.lengthi++) {
    "bu"+i;
    _root.MyMenu[n]._state 0;
    }
    }
    function 
    initMyMenuImages() {
    _root.createEmptyMovieClip("MyMenuImages"level++);
    MyMenuImages._y _root.ScreenHeight-100;
    for (var 
    0i<sections.lengthi++) {
    "img"+i;
    MyMenuImages.createEmptyMovieClip(ni);
    with (MyMenuImages[n]) {
    _x i*_root.ScreenWidth;
    loadMovie(images_path+sections[i].attributes.image);
    }
    }
    }
    _root.onEnterFrame = function() {

    };
    function 
    setMyMenuImages() {
    pos _root.MyMenuImages._x;
    if (
    pos%width != 0) {
    pos -= pos%_root.ScreenWidth;
    }
    for (var 
    0i<sections.lengthi++) {
    bu "bu"+i;
    if (
    _root.MyMenu[bu]._state == 2) {
    pos = -(i*_root.ScreenWidth);
    }
    }
    for (var 
    0i<sections.lengthi++) {
    bu "bu"+i;
    if (
    _root.MyMenu[bu]._state == 1) {
    pos = -(i*_root.ScreenWidth);
    }
    }
    _root.MyMenuImages._x += (pos-_root.MyMenuImages._x)/4;
    }
    //functions called when user clicks buttons
    hitThink = function () {
    trace("hit Think");
    // your action code for "Think" goes here
    };
    hitArt = function () {
    trace("hit ArtWork");
    };
    hitFlash = function () {
    trace("hit Flash");
    };
    hitMusic = function () {
    trace("hit Music");
    };
    hitResume = function () {
    trace("hit Resume");
    };
    hitGuests = function () {
    trace("hit Guests");
    }; 

  3. #3
    sono riuscito a risolvere

    con questo codice quando tu sei sopra il tasto c'è un randoom delle lettere è una sunto sotto ma manca un clip per funzionare correttamente.

    Se ti serve te lo mando fammi sapere ciao

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.