actionscript 3 - AS3 Access MovieClip on Stage? -


i have movie clip added timeline frame 1 , trying figure out how can access it, have button when press want restart movie clip frame 1 , play.

i exposed actionscript class of mymovie.

i can create new instance of going

var mymovie:movieclip = new mymovie(); 

but want access 1 added timeline frame, not create new one. can run .gotoandplay(1) on movie clip restart it.

just create variable reference object when creating code, in example:

var mymovie:movieclip = new mymovie(); 

you need same thing movieclip dragged on time line during authoring time. this

  1. select mc
  2. open properties panel/properties inspector panel (whatever it's called nowadays)
  3. specify instance name

that's pretty equivalent creating variable on timeline. that's because flash automatically declares instance names of objects variables on timeline place them on. can disabled in actionscript settings, enabled default. when specified instance name in properties, can work if variable (as said, more or less variable) not have declare variable again var keyword. do:

mymovie.gotoandstop(3); 

to see if works.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -