-
1. Re: Creating a simple android/iphone game in flash-- having trouble
gotoAndHelp ( please ) Oct 20, 2011 1:20 AM (in response to the_missing_link)in as3 we dont use +2 for moving a movieclip, it would be something like += 2 if you wanted to move it constantly by two, but it would have to be a enter frame handler, If you want to simply movie it to a destination:
var mymc:MovieClip = new MovieClip;
mymc.addEventListener(MouseEvent.CLICK, afunction);
function afunction(event:MouseEvent):void
{
mymc.x = 100;
mymc.visible = false;
}
if you want it to look good, i suggest looking into greenstock, the as3 tweening engine. Its really easy to use here's an example:
TweenLite.to(mymc, 3, {x:100});
you instance your movieclip you want to move "my mc", then state the duration of the tween "3" and then the x value you want to tween the object to "[x:100]"
-
2. Re: Creating a simple android/iphone game in flash-- having trouble
Siva.2188 Oct 20, 2011 1:36 AM (in response to gotoAndHelp ( please ))var mc:MovieClip = new MovieClip();
mc.graphics.beginFill(0x00FF00);
mc.graphics.drawCircle(0, 0, 30);
addChild(mc);
mc.x = 150;
mc.y = 150;
mc.addEventListener(MouseEvent.CLICK, onClick);
function onClick(evt:MouseEvent):void{
evt.target.x += 20;
//evt.target.visible = false; //If you want visible false
}
+=2 means we are increaseing x position 2 when we click
+2 means we are giving x position means like this mc.x = 2

