adding and removing a movie clip on enter and exit frame


addeventlistener(event.enter_frame,addship_move_mc);

addeventlistener(event.exit_frame,removeship_move_mc);

 

 

function addship_move_mc(e:event):void

{

 

 

          //adds main menu screen

          var testaccel_ship_01:accel_ship_01 = new accel_ship_01();

          testaccel_ship_01.y = 195;

          testaccel_ship_01.x = 22;

          addchild(testaccel_ship_01);

          visible = true;

          trace("open ship movie");

 

 

}

 

 

 

 

function removeship_move_mc(e:event):void

{

          if (visible = true);

          {

                    removechild(testaccel_ship_01);

                    trace("close ship movie");

          }

}

 

 

you might not understand asking far using enter_frame/exit_frame event listeners.  process continually @ fps rate of file.

 

also, in declaring variable testaccel_ship_01 inside function, limited within scope of function, remove function cannot target using variable name.

 

if explain intentions of trying do, alternative approach can offered.



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support