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

    attaccare un simbolo sopra un MC creato con actionscript 2.0

    Ciao a tutti,
    devo porre delle modifiche a uno file scritto in AS 2.0
    la scena è vuota, è tutto delegato ad acrioscript che importa da un XML delle immagini e fa uno slide con fade.
    Vorrei poter attaccare alla scena sopra delle immagini caricate, un simbolo presente nella libreria.
    Potrebbero andare bene due soluzioni, sia attaccare il simbolo ad ogni immagine, sia averno uno sopra tutto con lo slide di immagini sotto (ancora meglio). Scusate ma sono un pò arruginito su AS 2.

    poniamo che il simbolo abbia id=myMovie

    questo è il file xml:
    codice:
    <slideshow width="400" height="400" speed="3">
    <image url="images/image1.jpg" title="Market Walk" />
    <image url="images/image2.jpg" title="History" />
    <image url="images/image3.jpg" title="Ying Yang" />
    </slideshow>
    e questo l'acrionscript
    codice:
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    
    var myShowXML = new XML();
    myShowXML.ignoreWhite = true;
    myShowXML.load("slideshow.xml");
    
    myShowXML.onLoad = function() {
    	_root.myWidth = myShowXML.firstChild.attributes.width;
    	_root.myHeight = myShowXML.firstChild.attributes.height;
    	_root.mySpeed = myShowXML.firstChild.attributes.speed;
    
    	_root.myImages = myShowXML.firstChild.childNodes;
    	_root.myImagesNo = myImages.length;
    
    	createContainer();
    	callImages();
    
    };
    
    
    function createContainer() {
    	_root.createEmptyMovieClip("myContainer_mc",1);
    
    
    	myContainer_mc.lineTo(_root.myWidth,0);
    	myContainer_mc.lineTo(_root.myWidth,_root.myHeight);
    	myContainer_mc.lineTo(0,_root.myHeight);
    	myContainer_mc.lineTo(0,0);
    
    	myContainer_mc._x = (Stage.width-myContainer_mc._width)/2;
    	myContainer_mc._y = (Stage.height-myContainer_mc._height)/2;
    }
    
    function callImages() {
    
    	_root.myMCL = new MovieClipLoader();
    	_root.myPreloader = new Object();
    	_root.myMCL.addListener(_root.myPreloader);
    
    	_root.myClips_array = [];
    
    	_root.myPreloader.onLoadStart = function(target) {
    
    		_root.createTextField("myText_txt",_root.getNextHighestDepth(),0,0,100,20);
    		_root.myText_txt._x = (Stage.width-_root.myText_txt._width)/2;
    		_root.myText_txt._y = (Stage.height-_root.myText_txt._height)/2;
    		_root.myText_txt.autoSize = "center";
    
    		_root.myText_txt.text = "test";
    
    	};
    
    	_root.myPreloader.onLoadProgress = function(target) {
    
    		_root.myText_txt.text = "Loading.. "+_root.myClips_array.length+"/"+_root.myImagesNo+" Completed";
    
    	};
    
    
    	_root.myPreloader.onLoadComplete = function(target) {
    
    		_root.myClips_array.push(target);
    		target._alpha = 0;
    
    		if (_root.myClips_array.length == _root.myImagesNo) {
    
    			_root.myText_txt._y = myContainer_mc._y + myContainer_mc._height;
    			_root.target_mc = -1;
    			moveSlide();
    			myShowInt = setInterval(moveSlide, (_root.mySpeed*1000)+1000);
    
    
    		}
    
    	};
    
    	for (i=0; i<_root.myImagesNo; i++) {
    
    		temp_url = _root.myImages[i].attributes.url;
    		temp_mc = myContainer_mc.createEmptyMovieClip(i, myContainer_mc.getNextHighestDepth());
    		
    		_root.myMCL.loadClip(temp_url,temp_mc);
    	}
    }
    
    
    function moveSlide() {
    
    	current_mc = _root.myClips_array[_root.target_mc];
    	new Tween(current_mc, "_alpha", Strong.easeOut, 100, 0, 1, true);
    
    	_root.target_mc++;
    
    	if (_root.target_mc>=_root.myImagesNo) {
    		_root.target_mc = 0;
    	}
    	
    	_root.myText_txt.text = _root.myImages[target_mc].attributes.title;
    	next_mc = _root.myClips_array[_root.target_mc];
    	new Tween(next_mc, "_alpha", Strong.easeOut, 0, 100, 1, true);
    }
    grazie a tutti!
    http://www.trustweb.it - Web Development - Design 2D/3D - SEO & SEM

    Twitter http://twitter.com/#!/TrustWeb
    LinkedIn http://it.linkedin.com/in/trustweb

  2. #2
    Utente di HTML.it
    Registrato dal
    Feb 2009
    residenza
    Olbia
    Messaggi
    2,930
    Per caricare un clip filmato dalla libreria, fai tasto destro sul clip in libreria Concatenamento e spunti esporta per actionscript, nel campo identificatore compare il nome del clip filmato facciamo finta che si chiami quadro quindi aggiungi queste strighe
    codice:
    attachMovie("quadro","quadro2",99)
    quadro2._x=50
    quadeo2._y=50

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.