Banner für Logo von birdy1976.com und Navigation
XING myblueplanet.ch - Wir zeigen im Kleinen, was im Grossen machbar ist Skype Me! ESN Winterthur: Erasmus Student Network Die eLearningNews - der Newsletter Filme für die Erde

Macromedia Flash MX

Define Path with Mouse and Draw Line +

Clip | Source

An ActionScript Snippet Example by birdy1976

// STEP 1
// run this script and press the
// mouse button to record your path
var i = 0;
var flagRecord = false;
var flagPlay = false;
var arrXPos = new Array();
var arrYPos = new Array();
//
// STEP 2
// copy and paste the mouse positions
// from the output window below here.
// an example how it might look like:
// arrXPos[0] = 534;
// arrYPos[0] = 46;
// arrXPos[1] = 540;
// arrYPos[1] = 50;
// ...
// delete all the values of the arrays
// if you want to record a new path!
//
// STEP 3
// there is no step three...
//
// - - - - -
// do not touch the code below here
// unless you know what you are doing
// - - - - -
// when mouse button is pressed record
_root.onMouseDown = function() {
  flagRecord = true;
};
_root.onMouseUp = function() {
  flagRecord = false;
};
// check if a path has been defined
if (arrXPos.length>0) {
  flagPlay = true;
}
// record or playback one frame at a time
_root.onEnterFrame = function() {
  // print out the path of the mouse
  if (flagPlay && i+1<arrXPos.length) {
    with (_root.clpDraw) {
    lineStyle(2, 0x000000, 100);
    moveTo(arrXPos[i], arrYPos[i]);
    lineTo(arrXPos[i+1], arrYPos[i+1]);
  }
  i++;
  } else {
    // record the current position of the mouse
    if (flagRecord) {
      trace("arrXPos["+i+"] = "+Math.round(_xmouse)+";");
      trace("arrYPos["+i+"] = "+Math.round(_ymouse)+";");
      i++;
    }
  }
};

© 1998-2008 Martin Vögeli. Für Inhalte und Links werden keine Verantwortung übernommen.
martinvoegeli@gmx.ch | +41 76 505 8 503 | birdy1976.com | elearning.zhaw.ch

Home Home Kontakt Suche News