Flash Gallery | Flash Templates | Flash Menu | Flash Design | Flash Audio & Video

Video Corsi Actionscript 3.0


+ Reply to Thread
Page 1 of 5 1 2 3 ... LastLast
Results 1 to 10 of 41

Thread: Caricare SWF esterni con più di una document Class

  1. #1
    Junior Member Settled In mcpll is on a distinguished road
    Join Date
    Jan 1970
    Posts
    4
    Rep Power
    0

    Exclamation Caricare SWF esterni con più di una document Class

    flash templates
    Dato che il from a to web è passato, almeno l'edizione romana, vorrei approfondire con chi è stato la il discorso che in un progetto flash as3 possiamo avere più swf con document class proprie e non come si diceva recentemente...
    Chiedo aiuto a chi è stato a roma perchè ci informi tutti a riguardo...
    Grazie....

  2. #2
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,609
    Rep Power
    9

    Re: Più document Class

    Ciao

    Bisogna utilizare l' evento Event.ADDED nella funzione costruttrice della DC dell' SWF che viene caricato.
    Ti allego un esempio:
    Attached Files

  3. #3
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,609
    Rep Power
    9

    Re: Più document Class

    In sostanza:
    ho main.fla che ha come DC Main.as ed ho external.fla che ha come DC External.as

    Main.as
    Code:
    package
    {
    	import flash.display.MovieClip;
    	import flash.display.Loader;
    	import flash.events.Event;
    	import flash.net.URLRequest;
    	
    	public class Main extends MovieClip
    	{
    		private var loader:Loader;
    		
    		public function Main()
    		{
    			loadSWF();
    		}
    		
    		private function loadSWF():void
    		{
    			var swf:URLRequest=new URLRequest();
    			swf.url='external.swf';
    			
    			loader=new Loader();
    			loader.contentLoaderInfo.addEventListener(Event.COMPLETE,done);
    			loader.load(swf);
    		}
    		
    		private function done(evt:Event):void
    		{
    			addChild(loader);
    		}
    	}
    }
    External.as
    Code:
    package
    {
    	import flash.display.MovieClip;
    	import flash.events.Event;
    	
    	public class External extends MovieClip
    	{
    		public function External()
    		{
    			addEventListener(Event.ADDED,init);
    		}
    		
    		private function init(evt:Event):void
    		{
    			removeEventListener(Event.ADDED,init);
    			clip_mc.addEventListener(Event.ENTER_FRAME,go);
    		}
    		
    		private function go(evt:Event):void
    		{
    			evt.target.rotation++;
    		}
    	}
    }

  4. #4
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,609
    Rep Power
    9

    Re: Più document Class

    Meglio ancora se si usa l' evento Event.ADDED_TO_STAGE, in quanto ti permette di raggiungere tranquillamente la timeline dell' SWF principale e quindi ogni sua MovieClip annessa.

    Allego esempio 2:
    Attached Files

  5. #5
    Senior Member Flash Obsessed nootropic.kint is on a distinguished road
    Join Date
    Jan 1970
    Posts
    133
    Rep Power
    41

    Re: Più document Class

    a me non va..
    provo a leggere un swf compilato che ha un metodo initStage
    e non lo becca..
    l'errore e'
    TypeError: Error #1009: Impossibile accedere a una proprietà o a un metodo di un riferimento oggetto null.
    at External/initStage()
    at External$iinit()

    ho provato sia con, nella main

    Code:
    addChild(loader);
    var t : External= new External();	
    iContent.addChild(t);
    l'errore e' acces of undefined propriety riferendosi agli oggetti istanziati sullo stage
    in compilazione

    che con

    Code:
    var r :External= new External();
    this = r;
    qui l'errore e' ovviamente che this non viene considerata una variabile con le normali regole di assegnamento ma un reference

    ma non va.. nel primo caso e nel caso "da manuale" copiato dai post precedenti

  6. #6
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,609
    Rep Power
    9

    Re: Più document Class

    Devi usare ADDED_TO_STAGE nella DC dell' SWF che carichi.

  7. #7
    Senior Member Flash Obsessed nootropic.kint is on a distinguished road
    Join Date
    Jan 1970
    Posts
    133
    Rep Power
    41

    Re: Più document Class

    si lo faccio..

  8. #8
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,609
    Rep Power
    9

    Re: Più document Class

    Allega i files please

  9. #9
    Senior Member Flash Obsessed nootropic.kint is on a distinguished road
    Join Date
    Jan 1970
    Posts
    133
    Rep Power
    41

    Re: Più document Class

    il problema e' che da dentro uno degli swf che carico chiamo lo stage cosi:

    iTextInputUser.txt.restrict = "a-zA-Z0-9";
    stage.focus = iTextInputUser.txt;

    ovviamente debuggando stage e' null..
    mi sto rileggendo tutti i post/tutorial per capire un po' come raccapezzarmi

  10. #10
    engineering-IT Flash Addict eturella is on a distinguished road eturella's Avatar
    Join Date
    Nov 2007
    Posts
    50
    Rep Power
    3

    Riferimento: Più document Class

    (da quanto ho visto in qualche esempio) non è che forse devi aggiungere parent ?

+ Reply to Thread
Page 1 of 5 1 2 3 ... LastLast

Similar Threads

  1. Caricamento swf esterni con più di una document class
    By Flep in forum Articoli e tutorials
    Replies: 21
    Last Post: 06-07-08, 15:13
  2. caricare URL da XML senza document class
    By bulga in forum Actionscript 3.0 base
    Replies: 0
    Last Post: 12-04-08, 13:25
  3. Document class
    By ariel in forum Flash Italiano
    Replies: 2
    Last Post: 16-03-08, 00:37
  4. Replies: 0
    Last Post: 09-10-07, 18:50
  5. preloader e caricamento swf esterni con più document class
    By kff in forum Actionscript 3.0 avanzato
    Replies: 41
    Last Post: 20-08-07, 13:37

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts