Very short trick: ADDED_TO_STAGE

per capire quando il nostro MovieClip è disegnato effettivamente sulla stage: As we have seen repeatedly, in the constructor of a class that extends MovieClip may be necessary to add the event ADDED_TO_STAGE to understand when our MovieClip is actually drawn on the stage:

1
2
3
4
/ / Constructor
MyClass ( ) : void { public function MyClass (): void {
Event . ADDED_TO_STAGE , main ) ; addEventListener ( Event . ADDED_TO_STAGE, main);
}

It would be a good idea to delete this event within the function main() :

1
2
3
4
5
6
7
8
9
/ / Constructor
MyClass ( ) : void { public function MyClass (): void {
Event . ADDED_TO_STAGE , main ) ; addEventListener ( Event . ADDED_TO_STAGE, main);
}
/ /
main ( e : Event = null ) : void { private function main (e: Event = null): void {
Event . ADDED_TO_STAGE , main ) ; removeEventListener ( Event . ADDED_TO_STAGE, main);
/ / ...
}

There are no comments for this post

Leave a comment

TAG XHTML PERMITS: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> INSERTION CODE:
 <pre></pre> // blocco generico <code></code> // blocco generico [cc_actionscript][/cc_actionscript] // Actionscript [cc_actionscript3][/cc_actionscript3] // Actionscript 3 [cc_css][/cc_css] // CSS Style Sheet [cc_html][/cc_html] // HTML [cc_js][/cc_js] // Javascript [cc_objc][/cc_objc] // Objective-C [cc_php][/cc_objc] // PHP [cc_sql][/cc_sql] // SQL 


Stop SOPA