actionscript 3 - add as3 in frames i add in 1 frame for all time line or key frame by key frame? -


//this in frame 1 put function movie clip in frame 3  directorio.addeventlistener(mouseevent.click, exec); function excec(e:mouseevent):void{  trace("yes"); } 

but if have same movieclip in frame 2 , 3 need duplicate same code. how can put general code in frames?

i have 13 frames , have problem add as3 in frames because if add functions frame frame have error of duplicated functions , if add as3 in onli 1 frame time line have error of propierty undefined , existst -> movie clip in time line frame 3 example.

so wath correct? :(

thanks.

1) search web how create document class in as3

2) create document class

3) i'm not sure directorio is...but if object go step 4

4) search web on how create linkeage class library object in as3

5) create linkeage class named directorio

6) write following code inside document class (name documentclass)

import flash.display.movieclip; import flash.events.mouseevent; public var directorio:directorio;  public function documentclass() {     directorio = new directorio();     directorio.addeventlistener(mouseevent.click, exec); }  public function exec():void {     trace("yes"); } 

what you're doing little united states doing debt...instead of thinking of future of programming in as3, want make quick fix here , now, sacrificing later. highly suggest go through these steps on how learn code in as3, rather more succinct fix (which possible, won't how, think using classes important in as3). hope helps