Thursday, 25 February 2016

EMPTY MOVIE CLIP ADD CHILD REMOVE CHILD AS3



------------------------------------------------------------------------------------------------------------------
READ MORE:
http://flashcollege.blogspot.co.uk/2015/02/movie-shuffle-as3.html
http://www.flashwonderland.com/load-library-movieclip/load-mc-3.html
http://www.republicofcode.com/tutorials/flash/as3events/
-------------------------------------------------------------------------------------------------------------------

EMPTY MOVIE CLIP ADD CHILD REMOVE CHILD AS3
1) MAKE TWO BUTTON WITH INSTANCE NAMES
   AddChild,  RemoveChild

2) MAKE RED MOVIE CLIP
   RED MOVIE CLIP INSTANCE NAME = emptyMC

3) MAKE CIRCLE MOVIE CLIP AND GO TO ITS PROPERTY AND SET CLASS NAME
   SET CLASS NAME = McClass

CODE:
------------------------------------------------------------------------------------------------------------------

var myMovieClip:McClass = new McClass();
emptyMC.addChild(myMovieClip);

AddChild.addEventListener(MouseEvent.CLICK,ClickAdd);
function ClickAdd(event:MouseEvent): void {
emptyMC.addChild(myMovieClip);
}

RemoveChild.addEventListener(MouseEvent.CLICK,ClickRemove);
function ClickRemove(event:MouseEvent): void {
emptyMC.removeChild(myMovieClip);
}

------------------------------------------------------------------------------------------------------------------
OR USE THIS CODE:

// ADD CHILD IS CLASS IN AS3 // ADD CHILD ON STAGE OR MOVIE CLIP OR BUTTON //HERE ClassBox IS CLASS NAME //OR USE SMALL FORM addChild(SymbolClass) // OR USE FULL FORM stage.addChild(SymbolClass); // FOR MOVIE CLIP SYMBOL Mc1.addChild(SymbolClass
------------------------------------------------------------------------------------------------------------------
//http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b8ea63-7fee.html
var SymbolClass:ClassBox = new ClassBox();
stage.addChild(SymbolClass);
Mc1.addChild(SymbolClass);
----------------------------------------------------------------------------------------------------------------------
https://www.youtube.com/watch?v=aupV4EZqI0Q
http://flashgameu.com/book_source_files_2.html
A3GPU202_GameElements.zip
----------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------
https://books.google.co.uk/books?id=9xqBU_BlOkoC&printsec=frontcover&dq=matching+game+as3&hl=en&sa=X&ved=0ahUKEwjq5oTt96rLAhXHuBoKHfVDBnAQ6AEILzAA#v=onepage&q&f=false Figure:2.2
A3GPU202_GameElements.zip ================================================================== //http://flashgameu.com/book_source_files_2.html //A3GPU202_GameElements.zip //UsingMovieClips.fla //https://books.google.co.uk/books?id=9xqBU_BlOkoC&printsec=frontcover&dq=mast+game+as3&hl=en&sa=X&ved=0ahUKEwi_9e7dvrTLAhUBWhoKHa0vDPQQ6AEIKzAA#v=onepage&q&f=false //MAKE MOVIE CLIP GIVE CLASS NAME Mascot // DOUBLE CLICK MOVIE CLIP SET SIZE WIDTH:138.15 HEIGHT: 182.10 //MOVIE CLIP INSIDE XY POSITION X = -66 ; Y= -93 // create a simple movie clip from the "Mascot" Library item // place it at 275,150 // rotate it 10 degrees var myMovieClip:Mascot = new Mascot(); myMovieClip.x = 275; myMovieClip.y = 150; myMovieClip.rotation = 10; addChild(myMovieClip); // create 10 movie clips, spaced with different x values // scale 25% for(var i=0;i<10;i++) { var mascot:Mascot = new Mascot(); mascot.x = 50*i+50; mascot.y = 300; mascot.scaleX = .5; mascot.scaleY = .5; addChild(mascot); }




EmoticonEmoticon