funktioner som aktiver et sæt af funktioner
Hej, jeg ønsker at lave en funktion på et menupunkt som aktiverer følgende funktioner. Det jeg tænkte var at man definere en overordnet funktion f.eks. overordnet() og at den så indeholde nedenstående kode. Når man så trykker på et menupunkt, så kan man blot kalde overordnet...?? Hvordan gøres disse to skridt (1) laver en funktion som indeholde en masse andre funktioner (2) aktiverer en anden funktion ved at trykke på en knap/J
_______________________________
import mx.transitions.Tween;
import mx.transitions.easing.*;
var tween_handlernul:Object = new Tween(menu, "_x", Elastic.easeInOut, 100, 200, 1, true);
var tween_handleret:Object = new Tween(meny, "_x", Elastic.easeInOut, 100, 200, 1, true);
tween_handleret.onMotionFinished = function() {
var tween_handlerto:Object = new Tween(menu, "_alpha", Elastic.easeInOut, 100, 0, 0.2, true);
var tween_handlertre:Object = new Tween(meny, "_alpha", Elastic.easeInOut, 100, 0, 0.2, true);
tween_handlertre.onMotionFinished = function() {
var tween_handler1:Object = new Tween(front, "_xscale", Elastic.easeInOut, 200, 100, 1.5, true);
var tween_handler3:Object = new Tween(back, "_xscale", Elastic.easeInOut, 200, 100, 1.5, true);
tween_handler1.onMotionFinished = function() {
var tween_handler2:Object = new Tween(front, "_yscale", Elastic.easeInOut, 250, 100, 1.5, true);
var tween_handler4:Object = new Tween(back, "_yscale", Elastic.easeInOut, 250, 100, 1.5, true);
trace("onMotionFinished triggered");
tween_handler4.onMotionFinished = function() {
_root.traceBox.vScrollPolicy ="on";
//trace function
function myTrace(msg)
{
_root.traceBox.text += msg + newline;
_root.traceBox.vPosition = _root.traceBox.maxVPosition;
}
/*********************************************************************/
//init
var myMCL = new MovieClipLoader();
/*********************************************************************/
//callbacks
myMCL.onLoadStart = function (targetMC)
{
var loadProgress = myMCL.getProgress(targetMC);
myTrace ("The movieclip " + targetMC + " has started loading");
myTrace("Bytes loaded at start=" + loadProgress.bytesLoaded);
myTrace("Total bytes loaded at start=" + loadProgress.bytesTotal);
myTrace("____________________________________");
_root.pre._alpha=50;
myTrace("JENS")
}
myMCL.onLoadProgress = function (targetMC, loadedBytes, totalBytes) {
myTrace ("movie clip: " + targetMC);
myTrace("Bytes loaded at progress callback=" + loadedBytes);
myTrace("Bytes total at progress callback=" + totalBytes);
myTrace("____________________________________");
;
}
myMCL.onLoadComplete = function (targetMC)
{
myTrace (targetMC + " has finished loading.");
var loadProgress = myMCL.getProgress(targetMC);
myTrace("Bytes loaded at end=" + loadProgress.bytesLoaded);
myTrace("Bytes total at end=" + loadProgress.bytesTotal);
myTrace("____________________________________");
_root.pre._alpha=0;
_root.container._alpha=0;
myTrace("JENS2")
}
myMCL.onLoadInit = function (targetMC)
{
myTrace ("Movie clip:" + targetMC + " is now initialized");
//targetMC._width = 400;
//targetMC._height = 500;
myTrace("____________________________________");
}
myMCL.onLoadError = function (targetMC, errorCode)
{
myTrace ("ERRORCODE:" + errorCode);
myTrace (targetMC + "Failed to load its content");
myTrace("____________________________________");
}
/********************************************************************/
//load the files in to their respective targets
myMCL.loadClip("underside.swf","_root.container");
//myMCL.loadClip("test2.swf", "_root.myMC2");
//myMCL.loadClip("somepic.jpg", "_level0.myMC3");
//tween.onMotionFinished = function() {
var tween_handler5:Object = new Tween(front, "_yscale", Elastic.easeInOut, 100, 250, 1.5, true);
var tween_handler7:Object = new Tween(back, "_yscale", Elastic.easeInOut, 100, 250, 1.5, true);
trace("onMotionFinished triggered");
tween_handler7.onMotionFinished = function() {
var tween_handler6:Object = new Tween(front, "_xscale", Elastic.easeInOut, 100, 240, 1.5, true);
var tween_handler8:Object = new Tween(back, "_xscale", Elastic.easeInOut, 100, 240, 1.5, true);
trace("onMotionFinished triggered");
tween_handler8.onMotionFinished = function() {
var tween_handler9:Object = new Tween(_root.cover, "_alpha", Photo.easeIn, 100, 0, 2, true);
trace("onMotionFinished triggered");
tween_handler9.onMotionFinished = function() {
var tween_handler11:Object = new Tween(menu, "_alpha", Elastic.easeInOut, 0, 100, 0.2, true);
var tween_handler12:Object = new Tween(meny, "_alpha", Elastic.easeInOut, 0, 100, 0.2, true);
var tween_handler12:Object = new Tween(container, "_alpha", Elastic.easeInOut, 0, 100, 0.2, true);
trace("onMotionFinished triggered");
tween_handler11.onMotionFinished = function() {
var tween_handlernul:Object = new Tween(menu, "_x", Elastic.easeInOut, 200, 70, 1, true);
var tween_handleret:Object = new Tween(meny, "_x", Elastic.easeInOut, 200, 70, 1, true);
};
};
};
};
};
};
};
};
________________________________________________________-
