I have made a MovieClip and attached it to the below code.When i test the movie and i have already placed an instance on stage it works fine.When i instantiate the object through code and add it to stage it disappears when i click it.I work in flash.
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
import fl.transitions.easing.*;
import com.greensock.*;
public class Card6 extends MovieClip {
public function Card6( ) {
addEventListener(MouseEvent.CLICK, Enter);
}
private function Enter( ev : MouseEvent ) {
TweenMax.to(this, 0.25, { rotationY: 180 } );
}
}
}
This is the code where i instantiate the MovieClip from the library,Card6 is the base Class.
var photo: MovieClip = new PhotoB( );
photo.x = 100;
photo.y = 300;
stage.addChild(photo);
UPDATE : I succeed to make it work i don't know how since i didn't changed the code a bit.The problem is i don't know what is the solution and i encounter the same problem in other examples. This is the code i used in the first frame and worked.
var sp : DisplayObject = new border( ); //<-- Different name,same Object
addChild(sp);
sp.x = 400;
sp.y = 300;
And this is the code i used for the Main Class
package {
import flash.display.MovieClip;
public class DocumentH extends MovieClip {
public function DocumentH( ) {
var sp : MovieClip = new border( );
addChild(sp);
sp.x = 400;
sp.y = 300;
}
}
}
I can't tell what made the diferrence and worked.I try to do the exactly same thing in another fla and failed.In library i have only one square which a have convert it to MovieClip. (Here is a link with the fla http://www65.zippyshare.com/v/65975812/file.html). I use Flash CS4 Pro