|
Action to reverse movie
onClipEvent (enterFrame) {
with (_root) {
if (goBack && (_currentFrame>1)) {
trace (true);
gotoAndStop(_currentFrame-1);
}
}
}
Posted by: Evgueni Strok | website http://www.actionscript.org |
We have: MCmain with instance name(xxx) / MCcontrol with instance name(MCback)/ button
//----------------------------------------------------------------------
//Button
//----------------------------------------------------------------------
on (rollOver) {
tellTarget ("MCback") {
gotoAndPlay (2);
}
}
on (rollOut) {
tellTarget ("MCback") {
gotoAndStop (1);
}
}
//----------------------------------------------------------------------
//MCcontrol has a 3 frames
//----------------------------------------------------------------------
//frame #1
movingl = 0;
tellTarget ("_root.xxx") {
play ();
}
stop ();
//frame #2
movingl = 1;
play();
//frame #3
tellTarget ("_root.xxx") {
prevFrame ();
}
gotoAndPlay (2);
Posted by: Evgueni Strok | website http://www.actionscript.org |
//check to see if MC allows/block line of sight between two points MovieClip.prototype.lineOfSight = function(x1,x2,y1,y2,sampleRate,shapeFlag){ los_distance = Math.sqrt(((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)));//get distance if(sampleRate==undefined){//set default params sampleRate=10; }else if(sampleRate==true || sampleRate==false){ shapeFlag=sampleRate; sampleRate=10; } if(shapeFlag==undefined){ shapeFlag=true; } los_samples = los_distance/sampleRate;//number of hitTests los_angle = -Math.atan2((x1-x2),(y1-y2))/(Math.PI/180);//get angle los_xSpeed = sampleRate*Math.sin(los_angle*(Math.PI/180));//calculate hitTest itnerval range los_ySpeed = sampleRate*Math.cos(los_angle*(Math.PI/180)); los_x=x1;//set starting point los_y=y1; for(los_i=1 ; los_i<=los_samples ; los_i++){//interval hitTest los_y -= los_ySpeed; los_x += los_xSpeed; if(this.hitTest(los_x,los_y,shapeFlag)){ return false; } } return true;//if all hitTest pass false, then line of sight is true } //check to see if MC allows/block line of sight between two points //returns object with following properties: //los : true or false //x,y : exact x and y coordinates of hit //xprev,yprev : last 'safe' x and y coordinates(before hit) //angle : angle between the two points //distance : distance between the two points MovieClip.prototype.lineOfSightHit = function(x1,x2,y1,y2,sampleRate,shapeFlag){ losh_distance = Math.sqrt(((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)));//get distance if(sampleRate==undefined){//set default params sampleRate=10; }else if(sampleRate==true || sampleRate==false){ shapeFlag=sampleRate; sampleRate=10; } if(shapeFlag==undefined){ shapeFlag=true; } losh_samples = losh_distance/sampleRate;//number of hitTests losh_angle = -Math.atan2((x1-x2),(y1-y2))/(Math.PI/180);//get angle losh_xSpeed = sampleRate*Math.sin(losh_angle*(Math.PI/180));//calculate hitTest itnerval range losh_ySpeed = sampleRate*Math.cos(losh_angle*(Math.PI/180)); losh_x=x1;//set starting point losh_y=y1; lineOfSightHit_return = new Object;//create return object lineOfSightHit_return.los=true; for(losh_i=1 ; losh_i<=losh_samples ; losh_i++){//interval hitTest losh_y -= losh_ySpeed; losh_x += losh_xSpeed; if(this.hitTest(losh_x,losh_y,shapeFlag)){ lineOfSightHit_return.los=false; lineOfSightHit_return.x=losh_x; lineOfSightHit_return.y=losh_y; lineOfSightHit_return.xPrev=losh_x-losh_xSpeed; lineOfSightHit_return.yPrev=losh_y+losh_ySpeed; break; } } lineOfSightHit_return.angle=losh_angle; lineOfSightHit_return.distance=losh_distance; return lineOfSightHit_return; } //used to detect collisions between an objects start point and end point in 1 frame //unlike lineOfSight, this requires all data(angle, speeds, ect.) to be given, but is therefor much faster MovieClip.prototype.hitTestSubSample = function(x,y,angle,distance,sampleRate,shapeFlag,sub_xSpeed,sub_ySpeed){ sub_x=x;//set starting point sub_y=y; sub_return = new Object();//object to return all the data sub_return.hit=false; for(sub_i=0 ; sub_i<distance ; sub_i+=sampleRate){ //while(!this.hitTest(sub_x,sub_y,shapeFlag)){ if(sub_xSpeed==undefined){ sub_xSpeed = sampleRate*Math.sin(angle*(Math.PI/180));//calculate hitTest itnerval range sub_ySpeed = sampleRate*Math.cos(angle*(Math.PI/180)); } sub_x += sub_xSpeed; sub_y -= sub_ySpeed; if(this.hitTest(sub_x,sub_y,shapeFlag)){ sub_return.hit=true; break; } } sub_return.x = sub_x; sub_return.y = sub_y; sub_return.xSpeed = sub_xSpeed; sub_return.ySpeed = sub_ySpeed; sub_return.xPrev = sub_x-sub_xSpeed; sub_return.yPrev = sub_y+sub_ySpeed; return sub_return; } Posted by: abeall | website http://abeall.com |
movieclip.prototype.klon = function(id,k,news,posY,posX) {
attachMovie(id, id+k, k );
this[id+k].news = news
this[id+k]._y = posY
this[id+k]._x = posX
}
klon("n",1,"HIER KOMMEN DIE TAGES NEWS",100,50);
klon("n",2,"DIREKT AUS DEM AIRPORT TICKER",125,50);
klon("n",3,"WIR HABEN DAS NEUSTE DES TAGES",150,50);
klon("n",4,"UND SIE KÖNNEN ES ABRUFEN !",175,50);
klon("n",5,"###########################",225,50);
klon("n",6," FUNCTION POSITION() {",250,50);
klon("n",7," _X = 100;",275,50);
klon("n",8," }",300,50);
klon("n",9,"###########################",325,50);
klon("n",10,"WIE MAN SIEHT KANN MAN HIER EINE MENGE SCHREIBEN !",350,50);
movieclip.prototype.init = function(inhalt) {
liste = new Array();
max = inhalt;
zeichen = new Array(".",",",":",";","_","-","+","*","#","`","´","!","?","=","§","$","%","&","(",")","[","]","{","}","0","1", "2", "3", "4", "5", "6", "7", "8", "9","Ö","Ä","Ü","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
i=0;
while (max.length > i) {
liste.push(max.substr(i, 1));
i++;
}
j=0;
z._visible = 0;
}
movieclip.prototype.anzeige = function() {
if (j<max.length) {
j++;
duplicateMovieClip (z, ["z"+j], 100+j);
this["z"+j]._x = z._x + 9.5*j;
this["z"+j].ende = liste[j-1];
}
}Posted by: Matthias Kannengiesser | website http://www.flashstar.de |
//_root.movieclip1.dragtomov(_root.movieclip2)
Movieclip.prototype.dragtomov=function(movieclip,lockcenter){
var temp=movieclip.getBounds(_parent)
this.startDrag(lockcenter,temp.xmin+(this._width/2),temp.ymin+(this._height/2),temp.xmax-(this._width/2),temp.ymax-(this._height/2))
}
Posted by: Flashguru | website http://www.flashguru.co.uk |

