Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

Cambiamenti da AS 2.0 ad AS 3.0... Domande

This is a discussion on Cambiamenti da AS 2.0 ad AS 3.0... Domande within the Actionscript 3.0 base forums, part of the Flash CS3 generale category; Ciao a tutti. Probabilmente ci sono già post su questo argomento, ma cercandoli nei tag non ho traovato nulla. Allora ...


Go Back   Forum Flash CS3 Flash CS4 > Flash CS3 e Actionscript 3.0 > Flash CS3 generale > Actionscript 3.0 base

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-03-08, 20:32
Seejay's Avatar
Top Member
 
Join Date: Feb 2008
Location: Brescia / Florida
Posts: 59
Rep Power: 1
Seejay is on a distinguished road
Cambiamenti da AS 2.0 ad AS 3.0... Domande

Ciao a tutti.
Probabilmente ci sono già post su questo argomento, ma cercandoli nei tag non ho traovato nulla.
Allora un paio di domande:
---------------------------------------------------------------------------------
Prima sulla TimeLine potevo mettere:
Code:
_root.onEnterFrame = function(){
trace("Ciao nonna!")
}
ora non va... Cosa si usa al posto di questo?
---------------------------------------------------------------------------------

Poi, cosa significa "void" alla fine di ogni function in AS 3? (prima non era necessaria)
E' obbligatoria? Che significa?

---------------------------------------------------------------------------------

Devo fare ogni cosa con un listener?

---------------------------------------------------------------------------------
Nel seguente script:
Code:
function vai(evento:MouseEvent):void{
    porta_mc.gotoAndPlay(5);
}
C'è (evento:MouseEvent) ma quell "evento" non è una variabile dichiarata, o si?
Questo perchè non mi sembra parte del codice AS (altrimenti sarebbe colorata).

Scusate le tante-domande-tutte-assieme, ma proprio non capisco i cambiamenti...

Grazie mille.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2 (permalink)  
Old 02-03-08, 21:21
just a flasher
 
Join Date: Mar 2008
Posts: 118
Rep Power: 1
Teejay is on a distinguished road
Re: Cambiamenti da AS 2.0 ad AS 3.0... Domande

Ciao,

per la prima question:
Code:
addEventListener(Event.ENTER_FRAME, foo);

function foo(e:Event) {
    trace("Ciao nonna!");
}
e per rimuoverlo:
Code:
removeEventListener(Event.ENTER_FRAME, foo);
_________________________________________

void signigica semplicemente vuoto e sta ad indicare che la funzione non restituisce alcun dato

Se nella funzione avessi ad es. return 5 dovresti mettere function foo():int in quanto restituisci un numero intero
_________________________________________

Sì, tutto viene fatto con i listener
_________________________________________

La variabile evento viene dichiarata proprio nel codice function vai(evento:MouseEvent) e si riferisce a un argomento ricevuto dalla funzione.

In questo caso, il listener riceve da flash un oggetto MouseEvent che contiene tutte le informazioni riguardo alla posizione del mouse, all'oggetto che è stato clickato o su cui si è fatto rollover/rollout.

Successivamente lo potrai usare per ottenere queste informazioni.
Ad esempio il codice evento.target restituisce l'oggetto MovieClip (o altro) in questione.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Domande sui metodi del game gallina Marco756 Actionscript 3.0 base 2 04-01-08 10:54
domande su classe loader e vecchio loadmovie mariano.martucci Actionscript 3.0 base 6 07-08-07 18:31
Un po' di domande da newbie The Exception Flash CS3 generale 3 27-07-07 08:58


All times are GMT. The time now is 10:58.


Powered by vBulletin versione 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap


FlepStudio
by Filippo Lughi
P.IVA 03605860406