// PippoFlash.com // SmoothMover Example // Import SmoothMover Class import PippoFlash.SmoothMover; // Stop the timeline stop(); // Setup function to move function pressMoveButton() :Void { // Update text field output.text = "PippoFlash - SmoothMover\n"; // Create parameters object var params = new Object(); params.props = new Array(); params.endPos = new Array(); // Setup listener for parameter object params.listener = _root; // Setup random or default value for speed params.speed = s.selected ? params.speed = Math.round(Math.random() * 28 +1.5) : 5; output.text += "\nspeed : " + params.speed; // Creates random values if (x.selected) { params.props.push("_x"); params.endPos.push(Math.round(Math.random()*Stage.width)); output.text += "\n_x : " + params.endPos[params.endPos.length-1]; } if (y.selected) { params.props.push("_y"); params.endPos.push(Math.round(Math.random()*Stage.height)); output.text += "\n_y : " + params.endPos[params.endPos.length-1]; } if (xs.selected) { params.props.push("_xscale"); params.endPos.push(Math.round(Math.random()*210 - 10)); output.text += "\n_xscale : " + params.endPos[params.endPos.length-1]; } if (ys.selected) { params.props.push("_yscale"); params.endPos.push(Math.round(Math.random()*210 - 10)); output.text += "\n_yscale : " + params.endPos[params.endPos.length-1]; } if (r.selected) { params.props.push("_rotation"); params.endPos.push(Math.round(Math.random()*720 - 360)); output.text += "\n_rotation : " + params.endPos[params.endPos.length-1]; } // Starts motion SmoothMover.slide(myClip, params); } // Setup function to liten to broacasted events function onSmoothMoverFeedback(p:Object) :Void { if (p.message == "SMCOMPLETE") { output.text += "\n\nSmooth Motion Complete."; } } // Set interactivity for button buttonMove.addEventListener("click", pressMoveButton);